ANTsPy icon indicating copy to clipboard operation
ANTsPy copied to clipboard

Reorientation of diffusion MRI ODFs

Open abibalimi opened this issue 6 years ago • 7 comments

Registration of diffusion HARDI ODFs Registration of fiber orientation distribution functions (ODF) maps, using some rotation invariant features of the ODFs represented on a spherical harmonics basis.

Solution In the literature, it is well known that, unlike scalar images, deforming ODF maps requires ODF reorientation to maintain its consistency with the local fiber orientations. This is done in some cases by applying the rotation matrix of the Jacobian of the transform directly to the SH coefficients to preserve its shape, at every iteration.

Alternative solution Reorientation can also be done after the final iteration of the registration but better results are obtained when done at every iteration.

Questions I recently started using ANTsPy and played with "antsRegistration". I would like to ask if antsRegistration's output files 'fwdtransforms' and 'invtransforms' contain the transformations/inv from each iteration or just the transformations/inv from the final iteration. What about "create_jacobian_determinant_image" ? It seems like it tells only about the last iteration, doesn't it ? Which function computes the Jacobian itself ?

Thanks

abibalimi avatar Apr 08 '19 09:04 abibalimi

I would like to ask if antsRegistration's output files 'fwdtransforms' and 'invtransforms' contain the transformations/inv from each iteration or just the transformations/inv from the final iteration.

only the transformation(s) from the final iteration.

What about "create_jacobian_determinant_image" ? It seems like it tells only about the last iteration, doesn't it ?

Yes.

Which function computes the Jacobian itself?

There are two options: a function based on the geometric interpretation of the Jacobian or the finite difference approach.

ntustison avatar Apr 08 '19 12:04 ntustison

Thanks for the answers. Is it somehow possible to get the transformation(s) and Jacobian at each iteration ?

abibalimi avatar Apr 09 '19 10:04 abibalimi

Not without changing the code.

ntustison avatar Apr 09 '19 10:04 ntustison

I suppose you mean the C++ code. Or is it possible directly from ANTsPy ? Can I know the specific part of the code to change ? I will give it a try. Tks

abibalimi avatar Apr 09 '19 10:04 abibalimi

you may be able to make changes to the antsRegistration wrapper code by enabling the options

     -j, --save-state saveSateAsTransform
     -k, --restore-state restoreStateAsATransform

though i've never tried this. you can then play around with computing the deformation gradient from the deformation fields - there should be a very simple approach to wrapping an ITK class that will allow this. the approach is documented here: https://github.com/ANTsX/ANTsPy/blob/master/CONTRIBUTING.md

another avenue would be to write a metric along the lines of what is produced by ants.create_ants_metric ... these do not seem to return the derivative but they could easily do so. this, along with ants.apply_ants_transform_to_image would allow one to implement a custom registration method fairly easily. we could add - with a few lines of code - some regularization but for now ants.smooth_image should work.

>>> help( ants.smooth_image )

>>> simage = ants.smooth_image(image, (1.2,1.5))
>>> mimg = ants.merge_channels( [simage,simage] )
>>> mimg
ANTsImage
	 Pixel Type : float (float32)
	 Components : 2
	 Dimensions : (256, 256)
	 Spacing    : (1.0, 1.0)
	 Origin     : (0.0, 0.0)
	 Direction  : [1. 0. 0. 1.]

>>> ants.smooth_image( mimg, 4 )
ANTsImage
	 Pixel Type : float (float32)
	 Components : 2
	 Dimensions : (256, 256)
	 Spacing    : (1.0, 1.0)
	 Origin     : (0.0, 0.0)
	 Direction  : [1. 0. 0. 1.]

anyway, these are just a few thoughts. i am opening a somewhat related topic at the ants forum soon.

stnava avatar Apr 09 '19 11:04 stnava

https://github.com/ANTsX/ANTs/issues/752

stnava avatar Apr 09 '19 11:04 stnava

@stnava Thanks for you directions. I was out of office lately but I am going to give it a try and let you guys know about the outcome.

abibalimi avatar Apr 15 '19 11:04 abibalimi