ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.21k stars 381 forks source link

Can't open the last modality with antsMultivariateTemplateConstruction2.sh #1746

Closed Ludwig-T closed 6 months ago

Ludwig-T commented 6 months ago

Operating system and version

Ubuntu 22.04.3 LTS

CPU architecture

x86_64 (PC, Intel Mac, other Intel/AMD)

ANTs code version

v2.3.5.post101-g1c5ae7c

ANTs installation type

Other (please specify below)

Summary of the problem

I am constructing a template with antsMultivariateTemplateConstruction2.sh using three modalities. It can't open the last (third) modality. I have tried swaping the order of the modalities and using the first modality as the third modality as well. I have tried refering to the files with relative and absolute path. Therefore I don't think it is a problem with the files. As the log correctly outputs the file paths I do not think there is a problem with the input .csv file

Ants is install from:

https://github.com/cookpa/antsInstallExample

Commands to reproduce the problem.

antsMultivariateTemplateConstruction2.sh -d 3 -w 1x1x1 -k 3 -i 5 -g 0.2 -j 8 -c 2 -f 6x4x2x1 -s 3x2x1x0 -q 501x251x151x76 -n 0 -r 1 -l 1 -m MI -t BSplineSyN -y 1 -v 8gb -p /root/dir/templates/templateception/ver-0/ver-0/ -o /root/dir/templates/templateception/ver-0/ver-0 /root/dir/templates/templateception/template_paths.csv

Output of the command with verbose output.


Multivariate template construction using the following 3-tuples:

templates/final_templates/ver-3/age-15/age-15_ver-3_template_aseg.nii.gz templates/final_templates/ver-3/age-15/age-15_ver-3_template1.nii.gz templates/final_templates/ver-3/age-15/age-15_ver-3_template0.nii.gz templates/final_templates/ver-3/age-16/age-16_ver-3_template_aseg.nii.gz templates/final_templates/ver-3/age-16/age-16_ver-3_template1.nii.gz templates/final_templates/ver-3/age-16/age-16_ver-3_template0.nii.gz templates/final_templates/ver-3/age-17/age-17_ver-3_template_aseg.nii.gz templates/final_templates/ver-3/age-17/age-17_ver-3_template1.nii.gz templates/final_templates/ver-3/age-17/age-17_ver-3_template0.nii.gz


Creating template /root/dir/templates/templateception/ver-0/ver-0_template0.nii.gz from a population average image from the inputs. templates/final_templates/ver-3/age-15/age-15_ver-3_template_aseg.nii.gz templates/final_templates/ver-3/age-16/age-16_ver-3_template_aseg.nii.gz templates/final_templates/ver-3/age-17/age-17_ver-3_template_aseg.nii.gz

bigimage 4 maxSize [140, 140, 92] Setting physical space of output average image based on largest image Averaging 3 images with dim = 3 vector components 1 reading templates/final_templates/ver-3/age-15/age-15_ver-3_template_aseg.nii.gz reading templates/final_templates/ver-3/age-16/age-16_ver-3_template_aseg.nii.gz reading templates/final_templates/ver-3/age-17/age-17_ver-3_template_aseg.nii.gz writing output Sharpening method none Using double precision for computations. Input scalar image: templates/final_templates/ver-3/age-15/age-15_ver-3_template_aseg.nii.gz Reference image: /root/dir/templates/templateception/ver-0/ver-0_template0.nii.gz

The composite transform comprises the following transforms (in order):

  1. /root/dir/templates/templateception/ver-0/initialCOM0_0_age-15_ver-3_template_aseg.mat (type = TranslationTransform)

    Default pixel value: 0 Interpolation type: LinearInterpolateImageFunction Output warped image: /root/dir/templates/templateception/ver-0/initialCOM0_0_age-15_ver-3_template_aseg.nii.gz Using double precision for computations. Input scalar image: templates/final_templates/ver-3/age-16/age-16_ver-3_template_aseg.nii.gz Reference image: /root/dir/templates/templateception/ver-0/ver-0_template0.nii.gz

    The composite transform comprises the following transforms (in order):

  2. /root/dir/templates/templateception/ver-0/initialCOM0_1_age-16_ver-3_template_aseg.mat (type = TranslationTransform)

    Default pixel value: 0 Interpolation type: LinearInterpolateImageFunction Output warped image: /root/dir/templates/templateception/ver-0/initialCOM0_1_age-16_ver-3_template_aseg.nii.gz Using double precision for computations. Input scalar image: templates/final_templates/ver-3/age-17/age-17_ver-3_template_aseg.nii.gz Reference image: /root/dir/templates/templateception/ver-0/ver-0_template0.nii.gz

    The composite transform comprises the following transforms (in order):

  3. /root/dir/templates/templateception/ver-0/initialCOM0_2_age-17_ver-3_template_aseg.mat (type = TranslationTransform)

    Default pixel value: 0 Interpolation type: LinearInterpolateImageFunction Output warped image: /root/dir/templates/templateception/ver-0/initialCOM0_2_age-17_ver-3_template_aseg.nii.gz bigimage 4 maxSize [140, 140, 92] Setting physical space of output average image based on largest image Averaging 3 images with dim = 3 vector components 1 reading /root/dir/templates/templateception/ver-0/initialCOM0_0_age-15_ver-3_template_aseg.nii.gz reading /root/dir/templates/templateception/ver-0/initialCOM0_1_age-16_ver-3_template_aseg.nii.gz reading /root/dir/templates/templateception/ver-0/initialCOM0_2_age-17_ver-3_template_aseg.nii.gz writing output Sharpening method none


Creating template /root/dir/templates/templateception/ver-0/ver-0_template1.nii.gz from a population average image from the inputs. templates/final_templates/ver-3/age-15/age-15_ver-3_template1.nii.gz templates/final_templates/ver-3/age-16/age-16_ver-3_template1.nii.gz templates/final_templates/ver-3/age-17/age-17_ver-3_template1.nii.gz

bigimage 4 maxSize [140, 140, 92] Setting physical space of output average image based on largest image Averaging 3 images with dim = 3 vector components 1 reading templates/final_templates/ver-3/age-15/age-15_ver-3_template1.nii.gz reading templates/final_templates/ver-3/age-16/age-16_ver-3_template1.nii.gz reading templates/final_templates/ver-3/age-17/age-17_ver-3_template1.nii.gz writing output Sharpening method none Using double precision for computations. Input scalar image: templates/final_templates/ver-3/age-15/age-15_ver-3_template1.nii.gz Reference image: /root/dir/templates/templateception/ver-0/ver-0_template1.nii.gz

The composite transform comprises the following transforms (in order):

  1. /root/dir/templates/templateception/ver-0/initialCOM1_0_age-15_ver-3_template1.mat (type = TranslationTransform)

    Default pixel value: 0 Interpolation type: LinearInterpolateImageFunction Output warped image: /root/dir/templates/templateception/ver-0/initialCOM1_0_age-15_ver-3_template1.nii.gz Using double precision for computations. Input scalar image: templates/final_templates/ver-3/age-16/age-16_ver-3_template1.nii.gz Reference image: /root/dir/templates/templateception/ver-0/ver-0_template1.nii.gz

    The composite transform comprises the following transforms (in order):

  2. /root/dir/templates/templateception/ver-0/initialCOM1_1_age-16_ver-3_template1.mat (type = TranslationTransform)

    Default pixel value: 0 Interpolation type: LinearInterpolateImageFunction Output warped image: /root/dir/templates/templateception/ver-0/initialCOM1_1_age-16_ver-3_template1.nii.gz Using double precision for computations. Input scalar image: templates/final_templates/ver-3/age-17/age-17_ver-3_template1.nii.gz Reference image: /root/dir/templates/templateception/ver-0/ver-0_template1.nii.gz

    The composite transform comprises the following transforms (in order):

  3. /root/dir/templates/templateception/ver-0/initialCOM1_2_age-17_ver-3_template1.mat (type = TranslationTransform)

    Default pixel value: 0 Interpolation type: LinearInterpolateImageFunction Output warped image: /root/dir/templates/templateception/ver-0/initialCOM1_2_age-17_ver-3_template1.nii.gz bigimage 4 maxSize [140, 140, 92] Setting physical space of output average image based on largest image Averaging 3 images with dim = 3 vector components 1 reading /root/dir/templates/templateception/ver-0/initialCOM1_0_age-15_ver-3_template1.nii.gz reading /root/dir/templates/templateception/ver-0/initialCOM1_1_age-16_ver-3_template1.nii.gz reading /root/dir/templates/templateception/ver-0/initialCOM1_2_age-17_ver-3_template1.nii.gz writing output Sharpening method none


Creating template /root/dir/templates/templateception/ver-0/ver-0_template2.nii.gz from a population average image from the inputs. templates/final_templates/ver-3/age-15/age-15_ver-3_template0.nii.gz templates/final_templates/ver-3/age-16/age-16_ver-3_template0.nii.gz templates/final_templates/ver-3/age-17/age-17_ver-3_template0.nii.gz

Cannot read input file: templates/final_templates/ver-3/age-15/age-15_ver-3_template0.nii.gz summarizeimageset: ERROR - output file /root/dir/templates/templateception/ver-0/ver-0template2.nii.gz could not be created antsMultivariateTemplateConstruction2.sh -d 3 -w 1x1x1 -k 3 -i 5 -g 0.2 -j 8 -c 2 -f 6x4x2x1 -s 3x2x1x0 -q 501x251x151x76 -n 0 -r 1 -l 1 -m MI -t BSplineSyN -y 1 -v 8gb -p /root/dir/templates/templateception/ver-0/ver-0/ -o /root/dir/templates/templateception/ver-0/ver-0_ /root/dir/templates/templateception/template_paths.csv

Data to reproduce the problem

I cannot share the data.

cookpa commented 6 months ago

Probably the same issue as #1745. I'm investigating

cookpa commented 6 months ago

Can you try

cat -A template_paths.csv

If you see ^M then the problem is the carriage return. Fix with

perl -i -pe 's/\r//g' template_paths.csv

Ludwig-T commented 6 months ago

This appears to have fixed it. Thanks for the quick replies!