Hi all,<br>      I come with another problem with the same code as earlier:<br><br>// some preamble code<br><br>// I declare a registration type through:<br><br>printf(&quot;1\n&quot;);<br><br>typedef itk::ImageRegistrationMethod&lt;BFrameType, BFrameType&gt; RegistrationType;<br>
RegistrationType::Pointer registration = RegistrationType::New(); <br><br>printf(&quot;2\n&quot;);<br><br>//Then I associate various things to it<br><br>registration-&gt;SetFixedImage(  ref ) ; <br>    registration-&gt;SetMovingImage( flt );<br>
<br>    registration-&gt;SetOptimizer( optimizer );<br>    registration-&gt;SetTransform( transform );<br>    registration-&gt;SetInterpolator (interpolator ); <br>    registration-&gt;SetMetric( metric ); <br><br>// rest of the code<br>
<br><br>After compiling (MSVC2010, Release mode), and running the application, I get the following error:<br><br> <b>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</b><br>
Using the &quot;printf&quot; method of debugging, I can see that it prints 1, but not 2 above, implying that the creation of the smart pointer is throwing<br>the exception? <br><br>Curiously, the application runs to completion in the Debug mode. I am using the appropriate Itk libs as per configuration (Debug, Release).<br>
What could be going on here? <br><br>Thanks as always,<br>Sid. <br><br><div class="gmail_quote">On Fri, Nov 4, 2011 at 9:54 AM, Siddharth Srivastava <span dir="ltr">&lt;<a href="mailto:siddys@gmail.com">siddys@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;">Hi Cagatay,<br>      I sort of realised my error late last night! Thanks for the response. <br>sid.<div><div></div><div class="h5">
<br><br><div class="gmail_quote">On Fri, Nov 4, 2011 at 12:58 AM, cagatay bilgin <span dir="ltr">&lt;<a href="mailto:bilgincc@gmail.com" target="_blank">bilgincc@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">Hi Siddharth, <br><br>Try changing unsigned char to double here<div><br>typedef itk::AffineTransform&lt;unsigned char, 2&gt; TransformType;<br>

<br></div>From <a href="http://www.itk.org/Doxygen/html/classitk_1_1AffineTransform.html" target="_blank">http://www.itk.org/Doxygen/html/classitk_1_1AffineTransform.html</a><br>
&quot;There are two template parameters for this class:<p>ScalarT The type to be used for scalar numeric values. Either float or double.&quot;</p>Regards, <br>Cagatay <br><br><div class="gmail_quote"><div><div></div><div>

On Thu, Nov 3, 2011 at 1:58 PM, Siddharth Srivastava <span dir="ltr">&lt;<a href="mailto:siddys@gmail.com" target="_blank">siddys@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div>Hi ITK users,<br>     <br>      I am trying to implement, following the example given in the ITK guide, an affine registration<br>


routine. Somewhere at the top of the code, I set<br><br>    typedef itk::AffineTransform&lt;unsigned char, 2&gt; TransformType;<br>
    typedef itk::RegularStepGradientDescentOptimizer OptimizerType;<br>    typedef itk::LinearInterpolateImageFunction&lt; BFrameType, double &gt; InterpolatorType;<br>    typedef itk::MeanSquaresImageToImageMetric&lt; BFrameType, BFrameType &gt; MetricType;<br>



    typedef itk::ImageRegistrationMethod&lt;BFrameType, BFrameType&gt; RegistrationType;<br><br>// then I create the necessary smart pointers to objects<br><br>    TransformType::Pointer transform = TransformType::New();<br>



    OptimizerType::Pointer optimizer = OptimizerType::New();<br>    InterpolatorType::Pointer interpolator = InterpolatorType::New();<br>    RegistrationType::Pointer registration = RegistrationType::New();<br>    MetricType::Pointer metric = MetricType::New();<br>



<br>// and then I associate them to the registration filter:<br>     registration-&gt;SetOptimizer( optimizer );<br>    registration-&gt;SetTransform( transform ); // <b>error on this line</b><br>    registration-&gt;SetInterpolator (interpolator ); <br>



    registration-&gt;SetMetric( metric ); <br><br>// including the reference and floating images<br><br>    registration-&gt;SetFixedImage(  ref ) ; <br>    registration-&gt;SetMovingImage( flt );<br><br>during the build (on MS Visual studio 2010) I get the following error:<br>



<br>Error    12    error C2664: &#39;itk::ImageRegistrationMethod&lt;TFixedImage,TMovingImage&gt;::SetTransform&#39; : cannot convert parameter 1 from &#39;itk::SmartPointer&lt;TObjectType&gt;&#39; to &#39;itk::Transform&lt;TScalarType,NInputDimensions,NOutputDimensions&gt; *&#39;    <br>



<br>Can anyone help with useful insights? <br><br>Thanks,<br>Sid.<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.html" target="_blank">http://www.kitware.com/products/protraining.html</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></blockquote></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>