-
-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template initialization to improve convergence #1227
Conversation
Back up templates and shape update warps, so that QC and convergence checking can be done without having to back up everything Also various fixes to documentation and error checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look like good changes. Thank you for the style fixes cleaning of eol spaces.
The temporary directory will be great for debugging.
Looks great! My only suggestion is to perhaps improve the documentation a bit to clarify how the different modes work with this new COM modification. |
@@ -837,13 +859,34 @@ for (( i = 0; i < $NUMBEROFMODALITIES; i++ )) | |||
echo "--------------------------------------------------------------------------------------" | |||
# Normalize but don't sharpen at this stage | |||
${ANTSPATH}/AverageImages $DIM ${TEMPLATES[$i]} 2 ${CURRENTIMAGESET[@]} | |||
# Quickly align COM of input images to average, and then recompute average | |||
IMAGECOMSET=() | |||
for (( j = 0; j < ${#CURRENTIMAGESET[@]}; j+=1 )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other implementation note here, I found for best performance I often had to do two rounds of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example of this? I can't see how it would help except to shift the location of the image set inside the bounding box. Which may be desirable (or not if it shifts the wrong way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After checking things over, my tests show I don't actually need two rounds, however, padding/recropping the template is important as otherwise you can get a non-centered FOV.
Compare, left no pad/recrop vs right:
https://imgur.com/a/ded9IPL
Pad/recrop code:
https://github.com/CoBrALab/optimized_antsMultivariateTemplateConstruction/blob/master/modelbuild.sh#L486-L490
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that's a good idea, but this whole PR started because a user wanted to control the size of their template image. Also, unless -y 0
is used, the template will re-center itself to minimize the average translation.
After the initial average which sets the template volume size, users can now control mean / norm mean / median. Added a summarizeimageset function to antsMultivariateTemplateConstruction.sh, which makes it easier and more consistent to update the template. Added some additional checks to both scripts to ensure that the template actually gets updated properly, using all the images it ought to have.
I'm going to merge this now. Thanks for the reviews and suggestions |
Thanks for all this work, @cookpa and others @gdevenyi @hjmjohnson. |
Fixes #1216. In addition to enforcing the use of AverageImages in population average templates, I made a few tweaks to help convergence:
After the population average + initial rigid stage, the statistic (mean, normalized mean, median) and sharpening options follow whatever the users specify on the command line.
In order to make the process more transparent to users, I added an output folder
intermediateTemplates/
, which contains each template and, if it exists, the template shape update. This will let users visually inspect their templates at every stage, and the update warps can be interrogated (eg, for magnitude or volume change) to assess convergence.Currently, the only way to retain intermediate output is to back up everything, which can take up a lot of disk space.
Additionally, I made a few fixes to documentation and error checking, including: