Skip to content

antsApplyTransforms not able to read transform txt #1681

@butellyn

Description

@butellyn

Describe the problem

I am trying to use antsApplyTransforms to move a functional image in fmriprep's T1w space into fsnative (freesurfer's T1w space), but the output is not being created. With the "verbose" option turned on, I got a message that the transform file cannot be read. The file was created using fMRIPrep v23.1.4. I am thinking maybe the version of ANTs on my cluster (which seems to be from 2020) may be too old to be compatible with the outputs from fMRIPrep. Does that seem likely to be the case? If not, what might the issue be?

To Reproduce

I ran this command (which took ~30 seconds):

antsApplyTransforms -d 4 -v 1 \
    -i /projects/b1108/studies/mwmh/data/processed/neuroimaging/fmriprep_23.1.4/sub-MWMH212/ses-2/func/sub-MWMH212_ses-2_task-rest_space-T1w_desc-preproc_bold.nii.gz \
    -r /projects/b1108/studies/mwmh/data/processed/neuroimaging/surf/sub-MWMH212/ses-2/anat/fs_T1w.nii.gz \
    -t /projects/b1108/studies/mwmh/data/processed/neuroimaging/fmriprep_23.1.4/sub-MWMH212/ses-2/anat/sub-MWMH212_ses-2_from-T1w_to-fsnative_mode-image_xfm.txt \
    -o /projects/b1108/studies/mwmh/data/processed/neuroimaging/surf/sub-MWMH212/ses-2/func/sub-MWMH212_ses-2_task-rest_space-fsnative_desc-preproc_bold.nii.gz

It returned no output:
Screenshot 2024-02-22 at 3 49 19 PM

And said that it could not read the initial transform:
Screenshot 2024-02-22 at 3 59 20 PM

But the file exists, and is output from fMRIPrep v23.1.4:
Screenshot 2024-02-22 at 4 00 11 PM

Do you know what might cause ANTs to not be able to read in the transformation file? Is it possible that the ANTs version installed on my cluster is too old?

System information (please complete the following information)

  • OS: NAME="Red Hat Enterprise Linux Server"
    VERSION="7.9 (Maipo)"
    ID="rhel"
    ID_LIKE="fedora"
    VARIANT="Server"
    VARIANT_ID="server"
    VERSION_ID="7.9"
    PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
    HOME_URL="https://www.redhat.com/"
    BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"

  • Type of system: HPC cluster
  • CPU architecture: unsure

ANTs version information

  • ANTs code version: ANTs Version: 0.0.0.0 Compiled: Oct 6 2020 04:58:02
  • ANTs installation type: Unsure. Installed by admins

Additional information

Here are details on each of the files:

sub-MWMH212_ses-2_task-rest_space-T1w_desc-preproc_bold.nii.gz:

Spacing [2, 2, 2, 0.555]
Origin [65.6448, 63.687, -59.6174, 0]
Direction
-1 0 0 0
0 -1 0 0
0 0 1 0
0 0 0 1

Size : [69, 90, 69, 1110]

Image Dimensions : [69, 90, 69, 1110]
Bounding Box : {[65.6448 63.687 -59.6174 0], [203.645 243.687 78.3826 616.05]}
Voxel Spacing : [2, 2, 2, 0.555]
Intensity Range : [0, 31125.8]
Mean Intensity : 3874.74
Direction Cos Mtx. :
-1 0 0 0
0 -1 0 0
0 0 1 0
0 0 0 1

Voxel->RAS x-form :
Image Metadata:
ITK_FileNotes = xform matrices modified by FixHeaderApplyTransforms (niworkflows v1.8.1).
ITK_original_direction of unsupported type N3itk6MatrixIdLj4ELj4EEE
ITK_original_spacing of unsupported type St6vectorIdSaIdEE
bitpix = 32
cal_max = 31125.8
cal_min = 0
datatype = 16
descrip = xform matrices modified by FixHeaderApplyTransforms (niworkflows v1.8.1).
dim[0] = 4
dim[1] = 69
dim[2] = 90
dim[3] = 69
dim[4] = 1110
dim[5] = 1
dim[6] = 1
dim[7] = 1
dim_info = 0
intent_code = 0
intent_p1 = 0
intent_p2 = 0
intent_p3 = 0
nifti_type = 1
pixdim[0] = 0
pixdim[1] = 2
pixdim[2] = 2
pixdim[3] = 2
pixdim[4] = 0.555
pixdim[5] = 1
pixdim[6] = 1
pixdim[7] = 1
qform_code = 2
qform_code_name = NIFTI_XFORM_ALIGNED_ANAT
qoffset_x = -65.6448
qoffset_y = -63.687
qoffset_z = -59.6174
quatern_b = 0
quatern_c = 0
quatern_d = 0
scl_inter = 0
scl_slope = 1
sform_code = 2
sform_code_name = NIFTI_XFORM_ALIGNED_ANAT
slice_code = 0
slice_duration = 0
slice_end = 0
slice_start = 0
srow_x = 2 0 0 -65.6448
srow_y = 0 2 0 -63.687
srow_z = 0 0 2 -59.6174
toffset = 0
vox_offset = 352
xyzt_units = 10

fs_T1w.nii.gz (the freesurfer T1w image converted to nifti format):
Spacing [0.8, 0.8, 0.8]
Origin [-132.592, 92.2279, 114.454]
Direction
1 -1.16415e-09 5.82077e-10
5.82077e-10 -0 -1
0 -1 0

Size : 320 320 320

Image Dimensions : [320, 320, 320]
Bounding Box : {[-132.592 92.2279 114.454], [123.408 348.228 370.454]}
Voxel Spacing : [0.8, 0.8, 0.8]
Intensity Range : [0, 182]
Mean Intensity : 11.0504
Direction Cos Mtx. :
1 -1.16415e-09 5.82077e-10
5.82077e-10 -0 -1
0 -1 0

Voxel->RAS x-form :
Image Metadata:
ITK_FileNotes = FreeSurfer Aug 4 2022
ITK_original_direction of unsupported type N3itk6MatrixIdLj3ELj3EEE
ITK_original_spacing of unsupported type St6vectorIdSaIdEE
bitpix = 8
cal_max = 0
cal_min = 0
datatype = 2
descrip = FreeSurfer Aug 4 2022
dim[0] = 3
dim[1] = 320
dim[2] = 320
dim[3] = 320
dim[4] = 1
dim[5] = 1
dim[6] = 1
dim[7] = 1
dim_info = 0
intent_code = 0
intent_p1 = 0
intent_p2 = 0
intent_p3 = 0
nifti_type = 1
pixdim[0] = 0
pixdim[1] = 0.8
pixdim[2] = 0.8
pixdim[3] = 0.8
pixdim[4] = 0
pixdim[5] = 1
pixdim[6] = 1
pixdim[7] = 1
qform_code = 1
qform_code_name = NIFTI_XFORM_SCANNER_ANAT
qoffset_x = 132.592
qoffset_y = -92.2279
qoffset_z = 114.454
quatern_b = 2.05795e-10
quatern_c = 0.707107
quatern_d = -0.707107
scl_inter = 0
scl_slope = 0
sform_code = 1
sform_code_name = NIFTI_XFORM_SCANNER_ANAT
slice_code = 0
slice_duration = 0
slice_end = 0
slice_start = 0
srow_x = -0.8 9.31323e-10 -4.65661e-10 132.592
srow_y = -4.65661e-10 0 0.8 -92.2279
srow_z = 0 -0.8 0 114.454
toffset = 0
vox_offset = 352
xyzt_units = 10

sub-MWMH212_ses-2_from-T1w_to-fsnative_mode-image_xfm.txt:
#Insight Transform File V1.0
#Transform 0
Transform: AffineTransform_float_3_3
Parameters: 1 -0.000130966 -0.000102833 0.000130979 1 0.000149429 0.000102816 -0.000149459 1 -0.000366211 0.0224457 -0.0718994
FixedParameters: 0 0 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions