ANTs icon indicating copy to clipboard operation
ANTs copied to clipboard

Missing warp files when using antsMultivariateTemplateConstruction2.sh with two modalities (T1 and T2 images)

Open hgellersen opened this issue 3 years ago • 4 comments

Hi everyone, I've run into some trouble using antsMultivariateTemplateConstruction2.sh. To run the template building process I have used the command: antsMultivariateTemplateConstruction2.sh -d 3 -r 1 -k 2 -b 1 -c 2 -j 3 -o tmpl ids_tmplt.csv, where the inputs are listed in a csv file in this format: sub1_T1w.nii.gz,sub1_T2w.nii.gz sub2_T1w.nii.gz,sub2_T2w.nii.gz

This produced very nice templates for both T1 and T2-weighted images. However, in the output directory, I now only find warp files for each subject for the T1 but not the T2 images. Also, when looking at the WarpedToTemplate images for each participant, the template and the individual participant's images do not seem to align properly (as shown by the crosshairs in ITKsnap not being placed in the same position when viewing both images side by side). The log files look fine to me. The only note I get is "Your input image contains nonpositive values" with the original intensity range being [0, 664]. Does anyone know what is going on here and how I could fix it? Any help would be greatly appreciated!

hgellersen avatar Aug 13 '22 18:08 hgellersen

It is assumed that, prior to template building, the multi-modal images for each subject are already aligned. Therefore, you would only have one set of transform files per subject.

ntustison avatar Aug 13 '22 18:08 ntustison

Thank you for your quick reply. That sounds sensible. I forgot to mention that my T2 images only have partial coverage of the medial temporal lobe and have much higher resolution (0.5x0.5x1.5mm), whereas the T1 images are whole-brain and are 1 mm isotropic. In that case, is it also still appropriate to use the warp files for the T1 template to coregister each individual's T2 image to the T2 template?

hgellersen avatar Aug 13 '22 18:08 hgellersen

Perhaps you're misunderstanding what I originally wrote but the requirement of intra-subject image alignment prior to template building will mean that the T1 and T2 images reside in the same image space (i.e., they will have the same spacing, direction, etc.).

ntustison avatar Aug 13 '22 18:08 ntustison

Inside a multivariate template call, antsRegistration is called once for each pair of images, and evaluates both metrics simultaneously. Because of this combined operation, there is only one warp generated. It is assumed that each pair of moving images (eg, T1w and T2w) are in the same physical and voxel space. The program might be tolerant to some violations of this if the images are in the same physical space, but results will be suboptimal because the images are treated the same way in regard to the template dimensions, smoothing, downsampling, etc.

The warning about nonpositive values is from N4BiasFieldCorrection. Because that program operates in the log domain, it can only handle positive values. You can avoid this warning by shifting the intensities by some small amount, or by bias correcting offline with a mask image that excludes background and other nonpositive voxels. If you bias correct before template building, run with -n 0 to avoid duplicating this step.

cookpa avatar Aug 16 '22 21:08 cookpa

Brilliant, thanks so much for the advice!

hgellersen avatar Aug 19 '22 12:08 hgellersen