[MINC-development] reversedef?

Alex Zijdenbos zijdenbos at gmail.com
Tue May 28 20:47:42 EDT 2013


Hi Andrew,

Thanks! various bits of useful info here. My deformations are in fact
already collapsed to a single grid using xfm2def, that indeed made a
big difference. I'm always a bit reluctant to invert deformations
unnecessarily, as minctracc's deformation fields are often not
invertible. Then on the other hand, the registration scripts that I
have written are able to do bidirectional registrations (source to
target, target to source, invert, average) so in effect I'm already
doing this a lot; I suppose it would make sense to actually generate
the inverse xfm as the 'primary' for efficiency purposes.

So also, to understand things correctly; is reversedef(xfm) basically
equivalent to xfm2def( xfminvert( xfm ) ) ?

-- A

On Tue, May 28, 2013 at 8:17 PM, Andrew Janke <a.janke at gmail.com> wrote:
> Hi Alex,
>
>> I was wondering what is happening with reversedef. I noticed it still
>> exists in the minctracc/Extra_progs dir, but seems to be somewhat
>> dangling.
>
> Not much, it's still there and still works.
>
>> I recall from sometime in the 1990s that it could speed up
>> mincresample a fair bit by reorganizing the deformation field somehow.
>
> mincresample is faster if you do this:
>
>    mincresample -transformation xfm_inv.xfm -invert_transformation ...
>
> than if you use the forward transformation. This is due to how the
> code works in mincresample, it blits through the output volume finding
> data that goes to the current point and then resamples this.
>
>> I have mincresample calls that can run up to an hour or so, so if
>> there would be any way to speed these up that would actually be quite
>> helpful.
>
> So, reversedef can help you here, the only problem is that this will
> then introduce in effect another resampling as when you invert a
> transformation you have to resample/regrid the vectors. As I recall
> the code in reversedef to do this is NR code.  Perhaps a better
> approach and the approach that both Vlad and myself use in our model
> building scripts is to generate an inverse transformation in the first
> instance.
>
> ie:
>
>    # fit model to the source and resample
>    minctracc ....  model.mnc source.mnc xfm_inv.xfm
>
>    mincresample -like model.mnc -transformation xfm_inv.xfm \
>        -invert_transformation source.mnc res.mnc
>
> There are other advantages to this approach, the principal being that
> this makes averaging xfms a whole lot easier. I have two other tools
> that are probably worth mentioning here:
>
> xfm2def - takes a complex xfm (could have multiple grids + linear,
> etc) and turns it into a single nonlinear xfm.  This can also speed up
> mincresample.
>
>    https://github.com/BIC-MNI/minc/blob/master/progs/xfm/xfm2def.c
>
> gennlxfm
>
>    http://packages.bic.mni.mcgill.ca/scripts/gennlxfm
>
> One of the problems of fitting multiple volumes to a model if you want
> to average them is that the grids often don't align with each other
> due to the bit of jiggery-pokery that minctracc does when intialising
> grids. You can use this to generate an identity nonlinear grid that
> you then feed to minctracc.
>
>    # gennlxfm -ident -like model.xfm ident.xfm
>
>    # minctracc -transformation ident.xfm model.mnc source1.mnc output1.xfm
>    # minctracc -transformation ident.xfm model.mnc source2.mnc output2.xfm
>    # minctracc -transformation ident.xfm model.mnc source3.mnc output3.xfm
>
> You are now guaranteed that output{1,2,3}.xfm are all identically
> sampled and thus can be averaged.
>
>
> a
> _______________________________________________
> MINC-development mailing list
> MINC-development at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development
>


More information about the MINC-development mailing list