[Insight-users] MR Registration
cspl
affable at hd2 . dot . net . in
Thu, 8 Aug 2002 15:12:18 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_0641_01C23EED.FCA46A40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Dear Friends,
I am working on MRI Registration.I have made my own project using MRI =
Registration example available in ITK examples.It is working well for =
some MRI images.But,It is throwing exception at StartRegistration() for =
some imagess.I have hard coded the Parameters which I have to set before =
calling StartRegistration().Plese, help me in solving my problem and =
give me some information on setting parameter values. Here I am =
enclosing the code and parameters details.I am also enclosing the =
exception message thrown by startregistration().=20
//Exception message
itk::ERROR: MutualInformationImageToImageMetric(003C6D20): All the =
sampled point mapped to outside of the moving image
//Code and parameter details
typedef itk::QuaternionRigidTransform<double> TransformType;
typedef itk::QuaternionRigidTransformGradientDescentOptimizer =
OptimizerType;
typedef itk::MutualInformationImageToImageMetric<ImageType, ImageType> =
MetricType;
typedef itk::LinearInterpolateImageFunction<ImageType, double> =
InterpolatorType;
typedef itk::ImageRegistrationMethod<ImageType,ImageType> =
RegistrationType1;
MetricType::Pointer metric =3D MetricType::New();
TransformType::Pointer transform =3D TransformType::New();
OptimizerType::Pointer optimizer =3D OptimizerType::New();
InterpolatorType::Pointer interpolator =3D InterpolatorType::New();
RegistrationType1::Pointer registration =3DRegistrationType1::New();
=20
RegistrationType1::ParametersType =
guess(transform->GetNumberOfParameters() );
=20
guess[0] =3D 0.0;
guess[1] =3D 0.0;
guess[2] =3D 0.0;
guess[3] =3D 1.0;
guess[4] =3D 20.0;
guess[5] =3D 40.0;
guess[6] =3D 0.0;
registration->SetInitialTransformParameters (guess);
=20
=20
//set metric parameters
metric->SetMovingImageStandardDeviation( 2 );
metric->SetFixedImageStandardDeviation( 2 );
metric->SetNumberOfSpatialSamples( 50 );
=20
=20
// Set translation scale
typedef OptimizerType::ScalesType ScaleType;
ScaleType scales(transform->GetNumberOfParameters());
scales.Fill( 1.0 );
for( unsigned j =3D 4; j < 7; j++ )
{
scales[j] =3D 1.0 / vnl_math_sqr(1.0);
}
=20
=20
//Scale parameters=20
optimizer->SetNumberOfIterations( 2000 );
optimizer->SetLearningRate( 0.0005 );
//set registration parameters
registration->SetMetric(metric);
registration->SetOptimizer(optimizer);
registration->SetTransform(transform);
registration->SetInterpolator(interpolator);
registration->SetFixedImage(FixedImage);
registration->SetMovingImage(MovingImage);
// Setup the optimizer
optimizer->SetScales(scales);
//optimizer->MaximizeOn();
=20
=20
AfxMessageBox("Before registration") ;
registration->StartRegistration();
AfxMessageBox("After registration") ;
=20
// Get the results
itk::Array<double> *arr=3Dnew itk::Array<double>;
RegistrationType1::ParametersType solution =
=3Dregistration->GetLastTransformParameters();
Regars,
CSPL=20
------=_NextPart_000_0641_01C23EED.FCA46A40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Dear Friends,<BR> I am working on =
MRI=20
Registration.I have made my own project using MRI Registration example =
available=20
in ITK examples.It is working well for some MRI images.But,It is =
throwing=20
exception at StartRegistration() for some imagess.I have hard =
coded the=20
Parameters which I have to set before calling StartRegistration().Plese, =
help me=20
in solving my problem and give me some information on setting parameter =
values.=20
Here I am enclosing the code and parameters details.I am also enclosing =
the=20
exception message thrown by startregistration(). </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>//Exception message<BR>itk::ERROR:=20
MutualInformationImageToImageMetric(003C6D20): All the sampled point =
mapped to=20
outside of the moving image</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>//Code and parameter =
details</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>typedef =
itk::QuaternionRigidTransform<double>=20
TransformType;<BR> typedef=20
itk::QuaternionRigidTransformGradientDescentOptimizer =
OptimizerType;<BR> =20
typedef itk::MutualInformationImageToImageMetric<ImageType, =
ImageType>=20
MetricType;<BR> typedef =
itk::LinearInterpolateImageFunction<ImageType,=20
double> InterpolatorType;<BR> typedef=20
itk::ImageRegistrationMethod<ImageType,ImageType>=20
RegistrationType1;</FONT></DIV>
<DIV> </DIV><FONT face=3DArial size=3D2>
<DIV><BR> =20
MetricType::Pointer =20
metric =3D =
MetricType::New();<BR> =20
TransformType::Pointer =20
transform =3D TransformType::New();<BR> =20
OptimizerType::Pointer =20
optimizer =3D OptimizerType::New();<BR> =20
InterpolatorType::Pointer interpolator =3D=20
InterpolatorType::New();<BR> RegistrationType1::Pointer =20
registration =3DRegistrationType1::New();<BR> </DIV>
<DIV> </DIV>
<DIV> RegistrationType1::ParametersType=20
guess(transform->GetNumberOfParameters() );<BR> =
<BR> =20
guess[0] =3D 0.0;<BR> guess[1] =3D 0.0;<BR> guess[2] =3D =
0.0;<BR> =20
guess[3] =3D 1.0;<BR> guess[4] =3D 20.0;<BR> guess[5] =3D =
40.0;<BR> =20
guess[6] =3D 0.0;</DIV>
<DIV> </DIV>
<DIV> registration->SetInitialTransformParameters=20
(guess);<BR> <BR> <BR> //set metric =
parameters<BR> =20
metric->SetMovingImageStandardDeviation( 2 );<BR> =20
metric->SetFixedImageStandardDeviation( 2 );<BR> =20
metric->SetNumberOfSpatialSamples( 50 );<BR> <BR> =20
<BR> // Set translation scale<BR> typedef =
OptimizerType::ScalesType=20
ScaleType;<BR> ScaleType=20
scales(transform->GetNumberOfParameters());<BR> scales.Fill( =
1.0=20
);<BR> for( unsigned j =3D 4; j < 7; j++ =
)<BR> =20
{<BR> scales[j] =3D 1.0 / =
vnl_math_sqr(1.0);<BR> =20
}<BR> <BR> </DIV>
<DIV> </DIV>
<DIV> //Scale parameters <BR> =20
optimizer->SetNumberOfIterations( 2000 );<BR> =20
optimizer->SetLearningRate( 0.0005 );</DIV>
<DIV> </DIV>
<DIV><BR> //set registration parameters<BR> =20
registration->SetMetric(metric);<BR> =20
registration->SetOptimizer(optimizer);<BR> =20
registration->SetTransform(transform);<BR> =20
registration->SetInterpolator(interpolator);<BR> =20
registration->SetFixedImage(FixedImage);<BR> =20
registration->SetMovingImage(MovingImage);</DIV>
<DIV> </DIV>
<DIV> // Setup the optimizer<BR> =20
optimizer->SetScales(scales);<BR> =20
//optimizer->MaximizeOn();<BR> <BR> <BR> =20
AfxMessageBox("Before registration") ;<BR> =20
registration->StartRegistration();<BR> AfxMessageBox("After=20
registration") ;<BR> <BR> // Get the results<BR> =20
itk::Array<double> *arr=3Dnew =
itk::Array<double>;<BR> =20
RegistrationType1::ParametersType solution=20
=3Dregistration->GetLastTransformParameters();</DIV>
<DIV> </DIV>
<DIV><BR>Regars,<BR>CSPL </FONT></DIV></BODY></HTML>
------=_NextPart_000_0641_01C23EED.FCA46A40--