[Insight-users] Problem on 3d Registration

Luis Ibanez luis.ibanez@kitware.com
Mon, 21 Apr 2003 09:31:46 -0400


Hi Sateesh,

Please look at Chapter 7 of the Software Guide.

In section 7.5.3 you will find the details about
the CenteredAffineTransform, in particular the
way in which the transform parameters are encoded.

In the 3D case, the four first parameters are the
coefficients of the rotation + scaling matrix.
The next two are the rotation center and the last
two are the translation parameters.

The first four paramters are the following M
coefficients

   | X' | =  |  M11   M12  | * | X |
   | Y' |    |  M21   M22  |   | Y |


M11 = 1.43606  In your case, which implies
                some amount of scaling in X.

M22 = 0.2753   Contains some scaling
                (contracting).


The values don't seem to be right unless your
image is largely anisotropic.

You may still need to tune the registration
parameters.


------

About reading the RAW file:

1) I will strongly suggest you to *not* use
    the RawImageIO. Instead, create a MetaImage
    header for the Raw file, and then let the
    IO factory mechanism create the apropriate
    reader for your file format.

2) The exception from the  Raw reader indicates
    that your file is not big enough to contain
    the information you are promising to the reader.

    512 x 512 x 35 = 9175040 pixels,

    if they are 16 bits/pixel, the reader is expecting

     18350080 bytes.


   Your file seems to contain only

      524288 bytes,

   So,... you better check your numbers...
   It is likely that your are passing the
   wrong filename to the reader.

   You will avoid this kind of problems
   by creating a MetaImage header and letting
   the reader find the right information
   for the image.



Look at the examples in


        Insight/Examples/Registration


Most of them illustrate how read and write images.



    Regards,


    Luis



------------------
cspl wrote:
> Hi Lius,
>    Thanks for ur mail.
>    As u said initialization is quite off. There was a problem in image
> reader which created all this mess till now. I could solve this problem by
> correcting ImageFileReader.
>    I tested the application with 2d images and is working good.
>    I have listed below the final parameters values. Can u tell how much the
> moving image has rotated when compared to the fixed image using these
> values. I don't have any idea of it.
> 
> My Initial paramters are
>  [1, 0, 0, 1, 250, 250, 0.000128, 0.000128]
> and final paramters are
> 199   -0.357571   [1.43606, -0.556968, -1.62759, 0.275343, 251.287,
> 249.49, -0.104085, -4.09714]
> 
>    As u asked, the content of the image is centered in the slice.
>    I was using OnMoments() function before but i changed to Geometry mode
> right now.
>    Now the origin values are (0,0) before applying CenteredAffineTransform.
> 
> 
>    Now, i changed the code to run for 3d images i.e. for a volume. This time
> my data sets are 512x512x35 for CT and 128x128x35 for PET. But this time too
> i face problem.
>    Reader could not able to read all the 35 slices. It is giving the
> following exception.
> ExceptionObject caught !
> 
> itk::ExceptionObject (0012F444)
> Location: "Unknown"
> File: G:\NEWITKFILES\NewVersionITK7_4_2003\itksrc\Code\IO\itkRawImageIO.txx
> Line: 196
> Description: itk::ERROR: RawImageIO(00305320): Read failed: Wanted 18350080
> bytes, but read 524288 bytes.
> 
>    This error tells that it could read only one slice out of 35 slices. I
> changes the dimension from 2 to 3. Even then it gives this error. Why is
> this so?? I am using "itkImageFileReader" class to read image. To it i give
> the object of "itkRawImageIO" which reads the Raw image data.
>    Is itkImageFileReader cannot read 3d images i.e. a volume??? Then which
> class will help in this regard.
> 
>    This is a snippet of my code...
>      fixedImageReader->SetFileName( argv[1] );
> 
>  int Image1x = 512,Image1y = 512, Image1z = 35;
>  FixedRawReader->SetDimensions( 0, Image1x );
>  FixedRawReader->SetDimensions( 1, Image1y );
>  FixedRawReader->SetDimensions( 2, Image1z );
> 
>  fixedImageReader->SetImageIO( FixedRawReader );
> 
>  try
>  {
>     fixedImageReader->Update();
>  }
>  catch( itk::ExceptionObject & err )
>  {
>     std::cout << "ExceptionObject caught !" << std::endl;
>     std::cout << err << std::endl;
>     return -1;
>  }
> 
> 
>    Please help me in this regard.
> 
>    Thanks in adance.
> 
> -Regard,
>    Sateesh
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
>