Hello all,<br><br>I am trying to modify the deformable registration metric to take a mask-file as an input region:<br><br>// begin code snippet<br><br>typedef itk::ImageMaskSpatialObject< Dimension > MaskType;<br><br>
MaskType::Pointer spatialObjectMask = MaskType::New();<br><br> typedef itk::Image< unsigned char, Dimension > ImageMaskType;<br><br> typedef itk::ImageFileReader< ImageMaskType > MaskReaderType;<br><br>
MaskReaderType::Pointer maskReader = MaskReaderType::New();<br><br> maskReader->SetFileName( argv[3] );<br><br> try <br> { <br> maskReader->Update(); <br> } <br> catch( itk::ExceptionObject & err ) <br>
{ <br> std::cerr << "ExceptionObject caught !" << std::endl; <br> std::cerr << err << std::endl; <br> return EXIT_FAILURE;<br> } <br><br> spatialObjectMask->SetImage( maskReader->GetOutput() );<br>
<br> metric->SetFixedImageMask( spatialObjectMask );<br><br>// end code snippet<br><br>In the original deformableregistration15 code, these are the only following references to 'metric'<br><br>/////////<br>MetricType::Pointer metric = MetricType::New();<br>
<br>registration->SetMetric( metric );<br><br>metric->SetNumberOfHistogramBins( 50 );<br><br>metric->ReinitializeSeed( 76926294 );<br><br>metric->SetNumberOfSpatialSamples( 10000L ); /// for rigid registration<br>
<br>metric->SetNumberOfSpatialSamples( 50000L ); /// for affine registration<br><br>metric->SetNumberOfSpatialSamples( numberOfBSplineParameters * 100 ); /// for coarse b-spline reg.<br><br>const unsigned long numberOfSamples = <br>
static_cast<unsigned long>(<br> vcl_sqrt( static_cast<double>( numberOfBSplineParameters ) *<br> static_cast<double>( numberOfPixels ) ) );<br> metric->SetNumberOfSpatialSamples( numberOfSamples ); /// for fine b-spline reg.<br>
<br>////////<br><br>I hope this clearly outlines the problem.. I'm a relatively new ITK users and I'm still grappling with making small-ish changes to the pre-assembled algorithms.<br><br>Any help is much appreciated,<br>
<br><br clear="all"><br>-- <br>Tim Bhatnagar<br>PhD Candidate<br>Orthopaedic Injury Biomechanics Group<br>Department of Mechanical Engineering<br>University of British Columbia<br><br>Rm 5000 - 818 West 10th Ave.<br>Vancouver, BC<br>
Canada<br>V5Z 1M9<br><br>Ph: <a href="tel:%28604%29%20675-8845" value="+16046758845" target="_blank">(604) 675-8845</a><br>Fax: <a href="tel:%28604%29%20675-8820" value="+16046758820" target="_blank">(604) 675-8820</a><br>
Web: <a href="http://oibg.mech.ubc.ca" target="_blank">oibg.mech.ubc.ca</a><br><br>