Closed kevinyamauchi closed 4 years ago
@kevinyamauchi, thanks for reaching out! Hope the package is working well for you-all.
Regarding your questions, I assume you are referring to the _turboregTranslationOutput.mat
file in the processing_info
sub-folder?
ResultsOutOriginal
indices are ResultsOutOriginal{iterationNo}{thisSet}
with iterationNo
indicating which motion correction iteration of modelPreprocessMovieFunction
and thisSet
indicating which subset of the frames was analyzed (for memory reasons). This depends on user input, but defaults to a max size of 5,000 in modelPreprocessMovieFunction
.ResultsOutOriginal{1}{1}{end}.Translation
from modelPreprocessMovieFunction
(or if you run turboregMovie
with refFrameMatrix
name-value input argument) should give you [0 0]
.Thank you for the quick reply, @bahanonu ! This is super helpful.
Regarding your questions, I assume you are referring to the _turboregTranslationOutput.mat file in the processing_info sub-folder?
Yes, I am referring to the the output in the processing_info
subfolder.
The translation values on each iteration are relative to the previous iteration. Thus, to re-create the absolute transformation you would need to run registration iteratively or sum the translation coordinates assuming no scale/shear (see https://www.mathworks.com/help/images/matrix-representation-of-geometric-transformations.html) was applied at any steps.
Just to make sure I understand, my understanding is that to calculate the total transformation that was performed during registration, we should create the transformation matrices for each iteration step and multiply them all together. Is that correct?
Thank you again for all of the help and for making your analysis open source. It has been super useful so far!
@kevinyamauchi Great to hear!
Yep, two ways to get final transformation:
modelPreprocessMovieFunction
) orResultsOutOriginal
and combine for all iterations as totalTranformMatrix = (R2'*S2'*T2'*R1'*S1'*T1')'
. Note the order matters.
1, 2, ...
indicate matrix for iterations 1,2,...
and R, S, T
are rotation, skew (shear + scale) and translation matrices, respectively. (R3'*S3'*T3'*R2'*S2'*T2'*R1'*S1'*T1')'
or alternatively T1*S1*R1*T3*S3*R2*T3*S3*R3
. Thank you for the thorough explanation. I hope you have a great rest of your weekend!
Hello @bahanonu ! First off, thank you for creating the calciumImagingAnalysis MATLAB package. We are using your software to process some miniscope calcium imaging data. We are trying to interpret some of the output of the registration step (turboreg) and have a few questions. Thank you for the help!
ResultsOutOriginal
variable (output from the turboreg registration step) correspond to?ResultsOutOriginal{1}{1}
) has N+1 elements for N video frames. From the log file, it looks like the reference frame may be included. If so, which index is it?ResultsOutOriginal
the absolute translation applied to the frame or is it relative to the previous iteration (i.e., to get the total translation, we would have to sum all of the translations across iterations)?