[Insight-users] Re: Question

Luis Ibanez luis . ibanez at kitware . com
Thu, 30 May 2002 00:10:54 -0400


Hi Buu,

If your are using the BrainWeb images
ftp://public.kitware.com/pub/itk/Data/BrainWeb/
as input, you have to change the pixel type in the
MultiResMIRegistration example, the default type in
the example is: "signed short" and the BrainWeb
images in the ftp server are of pixel type:
"unsigned char".


Note that the first thing that the MultiResMI example
does is to convert the input images to float and
normalize them. The subsequent computations for
registration are done on float images.


Please edit the file:

    Examples/MultiResMIRegistration/MIRegistrationApp.h

and in line 43: replace

    typedef signed short InputPixelType;

by

    typedef unsigned char InputPixelType;

(This line number is for the BetaRelease,
so that should match in your installation.)

This PixelType is propagated by typedefs through all the
example, so there is only one line to change. Recompile
the example and run it with the input file that we sent you.
We have run the example with these images and this input file
both after compiled in Debug and Release modes and we obtain
a correct output on the .raw image and the PGM slices.

--

About the "Final Parameters" in the output of the example:

These parameters printed in the output are the parameters
of the Affine Transform used for the registration.

An Affine transform in 3D is composed of a matrix M (3x3) and
a Translation vector T. A point P gets transformed by the
operation:

                  P'  =  M . P + T

The matrix M applies rotations, shearing and scaling,
while T just translate the point.  In order to understand
the parameters you may want to take a look at the
itkAffineTransform.txx file in Code/Common.

Look in particular in the GetParameters() and SetParameters()
methods. In 3D the first 9 parameters are the coefficients
of the matrix and the last 3 are the coefficients of the
translation vector.




Please let us know if you encounter any problems changing
the pixel type on the example, or during the execution.


Thanks

     Luis


PS. Please try to get Service Pack 5 for VC++ installed !




============================================================

Buu Tien Phan wrote:
 >
 > I still have problem with the out put of
 > MultiResMIRegistration example. I have installed a new Insight version
 > (beta). Also I have Service Pack 3 installed in my computer ( I will
 > have SP 5 next week). Now I go to another option which is changing
 > "signed short" to "unsigned char". However, I have been unable to find
 > where this line is in the example. Could you indicate where these lines
 > are in the example? Last time, you gave me the number but it was not
 > correct.
 >
 >
 > Also, when we run the example, the application print out some values.
 > The "Final parameters" line have some values. I am not sure what they
 > mean. I am sending the "info.txt" file printed when running the example.
 >
 >
 >
 > Thank you very much for your help.
 >
 >
 >
 >
 >
 > Buu Phan
 >
 >
 > ------------------------------------------------------------------------
 >
 > Target filename: brainweb1e1a10f20.raw
 > Big Endian: 1
 > Image Size: [181, 217, 181]Image Spacing: 1 1 1
 >
 > Reference filename: brainweb1e1a10f20Rot10Tx15.raw
 > Big Endian: 1
 > Image Size: [181, 217, 181]Image Spacing: 1 1 1
 >
 > Number of levels: 4
 > Target shrink factors: 4 4 4
 > Reference shrink factors: 4 4 4
 > Number of iterations: 2500 2500 2500 2500
 > Learning rates: 0.0001 1e-005 5e-006 5e-007
 > Translation scales: 100 100 100 100
 >
 > Registered image filename: registered.raw
 > Big Endian: 1
 >
 > Dump PGM files: 1
 > PGM directory: PGM
 >
 > Reading in target.
 > Reading in reference.
 > Normalizing the target.
 > Mean: -4039.59 StdDev: 10126.4
 > Normalizing the reference.
 > Mean: -4129.57 StdDev: 10085.4
 > Setting up the registrator.
 > Start the registration.
 > Final parameters: 0.0047598  -0.00330879  0.00411093  0.999975 
1.04916  -8.86594  -0.0830282
 > Transforming the reference.
 > Writing registered image to registered.raw.
 > Writing PGM files of the target.
 > Writing PGM files of the reference.
 > Writing PGM files of the registered image.
 >