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">&lt;<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>&gt;</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">&lt;<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>&gt;</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 &lt;<a href="mailto:tim.bhatnagar@gmail.com" target="_blank">tim.bhatnagar@gmail.com</a>&gt; wrote:<br>
&gt; Hello all,<br>
&gt;<br>
&gt; I am trying to modify the deformable registration metric to take a mask-file<br>
&gt; as an input region:<br>
&gt;<br>
&gt; // begin code snippet<br>
&gt;<br>
&gt; typedef itk::ImageMaskSpatialObject&lt; Dimension &gt;   MaskType;<br>
&gt;<br>
&gt;   MaskType::Pointer  spatialObjectMask = MaskType::New();<br>
&gt;<br>
&gt;   typedef itk::Image&lt; unsigned char, Dimension &gt;   ImageMaskType;<br>
&gt;<br>
&gt;   typedef itk::ImageFileReader&lt; ImageMaskType &gt;    MaskReaderType;<br>
&gt;<br>
&gt;   MaskReaderType::Pointer  maskReader = MaskReaderType::New();<br>
&gt;<br>
&gt;   maskReader-&gt;SetFileName( argv[3] );<br>
&gt;<br>
&gt;   try<br>
&gt;     {<br>
&gt;     maskReader-&gt;Update();<br>
&gt;     }<br>
&gt;   catch( itk::ExceptionObject &amp; err )<br>
&gt;     {<br>
&gt;     std::cerr &lt;&lt; &quot;ExceptionObject caught !&quot; &lt;&lt; std::endl;<br>
&gt;     std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>
&gt;     return EXIT_FAILURE;<br>
&gt;     }<br>
&gt;<br>
&gt;   spatialObjectMask-&gt;SetImage( maskReader-&gt;GetOutput() );<br>
&gt;<br>
&gt;   metric-&gt;SetFixedImageMask( spatialObjectMask );<br>
&gt;<br>
&gt; // end code snippet<br>
&gt;<br>
&gt; In the original deformableregistration15 code, these are the only following<br>
&gt; references to &#39;metric&#39;<br>
&gt;<br>
&gt; /////////<br>
&gt; MetricType::Pointer         metric        = MetricType::New();<br>
&gt;<br>
&gt; registration-&gt;SetMetric(        metric        );<br>
&gt;<br>
&gt; metric-&gt;SetNumberOfHistogramBins( 50 );<br>
&gt;<br>
&gt; metric-&gt;ReinitializeSeed( 76926294 );<br>
&gt;<br>
&gt; metric-&gt;SetNumberOfSpatialSamples( 10000L ); /// for rigid registration<br>
&gt;<br>
&gt; metric-&gt;SetNumberOfSpatialSamples( 50000L ); /// for affine registration<br>
&gt;<br>
&gt; metric-&gt;SetNumberOfSpatialSamples( numberOfBSplineParameters * 100 ); ///<br>
&gt; for coarse b-spline reg.<br>
&gt;<br>
&gt; const unsigned long numberOfSamples =<br>
&gt;      static_cast&lt;unsigned long&gt;(<br>
&gt;        vcl_sqrt( static_cast&lt;double&gt;( numberOfBSplineParameters ) *<br>
&gt;                  static_cast&lt;double&gt;( numberOfPixels ) ) );<br>
&gt;   metric-&gt;SetNumberOfSpatialSamples( numberOfSamples ); /// for fine<br>
&gt; b-spline reg.<br>
&gt;<br>
&gt; ////////<br>
&gt;<br>
&gt; I hope this clearly outlines the problem.. I&#39;m a relatively new ITK users<br>
&gt; and I&#39;m still grappling with making small-ish changes to the pre-assembled<br>
&gt; algorithms.<br>
&gt;<br>
&gt; Any help is much appreciated,<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Tim Bhatnagar<br>
&gt; PhD Candidate<br>
&gt; Orthopaedic Injury Biomechanics Group<br>
&gt; Department of Mechanical Engineering<br>
&gt; University of British Columbia<br>
&gt;<br>
&gt; Rm 5000 - 818 West 10th Ave.<br>
&gt; Vancouver, BC<br>
&gt; Canada<br>
&gt; V5Z 1M9<br>
&gt;<br>
&gt; Ph: <a href="tel:%28604%29%20675-8845" value="+16046758845" target="_blank">(604) 675-8845</a><br>
&gt; Fax: <a href="tel:%28604%29%20675-8820" value="+16046758820" target="_blank">(604) 675-8820</a><br>
&gt; Web: <a href="http://oibg.mech.ubc.ca" target="_blank">oibg.mech.ubc.ca</a><br>
&gt;<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<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>