BioMedIA / MIRTK

The Medical Image Registration ToolKit (MIRTK), the successor of the IRTK, contains common CMake build configuration files, core libraries, and basic command-line tools. Extension packages are hosted by the MIRTK GitHub group at
https://github.com/MIRTK
Apache License 2.0
186 stars 71 forks source link

Help convert-dof, register -> ANTs #784

Closed chrisadamsonmcri closed 2 years ago

chrisadamsonmcri commented 2 years ago

I would like help converting a dof file produced by register for use in ANTs.

I apply the following command:

register ${OUTPUTPREFIX}_t2w_restore_brain.nii.gz $DRAWEMDIR/atlases/non-rigid-v2/T2/template-40.nii.gz -dofout ${OUTPUTPREFIX}_template_dof.gz -parin $DRAWEMDIR/parameters/ireg.cfg -threads $OMP_NUM_THREADS -v 0

I assume this gives the transformation from $DRAWEMDIR/atlases/non-rigid-v2/T2/template-40.nii.gz to ${OUTPUTPREFIX}_t2w_restore_brain.nii.gz

Because I then use

transform-image $DRAWEMDIR/atlases/non-rigid-v2/atlas-9/structure$strnum/40.nii.gz $strems -dofin ${OUTPUTPREFIX}_template_dof.gz -target ${OUTPUTPREFIX}_t2w_restore_brain.nii.gz -interp Linear

To register each of the tissue type probability maps to the native image.

My question is how do I convert the dof transform to ANTs format? Specifically, to get the forward and inverse non-linear warps and the affine portion in ITK format? I can't find any examples of how to do this with convert-dof.

Thanks so much in advance.

chrisadamsonmcri commented 2 years ago

I figured it out. Just putting it here incase someone wants it. I use wb_command to convert the world displacement to ITK format.

convert-dof template_dof.gz testWarp.nii.gz -source ~/dev/MCRIBS/MIRTK/MIRTK/Packages/DrawEM/atlases/non-rigid-v2/T2/template-40.nii.gz
wb_command -convert-warpfield -from-world testWarp.nii.gz -to-itk testWarpITK.nii.gz

Then testWarpITK.nii.gz warps ~/dev/MCRIBS/MIRTK/MIRTK/Packages/DrawEM/atlases/non-rigid-v2/T2/template-40.nii.gz to my native image correctly under ANTs.