[Insight-users] Fwd: Can not reproduce metric value

Quy Pham Sy phamsyquybk at gmail.com
Sat Oct 3 04:55:24 EDT 2009


Hi,
I tried with radian,
--------------------------------------------
.....
transform->SetScale(1.08438);
transform->SetAngle(*0.154531**)*;
TransformType::TranslationType translation;
translation[0] = -26.6822;
translation[1] = -93.6822;
.....
--------------------------------------------

I got new value but still not  '4551.86' (the value from example).

I read from "ITK software guide ver 2.4" textbook, page 366. they explained
(as i understand) that the output transform params from registration process
are actually applied to FixeImage, in order to get the minimum metric
value.

It is still not clear that, the transform params pass directly to metric
object are interpreted same way as in registration process (i mean they also
applied to Fixed image instead of Moving Image). I guess the reason may come
from this unobvious understanding.  Do you have any idea about this?


Thanks,
Quyps


2009/10/3 Bill Lorensen <bill.lorensen at gmail.com>

>   /** Set/Get the angle of rotation in radians */
>                                                        ----------
>  void SetAngle(TScalarType angle);
>  itkGetConstReferenceMacro( Angle, TScalarType );
>
> Try:
> transform->SetAngle(0.154531);
>
> On Fri, Oct 2, 2009 at 4:09 PM, Quy Pham Sy <phamsyquybk at gmail.com> wrote:
> > hi,
> > I run ImageRegistration7 example in ITK.
> > and the output like following
> > -------------------------------------
> >  Scale         = 1.08438
> >  Angle (radians) 0.154531
> >  Angle (degrees) 8.85397
> >  Center X      = 170.327
> >  Center Y      = 148.556
> >  Translation X = -26.6822
> >  Translation Y = -93.4428
> >  Iterations    = 500
> >  Metric value  = 4551.86
> > ---------------------------------------
> > I made a program in which i use a same metric, transformation,
> interpolate
> > object type as above example, with same two input image file. I set above
> > value to calculate metric value directly from metric object, but the
> result
> > is not same as what the example made..
> > here is the code, did i miss something?
> > I'm running out of time! really appreciate any help!
> > -------------------------------------------------------------------------
> > int main( int argc, char * argv[] )
> > {
> > const     unsigned int   Dimension = 2;
> > typedef   unsigned char  PixelType;
> > typedef itk::Image< PixelType, Dimension >   ImageType;
> > typedef itk::ImageFileReader< ImageType >  ReaderType;
> > ReaderType::Pointer fixedReader  = ReaderType::New();
> > ReaderType::Pointer movingReader = ReaderType::New();
> > fixedReader->SetFileName(  "fixed.bmp" );
> > movingReader->SetFileName( "moving.bmp" );
> > try
> > {
> > fixedReader->Update();
> > movingReader->Update();
> > }
> > catch( itk::ExceptionObject & excep )
> > {
> > std::cerr << "Exception catched !" << std::endl;
> > std::cerr << excep << std::endl;
> > }
> > typedef itk::MeanSquaresImageToImageMetric< ImageType, ImageType >
> >  MetricType;
> > MetricType::Pointer metric = MetricType::New();
> > typedef itk::CenteredSimilarity2DTransform < double >  TransformType;
> > TransformType::Pointer transform = TransformType::New();
> > typedef itk::LinearInterpolateImageFunction< ImageType, double >
> >  InterpolatorType;
> > InterpolatorType::Pointer interpolator = InterpolatorType::New();
> > ImageType::Pointer fixedImage  = fixedReader->GetOutput();
> > ImageType::Pointer movingImage = movingReader->GetOutput();
> > typedef itk::CenteredTransformInitializer< TransformType, ImageType,
> > ImageType >  TransformInitializerType;
> > TransformInitializerType::Pointer initializer =
> > TransformInitializerType::New();
> > initializer->SetTransform(   transform );
> > initializer->SetFixedImage(  fixedImage );
> > initializer->SetMovingImage( movingImage );
> > initializer->MomentsOn();
> > initializer->InitializeTransform();
> > metric->SetTransform( transform );
> > metric->SetInterpolator( interpolator );
> > metric->SetFixedImage(  fixedImage  );
> > metric->SetMovingImage( movingImage );
> > metric->SetFixedImageRegion(  fixedImage->GetBufferedRegion()  );
> > try
> > {
> > metric->Initialize();
> > }
> > catch( itk::ExceptionObject & excep )
> > {
> > std::cerr << "Exception catched !" << std::endl;
> > std::cerr << excep << std::endl;
> > return EXIT_FAILURE;
> > }
> > transform->SetScale(1.08438);
> > transform->SetAngle(*0.154531**)*;
> > TransformType::TranslationType translation;
> > translation[0] = -26.6822;
> > translation[1] = -93.6822;
> > MetricType::TransformParametersType transformParams =
> > transform->GetParameters();
> > double metricval = metric->GetValue(transformParams);
> > return EXIT_SUCCESS;
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > _____________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the ITK FAQ at:
> > http://www.itk.org/Wiki/ITK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.itk.org/mailman/listinfo/insight-users
> >
> >
>



-- 
Pham Sy Quy
HCI Lab, Advanced Fusion Technology Department,
Room 1211, New Millennium Building
Konkuk University, Seoul, Korea
Mobile: +82-10-9800-8104



-- 
Pham Sy Quy
HCI Lab, Advanced Fusion Technology Department,
Room 1211, New Millennium Building
Konkuk University, Seoul, Korea
Mobile: +82-10-9800-8104
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091003/b3418c48/attachment-0001.htm>


More information about the Insight-users mailing list