[Insight-users] On Interpolation and transform parameters
cspl
affable@hd2.dot.net.in
Thu, 26 Sep 2002 19:08:17 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_001E_01C26590.12213F60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Dear Mr.Luis,
I am working on registration.I have used Affinetranformation class for =
transformation.My registration code is working fine and i could be able =
to resample the image after registration.But,I have some doubts =
regarding initial transform parameters and interpolation.I have observed =
that registration output is dependent on Initial transform parameters.I =
have some other tool to test the registration output.I could not get the =
output matching with that tool.I think by setting Initial transform =
parameters to some values we coud get the output.Because,the final =
registration matrix is close to initial parmeters.I have no idea about =
what these parameters hold.Please, tell me whether my opinion is correct =
or not and tell me how to set these parameters.I am enclosing the =
parameters i have tried.
case1:
=20
for(int i=3D1;i<12;i++)
initialParameters[i]=3D0.1;
initialParameters[3]=3D0.5;
initialParameters[5]=3D0.3;
initialParameters[0] =3D 1.0;
initialParameters[4] =3D 1.0;
initialParameters[8] =3D 1.0; =20
case2:
=20
for(int i=3D1;i<12;i++)
initialParameters[i]=3D0.0;
initialParameters[0] =3D 1.0;
initialParameters[4] =3D 1.0;
initialParameters[8] =3D 1.0;
case 3:
=20
for(int i=3D1;i<12;i++)
initialParameters[i]=3D0.1;
initialParameters[3]=3D0.5;
initialParameters[5]=3D0.1;
initialParameters[0] =3D 1.0;
initialParameters[4] =3D 1.0;
initialParameters[8] =3D 1.0;=20
initialParameters[10]=3D0.3;=20
=20
I am having one more doubt regarding the role of interpolator in =
registration and resampling.when i registered MRI and SPECT(Mri as =
Fixed and SPECT as mooving) I could get the registered voilume equal to =
the fixed volume.But, the Images size is decreasing.I am getting small =
images.Please,tell me how i could solve this problem and why it is =
getting.I am enclosing resample code and registration code also.
Registration code:
typedef OptimizerType::ScalesType ScalesType;
ScalesType parametersScales( transform->GetNumberOfParameters() );
=20
parametersScales.Fill( 1.0 );
=20
double scale =3D 1.0 / vnl_math_sqr( 500);
=20
for (int j =3D 9; j < 12; j++ )
{
parametersScales[j] =3D scale;
}
=20
optimizer->SetScales( parametersScales );
=20
// need to maximize for mutual information
optimizer->MaximizeOn();
////////////////////////////////////////////////////////////////////
//Set up the metric.
=
//////////////////////////////////////////////////////////////////// =20
metric->SetMovingImageStandardDeviation( =
movingImageStatisticsFilter->GetSigma() * 0.4 );
metric->SetFixedImageStandardDeviation( =
fixedImageStatisticsFilter->GetSigma() * 0.4 );
metric->SetNumberOfSpatialSamples( 50);
metric->SetFixedImageRegion( fixedImage->GetBufferedRegion() ); =20
=
////////////////////////////////////////////////////////////////////
// Set up the registrator.
=
////////////////////////////////////////////////////////////////////
// connect up the components
registration->SetMetric( metric );
registration->SetOptimizer( optimizer );
registration->SetTransform( transform );
registration->SetFixedImage(fixedImage );
registration->SetMovingImage( movingImage );
registration->SetInterpolator( interpolator );
=20
// set initial parameters to identity
RegistrationType::ParametersType initialParameters(=20
transform->GetNumberOfParameters() );
initialParameters.Fill( 0.0 );
for(int i=3D1;i<12;i++)
initialParameters[i]=3D0.1;
initialParameters[3]=3D0.5;
initialParameters[5]=3D0.3;
initialParameters[0] =3D 1.0;
initialParameters[4] =3D 1.0;
initialParameters[8] =3D 1.0; =20
=20
registration->SetInitialTransformParameters( initialParameters );
optimizer->SetNumberOfIterations(4);
try
{
registration->StartRegistration(); =20
}catch(itk::ExceptionObject& Eo)
{ =20
AfxMessageBox(Eo.GetDescription());
return NULL;
}=20
resample code:
resampleFilter ->SetTransform(transform);
resampleFilter->SetInput(movingImage); =20
resampleFilter->SetSize( =
mriImage->GetLargestPossibleRegion().GetSize());
resampleFilter->SetOutputOrigin( mriImage->GetOrigin() );
resampleFilter->SetOutputSpacing( mriImage->GetSpacing() );
resampleFilter->Update();
Regards,
CSPL
------=_NextPart_000_001E_01C26590.12213F60
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 Mr.Luis,<BR> I am working on=20
registration.I have used Affinetranformation class for transformation.My =
registration code is working fine and i could be able to resample the =
image=20
after registration.But,I have some doubts regarding initial transform =
parameters=20
and interpolation.I have observed that registration output is dependent =
on=20
Initial transform parameters.I have some other tool to test the =
registration=20
output.I could not get the output matching with that tool.I think by =
setting=20
Initial transform parameters to some values we coud get the =
output.Because,the=20
final registration matrix is close to initial parmeters.I have no idea =
about=20
what these parameters hold.Please, tell me whether my opinion is correct =
or not=20
and tell me how to set these parameters.I am enclosing the parameters i =
have=20
tried.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>case1:<BR> <BR> =
for(int=20
i=3D1;i<12;i++)<BR> =
initialParameters[i]=3D0.1;<BR> =20
initialParameters[3]=3D0.5;<BR> =
=20
initialParameters[5]=3D0.3;<BR> initialParameters[0] =3D=20
1.0;<BR> initialParameters[4] =3D 1.0;<BR> =20
initialParameters[8] =3D 1.0; <BR>case2:<BR> =
<BR> =20
for(int i=3D1;i<12;i++)<BR> =20
initialParameters[i]=3D0.0;<BR> initialParameters[0] =3D=20
1.0;<BR> initialParameters[4] =3D 1.0;<BR> =20
initialParameters[8] =3D 1.0;<BR>case 3:<BR> <BR> =
for(int=20
i=3D1;i<12;i++)<BR> =
initialParameters[i]=3D0.1;<BR> =20
initialParameters[3]=3D0.5;<BR> =
=20
initialParameters[5]=3D0.1;<BR> initialParameters[0] =3D=20
1.0;<BR> initialParameters[4] =3D 1.0;<BR> =20
initialParameters[8] =3D 1.0; <BR> =20
initialParameters[10]=3D0.3; <BR> </FONT></DI=
V>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> I am having one more doubt =
regarding the role=20
of interpolator in registration and resampling.when i =
registered MRI=20
and SPECT(Mri as Fixed and SPECT as mooving) I could get the =
registered voilume equal to the fixed volume.But, the Images size =
is=20
decreasing.I am getting small images.Please,tell me how i could =
solve=20
this problem and why it is getting.I am enclosing resample code =
and=20
registration code also.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Registration code:<BR> typedef=20
OptimizerType::ScalesType ScalesType;<BR> =
ScalesType=20
parametersScales( transform->GetNumberOfParameters() =
);<BR> =20
<BR> parametersScales.Fill( 1.0 =
);<BR> =20
<BR> double scale =3D 1.0 / vnl_math_sqr(=20
500);<BR> <BR> for =
(int j =3D 9; j < 12; j++ )<BR> =
{</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =
parametersScales[j] =3D=20
scale;<BR> }<BR> =
<BR> =20
optimizer->SetScales( parametersScales );<BR> =20
<BR> // need to maximize for mutual=20
information<BR> =
optimizer->MaximizeOn();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> =20
////////////////////////////////////////////////////////////////////<BR>&=
nbsp; =20
//Set up the metric.<BR> =20
//////////////////////////////////////////////////////////////////// =
; =20
<BR> metric->SetMovingImageStandardDeviation( =
movingImageStatisticsFilter->GetSigma() * 0.4=20
);<BR> metric->SetFixedImageStandardDeviation(=20
fixedImageStatisticsFilter->GetSigma() * 0.4=20
);<BR> metric->SetNumberOfSpatialSamples(=20
50);<BR> metric->SetFixedImageRegion(=20
fixedImage->GetBufferedRegion() ); </FONT></DIV>
<DIV> </DIV><FONT face=3DArial size=3D2>
<DIV><BR> =20
////////////////////////////////////////////////////////////////////<BR>&=
nbsp; =20
// Set up the registrator.<BR> =20
////////////////////////////////////////////////////////////////////</DIV=
>
<DIV> </DIV>
<DIV> // connect up the components<BR> =20
registration->SetMetric( metric );<BR> =20
registration->SetOptimizer( optimizer );<BR> =20
registration->SetTransform( transform );<BR> =20
registration->SetFixedImage(fixedImage );<BR> =20
registration->SetMovingImage( movingImage );<BR> =20
registration->SetInterpolator( interpolator );<BR> =
<BR> //=20
set initial parameters to identity<BR> =20
RegistrationType::ParametersType initialParameters(=20
<BR> transform->GetNumberOfParameters() =
);</DIV>
<DIV> </DIV>
<DIV> initialParameters.Fill( 0.0 );<BR> for(int =
i=3D1;i<12;i++)<BR> =
initialParameters[i]=3D0.1;<BR> =20
initialParameters[3]=3D0.5;<BR> =
=20
initialParameters[5]=3D0.3;<BR> initialParameters[0] =3D=20
1.0;<BR> initialParameters[4] =3D 1.0;<BR> =20
initialParameters[8] =3D 1.0; <BR> =20
<BR> =20
registration->SetInitialTransformParameters( initialParameters=20
);<BR> =20
optimizer->SetNumberOfIterations(4);</DIV>
<DIV> </DIV>
<DIV> try<BR> {<BR> =20
registration->StartRegistration(); </DIV>
<DIV> </DIV>
<DIV> }catch(itk::ExceptionObject& Eo)<BR> =20
{ <BR> =20
AfxMessageBox(Eo.GetDescription());<BR> return =
NULL;<BR> =20
} </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>resample code:</DIV>
<DIV> </DIV>
<DIV> resampleFilter=20
->SetTransform(transform);<BR> =20
resampleFilter->SetInput(movingImage); </DIV>
<DIV> </DIV>
<DIV> resampleFilter->SetSize(=20
mriImage->GetLargestPossibleRegion().GetSize());<BR> =
=20
resampleFilter->SetOutputOrigin( mriImage->GetOrigin()=20
);<BR> resampleFilter->SetOutputSpacing(=20
mriImage->GetSpacing() );<BR> =20
resampleFilter->Update();</DIV>
<DIV> </DIV>
<DIV>Regards,<BR>CSPL<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_001E_01C26590.12213F60--