-
Notifications
You must be signed in to change notification settings - Fork 22
Cross session cell alignment
Biafra Ahanonu edited this page Jul 23, 2021
·
4 revisions
Please use the online documentation website going forward: https://bahanonu.github.io/ciatah/
Find the main function at https://github.com/bahanonu/calciumImagingAnalysis/blob/master/classification/matchObjBtwnTrials.m
For details, see Cross-day analysis of BLA neuronal activity methods section in the associated Science paper: http://science.sciencemag.org/content/sci/suppl/2019/01/16/363.6424.276.DC1/aap8586_Corder_SM.pdf#page=10.
- Example output on several mPFC animals across multiple sessions. Color is used to indicate a global ID cell (e.g. the same cell matched across multiple days).
The below commands in MATLAB can be used to align sessions across days.
% Create input images, cell array of [x y nCells] matrices
inputImages = {day1Images,day2Images,day3Images};
% options to change
opts.maxDistance = 5; % distance in pixels between centroids for them to be grouped
opts.trialToAlign = 1; % which session to start alignment on
opts.nCorrections = 1; %number of rounds to register session cell maps.
opts.RegisTypeFinal = 2 % 3 = rotation/translation and iso scaling; 2 = rotation/translation, no iso scaling
% Run alignment code
[alignmentStruct] = matchObjBtwnTrials(inputImages,'options',opts);
% Global IDs is a matrix of [globalID sessionID]
% Each (globalID, sessionID) pair gives the within session ID for that particular global ID
globalIDs = alignmentStruct.globalIDs;
% View the cross-session matched cells, saved to `private\_tmpFiles` sub-folder.
[success] = createMatchObjBtwnTrialsMaps(inputImages,alignmentStruct);
In certain cases, you want to run analysis on the registered images, see below.
% Get registered images, cell array of [x y nCells] matrices
registeredImagesCell = alignmentStruct.inputImages;
% Get registered cell maps, cell array of [x y] matrices
registeredCellmaps = alignmentStruct.objectMapTurboreg;
% OR another method below.
% Get the registration coordinates
globalRegCoords = alignmentStruct.registrationCoords;
globalRegCoords = globalRegCoords{folderNo};
% Re-register input images for particular imaging session for later analysis.
for iterationNo = 1:length(globalRegCoords)
fn=fieldnames(globalRegCoords{iterationNo});
for i=1:length(fn)
localCoords = globalRegCoords{iterationNo}.(fn{i});
[inputImages, localCoords] = turboregMovie(inputImages,'precomputedRegistrationCooords',localCoords);
end
end
- Original dorsal striatum cell maps from ICA with no motion correction applied.
-
calciumImagingAnalysis
(Biafra's) registration algorithm- Color is used to indicate a global ID cell (e.g. the same cell matched across multiple days). Thus, same color cell = same cell across sessions under the quick iteration parameters used in the below run.
-
CellReg
registration algorithm Using older code at https://github.com/zivlab/CellReg.