<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>hello,</DIV>
<DIV>is there a available source/documentation which is talking about PointSetToImageRegistration. As far as I checked it out ItkSoftwareGuide.pdf doesn't include enough knowledge about that topic. For example I haven't found out that how can I use last registration paremeters at the end of the registration process,and also there is no knowledge about 3D PointSetToImageRegistration. I tried to implement 3D PointSetToImageRegistration and It doesn't work. </DIV>
<DIV><STRONG><U>my inputs</U></STRONG>:</DIV>
<DIV>1-STL I converted it itkmesh form then itk pointset</DIV>
<DIV>2-raw image which is <FONT size=2>DimSize = 329 527 181 and <FONT size=2>resolution = 0.200068 0.200068 0.200068 and 60 MB</FONT></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>here is my code ,Could someone ,who is expert on pointsettoimageregistration pocesss, checked out my code?</DIV>
<DIV> </DIV>
<DIV><FONT color=#008000 size=2>
<P>// Registration part</P>
<P><FONT color=#ff0000 size=3><STRONG>// Here I have itk mesh and I convert it to pointset</STRONG></FONT></P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> Dimension = 3;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>short</FONT><FONT size=2> PixelType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::PointSet< </FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2>, Dimension > FixedPointSetType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::Image< PixelType, Dimension > MovingImageType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> FixedPointSetType::PointsContainer PointsContainer;</P>
<P>PointsContainer::Pointer pointsContainer = PointsContainer::New();</P>
<P>pointsContainer = input_mesh->GetPoints();</P>
<P>itk::PointSet<</FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2>, 3>::Pointer pointSet = itk::PointSet<</FONT><FONT color=#0000ff size=2>float</FONT><FONT size=2>,3>::New();</P>
<P>pointSet->SetPoints(pointsContainer);</P>
<P></FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>long</FONT><FONT size=2> pointId = 0;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> FMeshType::PointsContainer::Iterator PointsIterator;</P>
<P></FONT><FONT color=#008000 size=2>//itk::PointSet<float, 3>::Pointer pointSet = itk::PointSet<float,3>::New();</P></FONT><FONT size=2>
<P>PointsIterator pointIterator = input_mesh->GetPoints()->Begin(); </P>
<P>PointsIterator end = input_mesh->GetPoints()->End();</P>
<P></FONT><FONT color=#0000ff size=2>while</FONT><FONT size=2>( pointIterator != end ) </P>
<P>{</P>
<P>FMeshType::PointType p = pointIterator.Value(); </FONT><FONT color=#008000 size=2>// access the point</P></FONT><FONT size=2>
<P>std::cout << p << std::endl; </FONT><FONT color=#008000 size=2>// print the point</P></FONT><FONT size=2>
<P>pointSet->SetPoint( pointId, p );</FONT><FONT color=#008000 size=2>// advance to next point</P></FONT><FONT size=2>
<P>pointSet->SetPointData( pointId, pointSet->GetBufferedRegion() );</P>
<P>++pointIterator; </P>
<P>++pointId;</P>
<P>}</P>
<P></P>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up a Transform</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::VersorRigid3DTransform< </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> > TransformType;</P>
<P>TransformType::Pointer transform = TransformType::New();</P>
<P></P>
<P></P>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Optimizer Type</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::<FONT color=#800000 size=2><FONT color=#000000>VersorRigid3DTransformOptimizer</FONT> </FONT> OptimizerType;</P>
<P>OptimizerType::Pointer optimizer = OptimizerType::New();</P>
<P> </P>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up an Interpolator</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::LinearInterpolateImageFunction< </P>
<P>MovingImageType,</P>
<P></FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> > InterpolatorType;</P>
<P>InterpolatorType::Pointer interpolator = InterpolatorType::New();</P>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up Metric</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::NormalizedCorrelationPointSetToImageMetric< </P>
<P>FixedPointSetType, </P>
<P>MovingImageType > MetricType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> MetricType::TransformType TransformBaseType;</P>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> TransformBaseType::ParametersType ParametersType;</P>
<P>MetricType::Pointer metric = MetricType::New();</P>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//RegistrationMethod</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//-----------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> itk::PointSetToImageRegistrationMethod< </P>
<P>FixedPointSetType,</P>
<P>MovingImageType > RegistrationType;</P>
<P>RegistrationType::Pointer registrationMethod = RegistrationType::New();</P></FONT><FONT color=#008000 size=2>
<P> </P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Scale the translation components of the Transform in the Optimizer</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>typedef</FONT><FONT size=2> OptimizerType::ScalesType OptimizerScalesType;</P>
<P>OptimizerScalesType optimizerScales( transform->GetNumberOfParameters() );</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> translationScale = 1.0 / 1000.0;</P>
<P>optimizerScales[0] = 1.0;</P>
<P>optimizerScales[1] = 1.0;</P>
<P>optimizerScales[2] = 1.0;</P>
<P>optimizerScales[3] = translationScale;</P>
<P>optimizerScales[4] = translationScale;</P>
<P>optimizerScales[5] = translationScale;</P>
<P>optimizer->SetMaximumStepLength( 1.00 );</P>
<P>optimizer->SetMinimumStepLength( 0.001 );</P>
<P>optimizer->SetNumberOfIterations( 500 );</P>
<P>optimizer->SetRelaxationFactor( 0.90 );</P>
<P>optimizer->SetGradientMagnitudeTolerance( 0.05 );</P>
<P>optimizer->MinimizeOn();</P>
<P> </P>
<P></FONT><FONT size=2> </P>
<P> </P>
<P></FONT><FONT color=#008000 size=2>// can probably provide a better guess than the identity...</P></FONT><FONT size=2>
<P>transform->SetIdentity();</P>
<P></P>
<P></P>
<P></P>
<P></P>
<P>registrationMethod->SetInitialTransformParameters( transform->GetParameters() );</P>
<P>RegistrationType::ParametersType initialParameters( </P>
<P>transform->GetNumberOfParameters() );</P>
<P>initialParameters.Fill( 0.0 );</P>
<P>initialParameters[3] = 1.0;</P>
<P> </P>
<P> </P>
<P></FONT><FONT color=#008000 size=2>// Connect all the components required for Registration</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------</P></FONT><FONT size=2>
<P>registrationMethod->SetMetric( metric );</P>
<P>registrationMethod->SetOptimizer( optimizer );</P>
<P>registrationMethod->SetFixedPointSet(pointSet);</P>
<P>registrationMethod->SetMovingImage(input);</P>
<P>registrationMethod->SetInterpolator(interpolator);</P>
<P>registrationMethod->SetTransform( transform );</P>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Set up transform parameters</P></FONT><FONT size=2>
<P></FONT><FONT color=#008000 size=2>//------------------------------------------------------------</P></FONT><FONT size=2>
<P>ParametersType parameters( transform->GetNumberOfParameters() );</P>
<P></FONT><FONT color=#008000 size=2>// initialize the offset/vector part</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>( </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> k = 0; k <Dimension; k++ )</P>
<P>{</P>
<P>parameters[k]= 0.0f;</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>try</FONT><FONT size=2> </P>
<P>{</P>
<P>registrationMethod->SetInitialTransformParameters( initialParameters );</P>
<P>registrationMethod->StartRegistration();</P>
<P>}</P>
<P></FONT><FONT color=#0000ff size=2>catch</FONT><FONT size=2>( itk::ExceptionObject & e )</P>
<P>{</P>
<P>std::cout << e << std::endl;</P>
<P>}</P>
<P> </P>
<P> </P>
<P>OptimizerType::ParametersType finalParameters =registrationMethod->GetLastTransformParameters();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>unsigned</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> nmbrOfIterations = optimizer->GetCurrentIteration();</P>
<P></FONT><FONT color=#0000ff size=2>const</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>double</FONT><FONT size=2> bestValue = optimizer->GetValue();</P></FONT></DIV></div><br>
<hr size=1>Ahhh...imagining that irresistible "new car" smell?<br> Check out
<a href="http://us.rd.yahoo.com/evt=48245/*http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE1YW1jcXJ2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3LWNhcnM-">new cars at Yahoo! Autos.</a>
</body></html>