BIC-MNI / minc-toolkit-v2

Version 2 of the minc-toolkit, uses tools based on ITK version 4.x
GNU General Public License v3.0
48 stars 21 forks source link

new ANTS generates deformation grids in a different dimension order, breaks mincblob #8

Open gdevenyi opened 9 years ago

gdevenyi commented 9 years ago

A deformation grid from mincANTS in 1.0.04:

> mincinfo H005.n4correct.affine_register_masked.nonlinear_register_inverse_grid_0.mnc
file: H005.n4correct.affine_register_masked.nonlinear_register_inverse_grid_0.mnc
image: signed__ float -12.588603973388671875 to 13.97495269775390625
image dimensions: vector_dimension xspace yspace zspace
    dimension name         length         step        start
    --------------         ------         ----        -----
    vector_dimension            3      unknown      unknown
    xspace                    193            1          -96
    yspace                    229            1         -132
    zspace                    193            1          -78

A deformation grid from ANTS in 1.9.10:

> mincinfo H005.n4correct.affine_register_masked.nonlinear_register_inverse_grid_0.mnc
file: H005.n4correct.affine_register_masked.nonlinear_register_inverse_grid_0.mnc
image: signed__ float -12.906299591064453125 to 14.38669586181640625
image dimensions: zspace yspace xspace vector_dimension
    dimension name         length         step        start
    --------------         ------         ----        -----
    zspace                    193            1          -78
    yspace                    229            1         -132
    xspace                    193            1          -96
    vector_dimension            3      unknown      unknown

On the new grid files, mincblob fails:

> mincblob -determinant H005.n4correct.affine_register_masked.nonlinear_register_inverse_grid_0.mnc /tmp/det.mnc
Error: MINC file has only 3 dims, volume requires 4.
mincblob: Error reading input volume (H005.n4correct.affine_register_masked.nonlinear_register_inverse_grid_0.mnc)
vfonov commented 9 years ago

yes, mincblob doesn't work when vector dimensions is not the fastest varying. That's why I wrote grid_proc

gdevenyi commented 9 years ago

Where can I find grid_proc, I don't see it in minc-toolkit-v2

vfonov commented 9 years ago

oops, I forgot - it still in my private repository. You can also use CreateJacobianDeterminantImage - it's part of ANTs , so it is built togethether with antsRegistration and supports minc reading/writing.

gdevenyi commented 9 years ago

Thanks, I was aware of CreateJacobianDeterminantImage I just wasn't sure that it had been tested against .mnc deformations.

In the meantime I've solved my problem with a mincreshape

gdevenyi commented 9 years ago

Followup: mincblob (on a mincreshaped image) and CreateJacobianDeterminantImage do not produce the same results. At least visually using register, so for now I'll stick to reshape/mincblob

As soon as I have a example I can share I'll follow up

gdevenyi commented 8 years ago

Followup, the difference is the ANTs produces jacobians that are "1 centered" while mincblob produces jacobians that are "0 centered"

vfonov commented 8 years ago

so, minccalc -express 'A[0]-1' would solve this problem?

gdevenyi commented 8 years ago

Yes, if I take the CreateJacobianDeterminantImage file and do minccalc -express 'A[0]-1' I get the mincblob map, except for some values on the edges of the image. The in-brain differences are numerical error.

vfonov commented 8 years ago

maybe the easiest will be to add an option to CreateJacobianDeterminantImage to subtract 1.0 ?

gdevenyi commented 8 years ago

Well, from my perspective, when I'm using jacobians, I usually have to add 1 to get what I want, so the current default is okay with me.

If you intend to use CreateJacobianDeterminantImage as a drop-in replacement, it will need an option of course.