[Insight-users] StartRegistration failed

valli gummadi valli gummadi" <valli_gummadi at rediffmail.com
13 Jan 2004 12:25:06 -0000


 This is a multipart mime message


--Next_1073996706---0-202.54.124.152-18687
Content-type: text/html;
	charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<P>=0A<BR>=0A Dear Mr.Luis,<BR>=0A<BR>=0A&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 I am working on the registration application. My application is failing at=
 the StartRegistration() function. When I trace the code i found that it is=
 failing at the metric initialization.<BR>=0A<BR>=0AIn MattesMutualinformat=
ion class at the following line:<BR>=0A<BR>=0ABSplineInterpolatorType * tes=
tPtr =3D dynamic_cast&lt;BSplineInterpolatorType *&gt;(<BR>=0A&nbsp; &nbsp;=
 m_Interpolator.GetPointer() );<BR>=0A<BR>=0AEnclosing the code:<BR>=0Atype=
def&nbsp;  float&nbsp; &nbsp; InternalPixelType;<BR>=0Atypedef itk::Centere=
dAffineTransform&lt; double, Dimension &gt; TransformType;<BR>=0Atypedef it=
k::RegularStepGradientDescentOptimizer&nbsp; &nbsp; &nbsp;  OptimizerType;<=
BR>=0Atypedef itk::MattesMutualInformationImageToImageMetric&lt; &nbsp; &nb=
sp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; InternalImageType, InternalImageType &=
gt;&nbsp; &nbsp; MetricType;<BR>=0Atypedef itk:: LinearInterpolateImageFunc=
tion&lt; InternalImageType,<BR>=0A&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&=
nbsp; &nbsp; &nbsp;double&gt;&nbsp; &nbsp; InterpolatorType;&nbsp; &nbsp; &=
nbsp;typedef itk::ImageRegistrationMethod&lt; InternalImageType, InternalIm=
ageType &gt;&nbsp;  RegistrationType;<BR>=0Atypedef itk::CenteredTransformI=
nitializer&lt; TransformType,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  FixedImage=
Type,MovingImageType &gt;&nbsp; TransformInitializerType;<BR>=0A<BR>=0AInte=
rpolatorType::Pointer&nbsp;  interpolator&nbsp; =3D InterpolatorType::New()=
;<BR>=0Ainterpolator-&gt;SetInputImage( movingCaster-&gt;GetOutput());<BR>=
=0Aregistration-&gt;SetInterpolator(&nbsp; interpolator&nbsp; );<BR>=0A<BR>=
=0AMetricType::Pointer&nbsp; &nbsp; &nbsp; &nbsp;  metric&nbsp; &nbsp; &nbs=
p; &nbsp; =3D MetricType::New();<BR>=0Ametric-&gt;SetNumberOfHistogramBins(=
&nbsp; 50);<BR>=0Ametric-&gt;SetNumberOfSpatialSamples(1000 );<BR>=0Aregist=
ration-&gt;SetMetric(&nbsp; &nbsp; &nbsp; &nbsp; metric&nbsp; &nbsp; &nbsp;=
 &nbsp; );<BR>=0A<BR>=0Atypedef OptimizerType::ScalesType&nbsp; &nbsp; &nbs=
p;  OptimizerScalesType;<BR>=0AOptimizerType::Pointer&nbsp; &nbsp; &nbsp; o=
ptimizer&nbsp; &nbsp;  =3D OptimizerType::New();<BR>=0AOptimizerScalesType =
optimizerScales( NoofParams );<BR>=0Aconst double translationScale =3D 1.0 =
/ 1000000;<BR>=0Afor( int i =3D 0; i &lt;=3D 8; i++ )<BR>=0A&nbsp; &nbsp; &=
nbsp;optimizerScales[ i ] =3D&nbsp; 1.0 / 1.0;//m_scales;<BR>=0AoptimizerSc=
ales[ 9 ]&nbsp; =3D&nbsp; translationScale;<BR>=0AoptimizerScales[ 10 ] =3D=
&nbsp; translationScale;<BR>=0AoptimizerScales[ 11 ] =3D&nbsp; translationS=
cale;<BR>=0AoptimizerScales[ 12 ] =3D&nbsp; translationScale;<BR>=0Aoptimiz=
erScales[ 13 ] =3D&nbsp; translationScale;<BR>=0AoptimizerScales[ 14 ] =3D&=
nbsp; translationScale;<BR>=0Aoptimizer-&gt;SetScales( optimizerScales );<B=
R>=0Aoptimizer-&gt;SetMaximumStepLength( 4); <BR>=0Aoptimizer-&gt;SetMinimu=
mStepLength( 0.001 );<BR>=0Aoptimizer-&gt;SetNumberOfIterations( 100 ); <BR=
>=0Aoptimizer-&gt;SetMinimize( TRUE );&nbsp; &nbsp; &nbsp;<BR>=0Aregistrati=
on-&gt;SetOptimizer(&nbsp; &nbsp;  optimizer&nbsp; &nbsp;  );<BR>=0A<BR>=0A=
TransformType::Pointer&nbsp; &nbsp; &nbsp; transform&nbsp; &nbsp;  =3D Tran=
sformType::New();<BR>=0Atransform-&gt;SetIdentity();<BR>=0ANoofParams =3D t=
ransform-&gt;GetNumberOfParameters();<BR>=0Aregistration-&gt;SetInitialTran=
sformParameters( transform-&gt;GetParameters() );<BR>=0Aregistration-&gt;Se=
tTransform(&nbsp; &nbsp;  transform&nbsp; &nbsp;  );<BR>=0A<BR>=0Atry <BR>=
=0A{ <BR>=0A&nbsp; &nbsp; &nbsp;registration-&gt;StartRegistration(); <BR>=
=0A} <BR>=0Acatch( itk::ExceptionObject &amp; err ) <BR>=0A{ <BR>=0A&nbsp; =
&nbsp; &nbsp;AfxMessageBox( err.GetDescription() );<BR>=0A&nbsp; &nbsp; &nb=
sp;return false;<BR>=0A} <BR>=0A<BR>=0A <BR>=0A<BR>=0A<BR>=0APlease help me=
 in solving the problem.I had very urgent requirement for this.<BR>=0A<BR>=
=0AThanking you<BR>=0ARegards,<BR>=0ASriValli.<BR>=0A<BR>=0A=0A</P>=0A<br><=
br>=0A<A target=3D"_blank" HREF=3D"http://clients.rediff.com/signature/trac=
k_sig.asp"><IMG SRC=3D"http://ads.rediff.com/RealMedia/ads/adstream_nx.cgi/=
www.rediffmail.com/inbox.htm at Bottom" BORDER=3D0 VSPACE=3D0 HSPACE=3D0 HEIGH=
T=3D74 WIDTH=3D496></a>=0A
--Next_1073996706---0-202.54.124.152-18687
Content-type: text/plain;
	charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

=0A Dear Mr.Luis,=0A=0A          I am working on the registration applicati=
on. My application is failing at the StartRegistration() function. When I t=
race the code i found that it is failing at the metric initialization.=0A=
=0AIn MattesMutualinformation class at the following line:=0A=0ABSplineInte=
rpolatorType * testPtr =3D dynamic_cast<BSplineInterpolatorType *>(=0A    m=
_Interpolator.GetPointer() );=0A=0AEnclosing the code:=0Atypedef   float   =
 InternalPixelType;=0Atypedef itk::CenteredAffineTransform< double, Dimensi=
on > TransformType;=0Atypedef itk::RegularStepGradientDescentOptimizer     =
  OptimizerType;=0Atypedef itk::MattesMutualInformationImageToImageMetric< =
		  InternalImageType, InternalImageType >    MetricType;=0Atypedef itk:: L=
inearInterpolateImageFunction< InternalImageType,=0A			double>    Interpola=
torType;	typedef itk::ImageRegistrationMethod< InternalImageType, InternalI=
mageType >   RegistrationType;=0Atypedef itk::CenteredTransformInitializer<=
 TransformType,           FixedImageType,MovingImageType >  TransformInitia=
lizerType;=0A=0AInterpolatorType::Pointer   interpolator  =3D InterpolatorT=
ype::New();=0Ainterpolator->SetInputImage( movingCaster->GetOutput());=0Are=
gistration->SetInterpolator(  interpolator  );=0A=0AMetricType::Pointer    =
     metric        =3D MetricType::New();=0Ametric->SetNumberOfHistogramBin=
s(  50);=0Ametric->SetNumberOfSpatialSamples(1000 );=0Aregistration->SetMet=
ric(        metric        );=0A=0Atypedef OptimizerType::ScalesType       O=
ptimizerScalesType;=0AOptimizerType::Pointer      optimizer     =3D Optimiz=
erType::New();=0AOptimizerScalesType optimizerScales( NoofParams );=0Aconst=
 double translationScale =3D 1.0 / 1000000;=0Afor( int i =3D 0; i <=3D 8; i=
++ )=0A	optimizerScales[ i ] =3D  1.0 / 1.0;//m_scales;=0AoptimizerScales[ =
9 ]  =3D  translationScale;=0AoptimizerScales[ 10 ] =3D  translationScale;=
=0AoptimizerScales[ 11 ] =3D  translationScale;=0AoptimizerScales[ 12 ] =3D=
  translationScale;=0AoptimizerScales[ 13 ] =3D  translationScale;=0Aoptimi=
zerScales[ 14 ] =3D  translationScale;=0Aoptimizer->SetScales( optimizerSca=
les );=0Aoptimizer->SetMaximumStepLength( 4); =0Aoptimizer->SetMinimumStepL=
ength( 0.001 );=0Aoptimizer->SetNumberOfIterations( 100 ); =0Aoptimizer->Se=
tMinimize( TRUE );	=0Aregistration->SetOptimizer(     optimizer     );=0A=
=0ATransformType::Pointer      transform     =3D TransformType::New();=0Atr=
ansform->SetIdentity();=0ANoofParams =3D transform->GetNumberOfParameters()=
;=0Aregistration->SetInitialTransformParameters( transform->GetParameters()=
 );=0Aregistration->SetTransform(     transform     );=0A=0Atry =0A{ =0A	re=
gistration->StartRegistration(); =0A} =0Acatch( itk::ExceptionObject & err =
) =0A{ =0A	AfxMessageBox( err.GetDescription() );=0A	return false;=0A} =0A=
=0A =0A=0A=0APlease help me in solving the problem.I had very urgent requir=
ement for this.=0A=0AThanking you=0ARegards,=0ASriValli.=0A=0A
--Next_1073996706---0-202.54.124.152-18687--