[MINC-users] Building xfm2def

Vladimir S. Fonov vladimir.fonov at gmail.com
Thu Mar 3 09:23:11 EST 2016


Hello,

another suggestion, if you want to play with xfm2def - you can use 
xfm_normalize.pl script ( 
https://github.com/BIC-MNI/EZminc/blob/master/scripts/xfm_normalize.pl  )

It's a wrapper around xfm2def that extracts sampling parameter from 
another minc file, i.e



xfm_normalize.pl input.xfm   output.xfm --like <template.mnc> --step 4.0

- will extract bounding box from <template.mnc> and creata an .xfm file 
with _grid_0.mnc created by xfm2def , that will cover the bounding box 
with a given step size. If you want to match sampling of another minc 
file exactly - you can specify --exact flag. Another useful option is 
--invert - it inverts input xfm file before calling xfm2def.



On 16-03-03 07:43 AM, Andrew Wood wrote:
> Hi Andrew,
>
> I didn't open the grid directly, but rather showed what happened after
> applying it to a 3D volume.
>
> Instead of passing parameters to xfm2def to control the grid output, I used
> make_phantom parameters to make my data match xfm2def's defaults. Here's
> what I mean:
>
> $ xfm2param -rotations 30 30 30 ./rotations.xfm
> $ xfm2def ./rotations.xfm ./grid.mnc
> $ vim ./grid.xfm    # write an xfm for the deformation field
>
> $ mincinfo ./grid.mnc
>      dimension name         length         step        start
>      --------------         ------         ----        -----
>      xspace                    100            1          -50
>      yspace                    100            1          -50
>      zspace                    100            1          -50
>      vector_dimension            3      unknown      unknown
>
> $ make_phantom -xstart -50 -ystart -50 -zstart -50 -xstep 1 -ystep 1 -zstep
> 1 -xnelements 100 -ynelements 100 -znelements 100 ./phantom.mnc -xcenter 0
> -ycenter 0 -zcenter 0
>
> $ mincresample -transformation ./grid.xfm phantom.mnc phantom_rotated.mnc
> -use_input_sampling
>
>
> Here is the phantom, and the rotated phantom:
>
> https://drive.google.com/file/d/0BzcZlhs8X1gFZkZuSUtWRkFxcHM/view?usp=sharing
>
>
> Best,
> Andrew
>
>
>
> On Thu, Mar 3, 2016 at 12:38 AM, Andrew Janke <a.janke at gmail.com> wrote:
>
>> Hi Andrew,
>>
>> This should be fine for xfm2def, which component of the vector field
>> are you viewing in register? X?  The use case you describe is exactly
>> what it was written for.
>>
>> You generally have to specify a large number of input parameters to
>> xfm2def (start, step, nelem) in order to get what you want output.  I
>> thought there was a version floating around in which I implemented a
>> -like option but a quick search would say that I'm wrong.
>>
>>
>> a
>>
>>
>> On 3 March 2016 at 15:14, Andrew Wood <andrew at biospective.com> wrote:
>>> Hi again,
>>>
>>> I managed to build xfm2def (I'll issue a small pull request to update for
>>> VIO), but I'm not sure what to make of it's behaviour. I'm trying to use
>> it
>>> to approximate a linear transform as a deformation grid.
>>>
>>> I ran xfm2def on a "-rotations 30 30 30" xfm, then used it in
>> mincresample
>>> to rotate a make_phantom volume (grid and phantom sampled like each
>> other).
>>> Here's the result:
>>>
>>>
>> https://drive.google.com/file/d/0BzcZlhs8X1gFWUNQa2RMd3o3dTg/view?usp=sharing
>>>
>>> Are there limitations in xfm2def that would prevent it from
>> approximating a
>>> linear transform like this?
>>>
>>> Thanks,
>>> Andrew
>>>
>>> On Wed, Mar 2, 2016 at 11:38 PM, Andrew Wood <andrew at biospective.com>
>> wrote:
>>>
>>>>
>>>> Hi all,
>>>>
>>>> It looks like minctools isn't currently configured to build xfm2def. I
>>>> tried adding it to the CMakeLists.txt, but I'm getting errors:
>>>>
>>>> minc-toolkit-v2/minctools/progs/xfm/xfm2def.c: In function ‘main’:
>>>> minc-toolkit-v2/minctools/progs/xfm/xfm2def.c:96:4: error: unknown type
>>>> name ‘progress_struct’
>>>>      progress_struct progress;
>>>>      ^
>>>> ...
>>>>
>>>> Is there a reason that it's not part of the standard build? If not, is
>>>> there an easy way to add it? Or will it require development to bring it
>> in
>>>> line with the latest version of the libraries?



More information about the MINC-users mailing list