[Insight-users] Re: change resolution and dims of a .nii file

Luis Ibanez luis.ibanez at kitware.com
Sun Jan 20 20:15:52 EST 2008


Hi Frank,



About your first question:

It seems that what you want to do is to resample the image.

I would suggest the following pipeline:



    a) ImageFileReader <---- input nii file

    b) ResampleImageFilter
          Identity Transform
          Keep the origin
          Multiply the spacing by a factor K
          Divide the number of pixels along
            every dimension by the same K

    c) ImageFileWriter ----> output nii file


Note that you don't need to apply any Transform in the
resample image filter, just an IdentyTransform should
do it.

Alternatively you could use the ShrinkImageFilter,
if the factor K is an integer.



Abour your second question:

It doesn't make much sense to me.
Could you enumerate the registration components
that you are using here:

a) Metric
b) Transform
c) Optimizer
d) Interpolator
e) Fixed image characteristics (origin, spacing, size)
f) Moving image characteristics (origin, spacing, size)


I assume that what you mean, is that when you modify
the initialization of your transform, you get very
different results in the final transformation.

If that is the case, you are probably using an unstable
combination of parameters.

In particular, you should describe for us:


    A) The array of scaling parameters that you are
       passing to your optimizer

    B) The step length of the optimizer

    C) Send the output of the Command/Observer that
       you are connecting to the optimizer.
       We would like to see the Metric values and
       the Transform parameters at every iteration
       of the optimizer.


Please post this information to the mailing list.

It would be a good idea to include your source code too.



    Thanks


       Luis



--------------------
Frank Ezekiel wrote:
> Hi Luis:
> 
>         I'm looking for the most straightforward way to change the dims 
> and resolution of a .nii file, such that the header is still correct.   
> (e.g. the upper left position marker for the image stack is properly 
> adjusted to reflect the change in image extent).
> 
>         I'm using the OrientedImage functions, to allow registration of 
> one image to another using the DCM and position data loaded into the .nii
> 
>         A second question.    When I vary the position vector of the 
> TARGET image in my registration, in some cases the axis appears 
> swapped.     i.e.    I vary the position in Z and get a change in the 
> position of Y.   Thoughts?
> 
> 
> Thanks mucho, as always.
> 
> Frank
> 
> 
> 
> 
> 
> Frank Ezekiel
> Programmer/Analyst IV
> Center for Imaging of Neurodegenerative Diseases
> University of California at San Francisco and
> San Francisco VA Medical Center
> 415.221.4810 x 4918
> 
> 


More information about the Insight-users mailing list