PennLINC / qsiprep

Preprocessing of diffusion MRI
http://qsiprep.readthedocs.io
BSD 3-Clause "New" or "Revised" License
140 stars 58 forks source link

Error when using MNI-T1w normalisation transform #128

Closed rob-mccutcheon closed 4 years ago

rob-mccutcheon commented 4 years ago

I wish to construct a voxel-to-voxel connectome in MNI space and so need to normalise the native space tractogram produced by qsiprep.

I’ve been following the advice here:

However when I try and apply the MNI to T1 transform generated by qsiprep:

antsApplyTransforms \
     -d 3 -i $nowarp0 \
     -r $t1 \
     -t sub-505_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5 \
     -o $warp0.nii -v

I receive the following error:


Using double precision for computations.
Input scalar image: atlases/MNI152_T1_2mm.nii.gz
Reference image: results/dwi/processed/qsiprep/sub-505/ses-A/dwi/sub-505_ses-A_acq-normal_space-T1w_desc-preproc_dwi.nii.gz
HDF5-DIAG: Error detected in HDF5 (1.8.17) thread 0:
  #000: /software/system/ANTS/src/build/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5D.c line 358 in H5Dopen2(): not found
    major: Dataset
    minor: Object not found
  #001: /software/system/ANTS/src/build/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gloc.c line 430 in H5G_loc_find(): can't find object
    major: Symbol table
    minor: Object not found
  #002: /software/system/ANTS/src/build/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gtraverse.c line 861 in H5G_traverse(): internal path traversal failed
    major: Symbol table
    minor: Object not found
  #003: /software/system/ANTS/src/build/ITKv4/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Gtraverse.c line 641 in H5G_traverse_real(): traversal operator failed
    major: Symbol table
    minor: Callback failed
  #004: /software/system/ANTS/src/build/ITKv4/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 results/dwi/processed/qsiprep/sub-505/anat/sub-505_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5 caught an ITK exception:

itk::ExceptionObject (0x2ec58d0)
Location: "unknown" 
File: /software/system/ANTS/src/build/ITKv4/Modules/IO/TransformHDF5/include/itkHDF5TransformIO.hxx
Line: 356
Description: itk::ERROR: HDF5TransformIOTemplate(0x2d38a30): H5Dopen2 failed

Can't read initial transform results/dwi/processed/qsiprep/sub-505/anat/sub-505_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5

I think this may be specific to the qsiprep transform as it works fine if I use the equivalent fmriprep transform instead

Any advice to what the issue may be is appreciated?

Thanks,

Rob

mattcieslak commented 4 years ago

This looks like an ANTs version issue. QSIPrep uses a much newer version of ANTs than fmriprep. Could you try using the antsApplyTransforms that ships with the docker image?

Also, I strongly recommend against directly transforming the dwi outputs from QSIPrep. It is much better to reconstruct ODFs or FODs and use those for spatial normalization. You can try some of the reconstruction workflows and then either use mrregister or QSDR in DSI Studio to spatially normalize your reconstructions to MNI.

rob-mccutcheon commented 4 years ago

Thanks - using the singularity ANTs does work! I was planning to normalise the tractogram from the 'mrtrix_singleshell_ss3t' recon workflow as described here: https://community.mrtrix.org/t/warping-tck-files-using-ants-warps/162/2 Which sounds as though it is in keeping with what you suggest?

mattcieslak commented 4 years ago

The main downside is that the bundles themselves won't be well-registered to one another because white FOD's weren't used in the registration.

rob-mccutcheon commented 4 years ago

Thanks Matt, if i'm only interested in the start and endpoints of the bundles i.e. the connectivity matrix I guess that's not a big problem (i'm closing the issue but please do correct me if I've misunderstood)

mattcieslak commented 4 years ago

If you're only interested in the start and endpoints then why not estimate connectivity in native space? Normalized streamlines vs native space (space-T1w in QSIPrep outputs) connectivity estimation produces very similar results and you won't have any normalization-related error if you do the latter.

rob-mccutcheon commented 4 years ago

It's because i'm wanting to look at connections from cortical nodes (desikan-killiany) to individual striatal voxels so for the striatal voxels to be comparable across subjects I think I need to be in e.g. MNI space

mattcieslak commented 4 years ago

You should have an inverse warp in your qsiprep output directory that can bring your striatal voxel labels into subject space. You can use antsApplyTransforms --interpolation GenericLabel with the inverse warp