How to use antsApplyTransforms with fmriprep-docker

Hello experts,

I am trying to apply the transforms generated by ‘fmriprep-docker’ to new data (TEDANA denoised images).

I have used this script:

antsApplyTransforms \
    -e 3 \
    -i ${file_to_warp} \
    -r ${standard_space_file} \
    -o ${out_file} \
    -n LanczosWindowedSinc \
    -t ${xform_native_to_t1w} \
    ${xform_t1w_to_std}

BUT, I’m now having issues with the ‘*.h5’ file (T1w-to-standard) not being recognized:

HDF5-DIAG: Error detected in HDF5 (1.8.17) thread 0:
  #000: /Users/conrad/Documents/antsbin/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5D.c line 358 in itk_H5Dopen2(): not found
    major: Dataset
    minor: Object not found
  #001: /Users/conrad/Documents/antsbin/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gloc.c line 430 in itk_H5G_loc_find(): can't find object
    major: Symbol table
    minor: Object not found
  #002: /Users/conrad/Documents/antsbin/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gtraverse.c line 861 in itk_H5G_traverse(): internal path traversal failed
    major: Symbol table
    minor: Object not found
  #003: /Users/conrad/Documents/antsbin/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gtraverse.c line 641 in H5G_traverse_real(): traversal operator failed
    major: Symbol table
    minor: Callback failed
  #004: /Users/conrad/Documents/antsbin/ITKv5/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gloc.c line 385 in H5G_loc_find_cb(): object 'TranformFixedParameters' doesn't exist
    major: Symbol table
    minor: Object not found
Transform reader for /Users/conrad/Documents/000000_HBI_QA/ZZ_new_scannner_checks/20240711-23413-fMRI_DEVELOPMENT_JULY_11__WORK/RRY_fmriPrepTESTING_wFSLproperSPACE_Ser5_CPIP/derivatives/sub-ID01/anat/sub-ID01_from-T1w_to-MNI152NLin6Asym_mode-image_xfm.h5 caught an ITK exception:

itk::ExceptionObject (0x600003e60bc0)
Location: "unknown" 
File: /Users/conrad/Documents/antsbin/ITKv5/Modules/IO/TransformHDF5/include/itkHDF5TransformIO.hxx
Line: 378
Description: itk::ERROR: HDF5TransformIOTemplate(0x600003d540a0): H5Dopen2 failed

#######

I DO have an older version of ANTS on my system, which is likely confusing the matter.

Is there a way to utilize or point to the ANTS version used within fmriprep-docker so that I can apply the warps to other data?

I have seen solutions on other threads, but not sure how to apply them to ‘fmriprep-docker’ specifically.

Thanks!

Also, not sure why the formatting of my command got so weird. Apologies.

Hi @Crock,

You can use the </> button in the text editors, or add tickmarks (`), to format as code. You can see I did that for you in your first post.

Yes,

docker exec -it nipreps/fmriprep:$VERSION sh -c "$CMD"

Kind in mind, fmriprep-docker is just a wrapper around docker run.

Best,
Steven

Hi Steven,

Thanks as always!
Knowing abt this Docker command will def in the future:
docker exec -it nipreps/fmriprep:$VERSION sh -c “$CMD”

(I wasn’t sure how to “bind” things, and saw a lot of solutions using Singularity).

In the meantime, I have made some progress, and thought I’d share some thoughts.

  1. My version of ANTS was too old (2.2.0), and so I updated to (2.5.3), and the h5s are much better.

  2. THEN, once the scripts actually produced images, they were spatially offset. Eventually, I realized that the transform ordering I copied from this TEDANA page was incorrect:

https://tedana.readthedocs.io/en/stable/faq.html#warping-scanner-space-fmriprep-outputs-to-standard-space

Folks, the ordering of the transforms is incorrect in this document.
BAD: -t ${xform_native_to_t1w} \ ${xform_t1w_to_std}

SUCCESSFUL: --transform ${xform_t1w_to_std} \ ${xform_native_to_t1w}