Hardware

External TTL trigger

To automatically start /stop acquisition by means of an external TTL signal follow the following instructions.

First, connect an appropriate TTL control signal to the P1.6 (pin #21) of the extension header of the Scanbox board.  The view below shows a top view of the Scanbox control board.  The pin in question is located on the back row of connectors when viewing the board from the front.  As a ground pin, you can use pin #3.  To make it easier to make the appropriate connections it helps to get the this cable and route it outside the box.

Capture

StartCapture the Scanbox software and operate as usual by focusing and selecting the area you want to record.  When ready to switch to external trigger control, simply click the “External TTL Trigger” checkbox, which is located in the middle of the Scanner control panel.

After enabling the TTL trigger, the manual Focus/Grab buttons will be grayed out and blocked from usage.  If you want to go back to manual control simply deselect the TTL Trigger checkbox.

The rising edge of the TTL control signal is used to start/stop the microscope.  Minimum pulse width is 1 ms.

While controlling the microscope using an external TTL signal it is useful to run it in continuous resonant mode (so you avoid waiting for the resonant mirror to warm up) , and set the “autoinc” configuration variable to “true”, so file numbers increment automatically after the completion of each session.

To use this feature you have to update to the latest version of the firmware/software.

Update [6/23/17]:

If you are willing to give use of TTL1 as an event line, a new trig_sel configuration variable allows you to use it instead of the signal from the header to start and stop the acquisition.  You will have to upgrade to the latest version of the software.  Follow the instructions here.  You can skip the steps asking you to update knobby, the motor box, and run vc_redist.x64.exe.  After the update, simple set the trig_sel configuration variable to true if you want to trigger with TTL1 (or false if you want to trigger using the header signal).

Knobby scheduler

CaptureA new Scanbox panel allows users to define arbitrary changes in (x,y,z) position over time (frames) which are then executed by Knobby (version 2 only) while imaging.

Each entry define changes in x, y and z (in micrometers) relative to the present position and the frame number at which they will take place.

The “mem” column allows one to specify one of the stored absolute coordinates instead (memory locations are coded A=1, B=2, C=3).  If a memory location is defined the other entries are ignored and the position in the referenced memory is used instead.

This mechanism extends the z-stack functionality to include the ability to tile a sample and brings back the control window to one of the panels in Scanbox (as opposed to being controlled in Knobby’s screen).  The Knobby table is also saved in the info.knobby_table variable.

Paths can be computed offline and stored in a Matlab file that can be loaded.  The example below shows knobby moving the sample along a circular path.

Bada boom! New system coming soon!

So why the long silence in the Scanbox blog?

We have been working hard on a the development of our new system. A modular, expandable system that will run the new line of Neurolabware microscopes (aka the Kraken microscope) and is backward compatible with our previous box.

Want a sneak peak?

Bada boom!

 

nlw-full-tower

Here is a closeup of some of the LCD/power modules…

nlw-lcd-module

nlw-pwr-open

If you are interested in the new features of the Kraken microscope and the new modular system please get in touch with Neurolabware.

Surface sampling in Scanbox

Answering a request from colleagues in London, the upcoming version of the Scanbox firmware will allow users to change the depth of imaging on a line-by-line basis.

Up to now, during volumetric imaging, users were allowed to change the setting of the electronically tunable lens (ETL) once per frame (during the transition from one frame to another).

The new version offers the possibility of changing the depth (z) as a function of the line number (y).  For example, the image of a pollen grain below, was obtained using a sinusoidal modulation in depth.

capture-1

There are at least two potential uses for this new feature.

First, one can increase the yield of imaged cells by first measuring a z-stack and then designing a (smooth) sampling surface z = f(y) that maximizes the number of cells that can be imaged.

For example, assume the projection of cell bodies within the volume is given by the scatter-plot below. Then sampling with the solid curve line will yield many more cells (red circles) than sampling with any horizontal plane (such as the dashed horizontal lines).

sampling

I will explain how to calculate an optimal (smooth) function of depth that maximizes the number of cells sampled in a separate post (the algorithm is too large to fit in the margin here.) [Actually, I added it below].

The surface sampling method offers a compromise between random access and volumetric imaging across planes, many of which may not contain many cells, thereby reducing the temporal resolution unnecessarily.  Have any groups done something like this before?

The second use of this new feature is that it can allow us to correct for the ringing in ETL focal plane that results from a step change.

If you have been doing volumetric imaging, where N frames are sampled at each depth, you might have realized that a few of the lines at the top of the frame on the first frame after a depth transition is screwy.  This is due to the ringing of the ETL. One can potentially use the ability to change ETL command on the fly to compensate for this ringing.

I have not yet implemented this.  Are there any Scanbox users doing volumetric imaging that are willing to help?

Algorithm: 

Given a set of cell body projections (y_i, z_i) we want to find a smooth function z=f(y) that intersects as many cell bodies as  possible.

We do this by restricting z(y) to be sum of the first N harmonics, z(y) =a_0+\sum_{k=1}^N a_k \cos ( 2 \pi k y + \phi_k ), so it is both smooth and periodic as well, which will prevent ringing in the ETL during fly back to the first line. The function has 2N+1 parameters.  For simplicity, here we normalize the total number of lines in the frame is normalized to be in the range [0,2 \pi].

Given a set of parameters, denote by d_i the minimum distance between the location of cell i and any of the points on the curve z(y). Our objective function is J= \sum_{k=1}^M \tanh ( (d_i - r_0)  \beta ).  Here, r_0 represents the average radius of a cell and \beta controls the sharpness of the error function near that boundary, M is the total number of cells in the volume. For a give sent of points, we used Matlab’s fminsearch to find the optimal parameters for the curve.

How much improvement in yield can we expect using surface sampling versus just one plane?

We ran a few simulations where the number of points is uniformly distributed within the volume and calculated the fraction of cells we can intersect as a function of the number of harmonics used. Zero harmonics means just the horizontal plane that intersects the maximum number of cells.yield  The graph on the left shows the results.

Even in the simple case of a uniform distribution one can more than double the yield expected from a single plane by having a few (~5-6) harmonics. In other words, using surface sampling we can double the number of cells with respect to a horizontal plane without any penalty in temporal resolution.  Not bad at all.

We will re-do this analysis with some actual volumetric data from our Lab soon. I suspect this estimate represents a lower bound on what can actually be achieved.

 

Installing knobby tablet

Before you start you will need an android tablet and a wireless router in the Lab.

I have a Samsung Galaxy Tab E and an Airport Express, but other tablets and routers should work as well.

To install knobby tablet follow the following steps:

  1. Download knobby tablet from the Google Play store.
  2. Download and install the latest version of Scanbox (as always keep a copy of previous version).
  3. Download and install PyOSC.  To install, open a terminal, go to the directory where you uncompressed PyOSC, and type “python setup.py install”.
  4. Copy over the settings in the scanbox_config.m file.
  5. Connect the computer running Scanbox to your local wireless router
  6. Open a terminal window and check the IP assigned to the computer by typing ifconfig.
  7. Set the tri_knob configuration variable in scanbox_config.m to a string that contains the IP address, for example, ‘164.34.123.31’.
  8. Start Scanbox.  You should also get a command window with the knobby tablet console.  We will check if commands from the tablet are received there.
  9. Open knobby tablet on your Android.  You will likely get a message saying that the default IP is invalid.  Click Ok.
  10. Click on the IP number button.  A keyboard will show up.  Enter the IP number you found above.  However, make sure that every section has 3 digits (use zeros if necessary).  Thus, in the example above, one would type 164.034.123.031
  11. If the tablet cannot connect, you will see an “Invalid IP” message.  Otherwise, you should be ready to go.  The IP gets stored in the tablet, so launching knobby tablet later will retrieve it.
  12. Remove the objective from the microscope (just in case).
  13. Make sure the scope is roughly in the middle of its travel for all axes.
  14. Click the “Normal” button on the tablet.  Do you see a message printed on the knobby console?  If so, communication is working Ok.  If not, something is wrong.  Contact me.
  15. Stand close to the motor box so you can quickly power it off if something does not work as expected.
  16.  Now touch the button corresponding to the Z axis on the red region.  The z-axis will begin to move so long as you keep touching it.  The speed of movement will be faster the farther away you are from the center.  Slide your finger left and right, the speed will change and it should reverse if you move over to the blue side.
  17. Test the other axes.screenshot_20161112-150708
  18. Touch “Velocity” to switch to velocity mode.
  19. Warning: the microscope will move fast now…  Touch the red or blue areas of each button.  The microscope will move at a fast/fixed speed so long as you keep touching the area.  It will stop when you release.
  20. Store/Recall buttons work as before
  21. Go back and try the Fine and Super-Fine modes.
  22. Play with it for a while and install the objective back after you familiarize yourself with the tablet interface and everything seems to be working Ok.
  23. You can minimize the knobby console once testing is done (I will do this automatically in future versions).
  24. The green buttons on the side lock the button area (bottom) or knob area (top).  So if you are acquiring data and don’t want to have a situation where people touch the tablet by mistake and move the microscope you can use the buttons to lock them.  Touching them again will unlock.
  25. Make sure you open knobby on your tablet  after you start Scanbox.

If you run into problems don’t hesitate to write.

 

 

Scanbox does 2p-SLM stimulation! (And the mystery of the disappearing cell)

Scanbox is almost ready for in-vivo, two photon stimulation using spatial light modulators!  In our first set of experiments we are are testing the system in SOM cells co-expressing C1V1 and GCaMP6.  Prior to each experiment, we perform a calibration to ensure alignment of the SLM and imaging paths (takes ~3 min).  Cells for stimulation are selected in the same fashion as we define ROIs for real-time processing.  Scanbox allows the selection of an ROI, disk size, pulse duration, and laser power to use for stimulation.  This basic SLM interface is as simple as “point and shoot” and allows one to visualize the traces of all ROIs in response to stimulation.  The stimulus pulse is also shown superimposed on the traces.

Below are two examples where we stimulated two separate cells within the same field of view.  In the movies, the green circle shows the cell that will be stimulated.  The stimulation pulses are shown as a red dot flashed to the right to the frame number (they are very brief).

Here is another cell being stimulated within the same field of view:

Interestingly, stimulation of a single cell also drives a few others in its neighborhood (together with their processes) consistent with the reported existence of gap-junctions between sets of inhibitory neurons of the same type.

We also observed a curious phenomenon, referred in the lab as the mystery of the disappearing cell, which we cannot explain…  but we are sure someone reading this will know the answer to.

After stimulating a cell a few times in succession, GCaMP fluorescence is actually diminished within the cell body and in its near neighborhood, making the cell “disappear” and creating a “hole” within the image.  The “hole” encompasses the cell body and part of the immediate surroundings.

Surprisingly, after waiting 15-20 sec the the cell reappears, suggesting this is not merely a case of photo-ablation.  In the example below we show this phenomenon in two separate cells within the same field of view:

So, what the heck is going on?!  Can you help us explain the mystery of the disappearing cell?

Here are some of the suggestions offered within the Lab:

Adrian:

  • Instant bleaching
  • Higher rate of non-linear bleaching/triplet state
  • Conversion or release of opaque molecules
  • Physical movement of tissue due to heating/other dynamics
  • Photo-switching to off state of GCaMP (all GFPs photos-witch under UV)
  • GFP related changes (environment, pH, FRET)
  • Camp related changes (Ca buffering)

Josh:

  • “Yuste said 2p stimulation pokes holes in cells [….] (paper here)”

Dario:

  • Two-photon stimulation distorts the space-time continuum transporting the cell to another dimension.

If you know the answer, please, please… let us know in the comments below!  (Whatever is going on, at least the phenomenon provided us with a simple handle to verify we can precisely calibrate the SLM and imaging paths and stimulate single neurons.)

In terms of further development, we will add an SLM-server that reads the calibration data, the ROIs, and listens to commands over the network, allowing the user to stimulate any subset of the N cells, with different disk sizes, pulse times, and intensity levels.  It should not take more than a week.

It is time to start thinking about all the cool experiments that are coming up next (and start shopping for a new laser)! 🤓