<br>Hi Mike,<br><br>The type used by the Metric for the array of transform parameters<br>is ultimately an itk::Array<double>.<br><br>You will find it in:<br><br>Insight/Code/Common/itkTransformBase.h line 49<br><br>
/** Type of the input parameters. */<br> typedef Array< double > ParametersType;<br><br><br>The code of the itkArray itself does not have assertions,<br>nor error checking when accessing the elements with<br>
the operator[].<br><br>The itkArray derives from the vnl_vector, which indeed<br>has some of these assertions, but they are in the <br><br> operator() method,<br><br>not in the <br><br> operator[] method.<br><br>Therefore, you will have error checking if you use<br>
<br> metricParams(3) = 56;<br><br>but not if you use<br><br> metricParams[3] = 56;<br>
<br><br>--<br><br><br> Regards,<br><br><br> Luis<br><br><br>-------------------------------------------------------------------------------------------------------------<br><div class="gmail_quote">On Sat, Jun 6, 2009 at 9:33 AM, Mike Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">While running some code I kept getting some asserts from the HDF5<br>
library that I am using when my program exited. Turns out that I had<br>
something like this in my own code:<br>
<br>
<br>
<br>
namespace R3D<br>
{<br>
namespace Detail<br>
{<br>
const unsigned int Dimension = 2;<br>
}<br>
}<br>
<br>
typedef unsigned char PixelType;<br>
typedef itk::Image<PixelType, R3D::Detail::Dimension><br>
ImageType;<br>
typedef itk::MeanSquaresImageToImageMetric< ImageType, ImageType ><br>
MetricType;<br>
MetricType::TransformParametersType metricParams(R3D::Detail::Dimension);<br>
<br>
<br>
metricParams[0] = scale;<br>
metricParams[1] = 0.0;<br>
metricParams[2] = 0.0;<br>
metricParams[3] = 0.0;<br>
<br>
Turns out there are only 2 parameters for the metricParams array and<br>
so I guess I was walking off the end of then array and assigning data<br>
to memory locations in the HDF5 library area.<br>
<br>
Turns out I was using the non-boundary checking version of those<br>
calls. I should have been doing something like:<br>
metricParams(2) = 0.0;<br>
metricParams.put(2, 0.0);<br>
<br>
So I tried those fully expecting an assert to happen by my code<br>
completes successfully now. I compiled ITK in debug mode along with my<br>
code. Is there something else that needs to be done in order to enable<br>
these asserts or boundary checking? I am still new to ITK and so I<br>
would like to have the safety net.<br>
<br>
Thanks<br>
Mike Jackson<br>
_____________________________________<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>
Please keep messages on-topic and check the ITK FAQ at: <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>
</blockquote></div><br>