[Insight-users] Image Registration with Center of rotation outside of image bounds

Michael Jackson mike.jackson at bluequartz.net
Fri Jan 16 17:40:08 EST 2009


Hello all,
    I am new to ITK and trying to wade through the software guide. I  
am having pretty good success registering my data but I am currently  
stumbling a bit.
   I have a pair of images the need to be registered. In addition to  
the X,Y translation component there is also a rotational component  
that needs to be taken into account. The problem I am having is that  
the center of rotation seems to be "off" the actual image. For example  
each of image's origin is around (10,10) and has a size of (100,100)  
but the center of rotation is approximately (0,0). I am using the  
example file "ImageRegistration5.cxx" as a starting point. I have  
changed the inputs to read my data files, set the origin and spacing.  
I then change the code to set the center of rotation to what I think  
it should be and run the program. I get an exception when running:

0   3860.12   [0.00834802, 0, 0, 0.0253854, 0.198207]
ExceptionObject caught !

itk::ExceptionObject (0x56bf10)
Location: "void itk::MeanSquaresImageToImageMetric<TFixedImage,  
TMovingImage>::GetValueAndDerivative(const typename  
itk::ImageToImageMetric<TFixedImage,  
TMovingImage>::TransformParametersType&, typename  
itk::ImageToImageMetric<TFixedImage, TMovingImage>::MeasureType&,  
typename itk::ImageToImageMetric<TFixedImage,  
TMovingImage>::DerivativeType&) const [with TFixedImage = main(int,  
char**)::FixedImageType, TMovingImage = main(int,  
char**)::MovingImageType]"
File: /Users/Shared/Toolkits/ITK-3.10.1/include/InsightToolkit/ 
Algorithms/itkMeanSquaresImageToImageMetric.txx
Line: 368
Description: itk::ERROR: MeanSquaresImageToImageMetric(0x569100): All  
the points mapped to outside of the moving image

Am I going about this the correct way? Any Help or nudges in the  
proper direction would be most appreciated...

Here are the important parts of the code (I think.. )

FixedImageType::PointType fixedOrigin;
fixedOrigin[0] = 48390.5;
fixedOrigin[1] = 49977.75;

MovingImageType::PointType movingOrigin;
movingOrigin[0] = 48390.5;
movingOrigin[1] = 49977.75;

fixedImageReader->GetOutput()->SetOrigin(fixedOrigin);
movingImageReader->GetOutput()->SetOrigin(movingOrigin);

//--- Set the Spacing of the images
FixedImageType::SpacingType fixedSpacing;
fixedSpacing[0] = 0.207987;
fixedSpacing[1] = 0.207987;
MovingImageType::SpacingType movingSpacing;
movingSpacing[0] = 0.207987;
movingSpacing[1] = 0.207987;

fixedImageReader->GetOutput()->SetSpacing(fixedSpacing);
movingImageReader->GetOutput()->SetSpacing(movingSpacing);



TransformType::InputPointType centerMoving;
centerMoving[0] = 46979.2;
centerMoving[1] = 48347.5;
TransformType::InputPointType centerFixed;

centerFixed[0] = 46979.2;
centerFixed[1] = 48347.5;
transform->SetTranslation( centerMoving - centerFixed );
transform->SetAngle( 0.0 );
registration->SetInitialTransformParameters( transform- 
 >GetParameters() );


_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio





More information about the Insight-users mailing list