FSL warp to ANTs (nii.gz to .h5)

Dear all,

I have some transformations calculated using a combination of FSL and ANTs. They have been merged into one final warp interpretable to FSL (using wb_command -convert-warpfield). This transformation contains some warps and affine transformations. I would like to convert it to itk (ants interpretable), .h5 to be more precise. Is there any possibility to do this? Thanks in advance.

Best regards,

Manuel

Hi,

c3d may be your friend there. I never tried myself for warps, I know it works well for affine transforms.

This discussion may be of interest for you:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=fsl;c21935f9.1901

Let us know if you find a solution that works for you! Thanks!

Julien

Hi Manuel,

I am having the same issue here. I am trying to convert a warpfield generated by FNIRT to a ANTs readable format (as you suggested, .h5 file could be a way to go), but using wb_command -convert-warpfield -from-fnirt {input} {source} -to-itk {output} generates a .nii.gz file, which ANTs is not able to recognise.

In my case I am using the antsApplyTransforms command, where I would like to include the file I am trying to convert as a --transform file to perform a registration. The following exception is raised:

Transform reader for {path_to_file}/non-linear_warp-coeffs_postt1w_to_pret1w_ants_format.nii.gz caught an ITK exception:

itk::ExceptionObject (0x5f0bab1ac440)
Location: "unknown" 
File: /home/runner/work/_temp/build/ITKv5/Modules/IO/TransformBase/src/itkTransformFileReader.cxx
Line: 128
Description: ITK ERROR: TransformFileReaderTemplate(0x5f0bab1c5790): Could not create Transform IO object for reading file {path_to_file}/non-linear_warp-coeffs_postt1w_to_pret1w_ants_format.nii.gz
  Tried to create one of the following:
    HDF5TransformIOTemplate
    HDF5TransformIOTemplate
    MINCTransformIOTemplate
    MINCTransformIOTemplate
    MatlabTransformIOTemplate
    MatlabTransformIOTemplate
    TxtTransformIOTemplate
    TxtTransformIOTemplate
  You probably failed to set a file suffix, or
    set the suffix to an unsupported type.

I have found that the c3d_affine_tool is useful in certain cases similar to this one, but as these warpfields refer to non-linear transformations, affine matrices are not the way to go here.

I am not able to use ConvertTransformFile either, as there is no way that ANTs understands this .nii.gz file that the Connectome Workbench is giving me as an output. I am reviving this topic as it was very difficult for me to find another ongoing thread here or elsewhere dealing with this same issue. I hope you can remember/recollect any useful information/scripts that you were using at that time and give me a hand :). Thank you in advance,

Doneka