2-photon imaging: workflow

This page describes in detail ALL the steps needed to set up computers, stimulus parameters, Prairie View parameters etc for 2 photon imaging. The template is borrowed from "two-photon recording" page from the vhlabtools website, with more relevant details added to it.

1. Prepare for a 2-photon imaging by setting up as follows:

To start up equipments:

A) Turn on the microscope power (the big switch).

B) Turn on the acquisition computer

C) If you will use epifluorescent imaging, turn on the Xcite illuminator.

D) On the computer, start the PrairieView application.

E) On the 2P laser tab (the tabs are about halfway down the PrairieView control panel), click the toggle button to turn the Laser power "ON". Wait for the power to come up to over 1000mW.

To begin 2-photon imaging:

A) Make sure the turret is in position 1 (the position that is labeled "2P" on the key).

B) Make sure the selector rod is all the way out (LSM position as opposed to BF)

C) Make sure the microscope door is lowered as much as is possible for your configuration

D) Make sure the filter wheel on the Xcite illuminator is set to block the outgoing light

E) Make sure you have turned on the PMT channels you want to image

F) Press LIVE SCAN and make sure you hear the microscope shutter click.

G) Set the PMT gains for the channels you want to use; a good starting point is 800 units (typical range of use in brain is 700-900)

H) On the Laser/PMT/DAQ tab set laser power with the "pockels" slider (for pollen, use less than 10mW, usually 3-5 pockels units; for the brain, use <50mW for physiology; see the calibration page to see the relationship between pockels units and laser power (in mW) that is emitted at the objective).

2. Set up the MASTER and STIMULUS computers as follows:

A) Identify your computing team: In each setup, there is a MASTER computer that coordinates all activity in the experiment and a STIMULUS computer that shows visual stimuli. In addition, there may be one or more additional specialized computers that perform other functions (such as a 2-PHOTON computer for controlling a 2-photon microscope). For the VHLab 2-photon Rig 2, leghorn (PC) is the master computer and sanders (PowerMacs) is the stimulus computer.

B) Turn on the MASTER computer and wait for it to boot up. Don't forget to wait before moving on to the next step. If leghorn is slow, reboot it.

C) Turn on the STIMULUS computer. This computer should self-configure. Verify on its "monitor" display (the second display, not the visual stimulus display) that Matlab opened and that the command line reports "Waiting for remote commands...PRESS COMMAND-PERIOD (APPLE-.) to interrupt" If the computer does NOT self-configure, you can do it manually by 1) mounting the appropriate shared drive (so that your STIMULUS computer can see your MASTER computer), 2) running Matlab, and 3) typing initstims on the command line.

D) On the MASTER computer, run MATLAB. On the command line, type RunExperiment. Go to the "Data path" field and hit <return> to create a directory for today's date. Click the Acquire data checkbox to turn on communication with any acquisition devices.

E) Open your acquisition environment: On the MASTER computer, run Spike2. Open the "script" file vhlab_spike2.s2s; typically, it will be one of the most recently opened documents and will be visible at the bottom of the File menu. Under the Script menu, go to the submenu Load and Run and then select the vhlab_spike2 from the list of opened scripts.

F) In the RunExperiment figure window in MATLAB, click 'Ferret Direction' tab for tuning curve, and "Ferret training' tab for training stim.

If things go wrong while you are running a stimulus, this is how you abort a stimulus run:

A. If you are using Spike2 on the MASTER computer, then click the STOP button (the one in the toolbar near the graphs, not the one that is in the upper left). Then click the QuitRestart button to reset the Spike2 script and to setup for the next acquisition.

B. On the STIMULUS computer, bring the command window to the front and hold down the SPACE BAR; if the space bar is being held at the end of the presentation of a given stimulus, the sequential presentation will stop and the computer will return to its state of listening to remote commands. Often, you'll generate so many spaces that the window will scroll over to the right. After this happens, press enter a couple of times to return to the left side of the command line. You should see the computer saying "Waiting for remote commands..." when it is ready to continue.

C. If you are acquiring on the 2-PHOTON computer, click Abort T-series on PrairieView (or whatever software you are using).

3. In the RunExperiment window, make sure the Acquire data checkbox is checked.

4. In the RunExperiment window, in the "Acquisition list", select the first entry and click "Edit"; change the "type" to prairietp. Also, edit the reference number ref for each different location or time of imaging. Other parameters do not matter.

5. In the RunExperiment window, open the stimulus worksheet that you want to use, such as Ferret Direction.

6. Find the area you want to image on the 2-photon.

7. On the 2-PHOTON computer, In the "T-series" panel, select "Data path" and make a new folder in the "Data" directory on the desktop with today's date. For example: 2011-04-01. Use this folder as the Data path. In the following line, set the base-directory to be t00001, t00002 etc and ALWAYS set the directory number to be 1.

8. On the 2-PHOTON computer, set up the T-series so it has 3 cycles; the number of frames of cycles 1 and 3 should be 1. The number of frames for cycle 2 can be calculated by :

NUMBER OF FRAMES = [#REPS * (DURATION_OF_STIM+INTERSTIMULUS_INTERVAL) * (NUMBER_OF_STIMS_INCLUDING_BLANK)] / FRAME_INTERVAL.

The frame interval or period is dependent on the optical zoom and duel time. Once the desired zoom and swell time have been set, try to make the period zero manually (type zero then enter), it will set to the correct period. NOTE that changing zoom etc does NOT automatically resets the period.

After number of frames has been calculated, give a few extra (20-30) frames to make sure there is enough and enter your result as the number of frames for cycle 2.

9. Once you have an image of cells using the Live Scanning tab in Prairie view, hit the LUT tab on the left side toolbar of the image window. It will create a histogram of the pixel intensities. The Pockel power and the PMT voltage should be adjusted such that the peak pixels stay around 2800-3300 intensity and does not cross 3500.

10. On the MASTER computer, on the worksheet, prepare your stimulus. If you want to run a grating tuning, make sure the REPS is set to 12, the ISI is set to 5. In Edit Base, make sure the window is set to fill the screen [0 0 800 600], the spatial frequency is 0.08, and the temporal frequency is 4Hz. Set the number of cycles parameter so the stimuli will have a duration of 5 seconds (20 cycles will take 5 seconds because 5 seconds * 4 cycles / second = 20 cycles).

11. On the MASTER computer, on the worksheet, click "Run" next to the condition you want to run. It will ask you to make sure acquisition is running. On the Spike2 window, click the "Start" button that is in the lowest toolbar in the middle of the window (NOT the Start button in the upper left window). Finally, with your left hand on the mouse of the the 2-PHOTON computer, prepare to press "Start T-series", and with your right hand on the mouse of the MASTER computer, prepare to press OK to answer "Make sure the acquisition is running". Click the Start T-series on the 2-PHOTON computer first, and then, after you see that it is running, click OK on the MASTER computer.

12. When the stimulus AND the 2-PHOTON have both finished running, click the STOP button on the Spike2 machine (the one in the toolbar next to the START button) and then click "SaveCloseRestart", and just click OK when the dialog box asks you to recluster.

CLEAN UP

    1. Make sure the Mai Tai laser emission is turned "OFF" and the Mai Tai shutter is closed (via the "2P laser" panel on the PrairieView software)

    2. Turn off any gases used (including the nitrogen that floats the table)

    3. Clean and store any objectives that were used according to their instructions. The 40XIR or 16X lens should be cleaned by gently touching the business end to lens paper and moving the paper slowly until it is dry.

    4. Make sure the Xcite fluorescent lamp is off

    5. Quit the PrairieView program

    6. Power off the acquisition computer

    7. When the computer is off, power down the 2-photon microscope at the switch on the equipment rack.

Analyzing imaging data

Here we discuss how to analyze a time series recording of raster-scanned images of cells that have been labeled with some sort of activity indicator.

Directory structure

This software assumes that the data from each experiment is stored in a directory, called the experiment directory , and that the recording epochs (sometimes called test directories) are stored in subdirectories of this experiment directory. Typically, these directories are numbered t00001, t00002, t00003, etc. Complete i nformation on the types of data that is generated by our recording software can be found here. These subdirectories all contain a reference.txt file that indicates the type of data that was recorded for each epoch, and a reference number. An example directory structure and reference.txt file for a 2-photon experiment might be:

2031-05-25/

t00001/

reference.txt:

name ref type

tp 1 prairietp

t00002/

reference.txt:

name ref type

tp 1 prairietp

This directory includes 2 recording epochs (t00001 and t00002); the reference.txt files indicate that these 2 recording epochs have the same reference number, which indicates to the program that they were recorded at the same imaging location.

Organizing principles for analysis

We have several tasks for performing the analysis. We must

  1. Create some sort of structure that indicates the relative positions of images that were recorded at different depths

  2. Deal with the fact that the images can drift or shift positions during the recording, and align recordings that were made at the same locations so that we can identify the same cells in both recordings

  3. Identify regions of interest that correspond to individual cells within the recordings

  4. Correct any errors made in our automatic procedures that align recordings across imaging sessions

Step 1, the structure:

Stacks

To do this, we have created a software framework that is built around the concept of an image stack. In our terminology, a stack is a collection of image series that were acquired at approximately the same location at the cortical surface (or at the same location within a brain slice). For example, imagine you recorded at 2 locations in opposite hemispheres of the brain, and you recorded at several depths at each location. Each depth at each location would have a unique reference number, and we would use our software (in the steps below "Performing the analysis") to identify the images that belong to the same stack.

Slices

Each stack is comprised of individual slices, which just means a time-series imaging epoch at a certain location.

An example of dividing data into Stacks and Slices

For example, one might have made the following recordings in the left hemisphere at position on the cortical surface: t00001, t00002, t00003. Further, one might have made the following recordings in the right hemisphere at some position: t00004, t00005, t00006, t000007. Suppose further that t00001 and t00002 were at the same depth (that is, they are 2 recordings of the same location), and t00005 and t00006 were made at the same depth as well. Then, logically, we can divide these into 2 stacks. We want to create a stack that we might call 'site 1' for the left hemisphere recordings, and another stack we might call 'site 2' for the right hemisphere records. Then, we would add slices t00001, t00002, and t00003 to the 'site 1' stack, and t00004, t00005, t00006, and t00007 to the 'site 2' stack. The reference numbers of t00001, t00002, t00003,t00004, t00005, t00006, and t00007 might be 1, 1, 2, 3, 4, 4, 5, respectively. Note that t00001 and t00002 have to share a reference number since they were made at the same location, and t00005 and t00006 have to do the same. Note there is no relationship between the name of a recording epoch and its reference number.

Steps 2-4: Drift correction, alignment, identifying ROIs, correcting ROI errors

We'll just look at them in the analysis

Performing the analysis

  1. Start the program

    1. Make sure your machine has Matlab installed, the vhtools installed, and has access to the data you want to analyze

    2. Run Matlab

    3. Type twophotonbulkload; a window should pop up (might look different as versions change)

  1. Open an experiment for analysis

    1. Click the "choose" button to choose a directory where your data of interest reside. Navigate to the experiment directory (e.g., e:\2photon\mydata\2031-05-21)

    2. Your experiment should show up in the right window

  2. Create a new STACK

    1. Pull down the New Stack menu and choose "New Blank Stack"

    2. Enter a name for your stack, such as Site 1

    3. Your stack name should show up in the left panel; click the "Edit" button. A new figure will pop up.

  1. Add SLICES to the STACK

    1. To add the slices, go to the "Slice command" and choose "Add new slice"; choose the directory number (like t00001) and click OK.

    1. Note: If multiple slices were recorded at the same location (that is, they have the same reference number in the reference.txt file), then those slices will be indented under the first recording at that location.

  1. Correct drift

    1. Select a slice in the slice list.

    2. Click Correct Drift. In most cases, the default options will be fine.

    3. Repeat steps 5.1, 5.2 for all slices in the stack.

          1. A common error: extra triggers present in the recording

                1. If during acquisition you failed to stop the spike 2 program before using the 2p, you may have more recorded twophotontimes than corresponding stimulus information. As a result you will not be able to correct drift. You will need to open the twophotontimes.txt file in the folder for that slice and delete any extra times. To identify extra times look at the end of the list of numbers for large jumps in time

                2. 1165.32256 1167.05656 1168.79056 1170.52456 1172.25856 1173.99256 1175.72860 1177.46262 1179.19662 1180.93060 1182.66460 1184.39860 1186.13464 1187.86864 1189.60266 1191.30604 1414.05162

                3. Delete the numbers after the large leap

  2. Draw cells

    1. Type an appropriate diameter (ex ~12 for a 40x objective, ~8 for a 16) circle that will most closely match the size of cell bodies into the Dia box.

    2. Then, hit the Draw circles until <return> button. This means that you will be able to draw cell centers until you hit the enter/return button on your keyboard. After hitting this button you must draw at least one circle before you are allowed to hit enter and use another tool.

    3. Center the cross hairs and click.

    4. Repeat step 6.3 until you've drawn all the cells you want to draw.

    5. Hit <enter> or <return> to stop drawing

  1. Check the quality of drift correction

    1. Select a cell in the cell list. Choose a bright cell.

    2. Click Check drift

    3. Zoom in on some early images and late images to check if the bright spots stay inside the circle for the whole session. If the drift correct did a bad job you may want to adjust the way that the drift correct works by modifying the defaults in the window that pops up when you hit the drift correct button.

    4. If drift correct didn’t do a great job on a majority of the cells you can manually move all the cells in a slice (does not apply to subsequent slices) by typing shiftdriftcorrect('e:\folder name\folder name\experiment number', x movement, y movement) in the Matlab command window. For example shiftdriftcorrect('e:\rebekah\2010-02-23\t00010-001',-5,0 will move the cells to the right 5 pixles in the x direction and none in the y direction. After hitting return you need to open up another slice and go back to the file you are working on to see the change.

  1. It is a good idea to hit Save occasionally to save your work.

  1. Checking the alignment across image series recorded at the same location.

      1. Circles drawn in higher slices will appear in lower slices but not vice versa. To remove a circle from a lower slice, highlight the slice number in the slice window so that that slice is displayed and then highlight the circle number in the Cell id# window. The circle will turn from blue to yellow then press the ### cell button. The cell will be deleted from the displayed slice and all subsequent slices but not previous (higher) slices. To remove the cell completely hit the delete cell button. The cell will completely disappear.

      2. To move a circle follow these steps but press the move cell button. Move cross hairs to where you want the cell moved and click. Hierarchy rules are the same. You can also add cells to lower slices and have them not appear in higher slices by highlighting the desired slice in the slice window and drawing cells there.

      3. If you move a circle in a lower slice and then move it in a higher slice the circle will not move again in the lower slice it will stay where you originally put it.

  2. Analyze the responses

    1. If the data were collected using vhtools / Fitzpatrick lab stimulus programs, then you can click Analyze By Param (to analyze with the stated parameter on the X axis) orAnalyze by Number (to analyze with the stimulus number on the X axis). If not, click Analyze Raw. The computer should compute for a few minutes and pop up the tuning curves (in the case of Analyze By Param or Analyze By Number).

  1. Add the responses to the experiment database

    1. Add slices to the data base in order to run the fitting analysis. First finish all cell drawing and checking, hit “analyze parameter” button for each slice. Dir window determines which slice you are analyzing not which file name is highlighted in the list above. Hit the “add slice to DB” button. You will be asked to identify the stimulus condition for each recording.

  1. Perform any fitting

The following is old:

To analyze ocular transfer experiement type

tpf=’e:\file name\file name’

Analyzedirtpexper3(tpf,0)

Do you want to analyze (y\n) y

This should take all night

Do you want to read cells to database (y\n) y

Do you want to plot all stacks?(y\n)

To analyze cells for direction index before and after the training and select for cells that fit the OD and DI criteria

Go to Editor

File\open

Vanhooser\Fitzlab tools\directionanalysis_ylsv\oculartransferDIanalysis3

Change experiment file name

Push run button

First window shows cumulative probability histogram of DI (for all the cells that fit the criteria) before and after training in each eye.

Last window shows direction tuning curves for each of these cells

Middle window shows B (before) or A (after) OD index, DIte (trained eye), Dine (non-trained eye)