catalystneuro / leifer_lab_to_nwb

Conversion scripts for the Leifer lab. Includes the publication Neural signal propagation atlas of Caenorhabditis elegans (Nature, 2023).
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Understanding objective registration #9

Closed CodyCBakerPhD closed 4 days ago

CodyCBakerPhD commented 3 months ago

I will need some help understanding the objective registration. The files such as objectivesRegistrationRaw-1.txt look to have valuable information mapping the optogenetic targeting space onto the imaging space, but not clear how this corresponds to the code https://github.com/leiferlab/wormdatamodel/blob/2ab956199e3931de41a190d2b9985e961df3810c/wormdatamodel/data/redtogreen.py#L16 or why there are several different files like this

emosb commented 2 months ago

The objectives registration does map the optogenetic targeting space onto the imaging space - and this is what should be contained in the objectivesRegistrationRawZ.txt and objectivesRegistrationRaw-#.txt files.

To do calibration, we mount a fluorescent slide so we get a single fluorescent point from the optogenetic laser. For z registration, the electrically tunable lens (ETL) holding the optogenetic laser at a certain plane in z is held fixed, and the ETL controlling the imaging plane scans through z. After the scan, the opto ETL is held at a new point, and the imaging ETL does another scan. I will check on the units in the RawZ.txt file (they may be voltages or "depths" according to the units from the ETL corresponding software). For xy calibration, both ETLs are held fixed, and the galvos are used to move the point through a 2d grid. Each Raw-#.txt file is generated at a given xy position along this grid.

The code you referenced is using a different calibration step, the redgreen registration. The red and green channels are separate images which project onto different parts of the recording camera. They need to be aligned in the preprocessing step so that each neuron's red and green image are overlaid properly. The fluorescent slide fluoresceses in both the red and green channels, so by moving the point again in the same 2d grid as from the previous calibration step, you can align the planes from the red and green channels by matching the positions of the center of the fluorescent point. There are 4 redGreenRegistration__.txt files that are copied from the redgreen%y%m%d###### folder into the pumpprobe folder as the first step before running any preprocessing code, and it is these files that redToGreen.py is loading in. The four files are: redGreenRegistrationGmmregCtrl.txt redGreenRegistrationGmmregNormDenormParam.txt redGreenRegistrationGmmregParam.txt redGreenRegistrationRaw.txt

emosb commented 2 months ago

Regarding units, I have confirmed the values stored in objectivesRegistrationRawZ.txt for the ETLs are in dioptres (dpt)