I think I may have found my issue... the original DeformableRegistration15 code uses MattesMutualInformationImageToImagemetric, whereas the file that I lifted the mask snippet from used ImageToImageMetric instead, which supports a number of the metric-functions I called.<br>
<br>Rather than hacking/splicing the code together, would anyone be able to tell me if it is possible to pass a FixedImageRegion that is a result of a SpatialObjectMask, while using a MattesMutualInformationImageToImage metric?<br>
<br>Thanks,<br><br>Tim<br>
<br><div class="gmail_quote">On Tue, Mar 20, 2012 at 10:06 AM, Tim Bhatnagar <span dir="ltr"><<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
My apologies..<br><br>It is a VS window that pops up with the following message:<br><br>///<br>Debug Assertion Failed!<br><br>Program: Deformable Registration<br>File: f:\dd\vctools\crt_bld\self_x86\crt\src\strtol.c<br>Line: 94<br>
<br>Expression: nptr != NULL<br><br>///<br><br>I am not even sure if this error is specific to VS, or what assignments I am making in my modified code that would yield a successful debug-build, but yield a runtime assertion error?<br>
<br>Thanks again,<br><font color="#888888"><br>Tim</font><div><div></div><div><br><br><br><br><div class="gmail_quote">On Tue, Mar 20, 2012 at 10:00 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What error message do you see?<br>
<div><div></div><div><br>
On Tue, Mar 20, 2012 at 9:28 AM, Tim Bhatnagar <<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>> wrote:<br>
> Hello all,<br>
><br>
> I am trying to modify the deformable registration metric to take a mask-file<br>
> 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<br>
> 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 ); ///<br>
> 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<br>
> b-spline reg.<br>
><br>
> ////////<br>
><br>
> I hope this clearly outlines the problem.. I'm a relatively new ITK users<br>
> and I'm still grappling with making small-ish changes to the pre-assembled<br>
> algorithms.<br>
><br>
> Any help is much appreciated,<br>
><br>
><br>
><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>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</font></blockquote></div><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>
</div></div></blockquote></div><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>