Hey David, see email chain below for a possible solution to your problem.<br><div><br></div><div>On Fri, Mar 11, 2011 at 11:36 AM, brian avants <span dir="ltr"><<a href="mailto:stnava@gmail.com">stnava@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
jim<br><br>adding<br><br> static const Self ZeroValue()<br> {<br> return Self(NumericTraits< T >::Zero);<br> }<br><br>to Common/itkNumericTraitsVariableLengthVectorPixel.h<br><br>did the trick. thanks!<br><br>should this go to gerrit?<br>
<font color="#888888"><br>brian<br></font><div><div></div><div class="h5"><br><br><br><br>On Fri, Mar 11, 2011 at 10:22 AM, Jim Miller <<a href="mailto:millerjv@ge.com">millerjv@ge.com</a>> wrote:<br>> Brian,<br>
> There is a ZeroValue() function in NumericTraits. Can you utilize that?<br>> Jim<br>> On Mar 11, 2011, at 9:05 AM, brian avants wrote:<br>><br>> hi everyone<br>><br>> i'm putting together a registration metric for VectorImages and the<br>
> code reuse from the scalar image metric is very high. which is great.<br>> except there is a small hang up with the<br>> LinearInterpolateImageFunction.<br>><br>> i am defining:<br>><br>> typedef itk::VectorImage< float,ImageDimension > ImageType;<br>
><br>> and<br>><br>> typedef LinearInterpolateImageFunction< FixedImageType,<br>> CoordinateRepresentationType > FixedInterpolatorType;<br>><br>> relevant code from that function is:<br>><br>
> /**<br>> * Interpolated value is the weighted sum of each of the surrounding<br>> * neighbors. The weight for each neighbor is the fraction overlap<br>> * of the neighbor pixel with respect to a pixel centered on point.<br>
> */<br>> RealType value= NumericTraits< RealType >::Zero;<br>><br>> so, if i compile with the original code in place, i get this error :<br>><br>> itkLinearInterpolateImageFunction.txx:89: error: invalid conversion<br>
> from ‘const itk::VariableLengthVector<double> (*)(const<br>> itk::VariableLengthVector<double>&)’ to ‘unsigned int’<br>> /Users/brianavants/code/ITKv4/ITK/Code/Common/itkLinearInterpolateImageFunction.txx:89:<br>
> error: initializing argument 1 of<br>> ‘itk::VariableLengthVector<TValueType>::VariableLengthVector(unsigned<br>> int) [with TValueType = double]’<br>><br>> the Zero function is defined in<br>> Common/itkNumericTraitsVariableLengthVectorPixel.h<br>
><br>> if i replace<br>><br>> RealType value= NumericTraits< RealType >::Zero;<br>><br>> with<br>><br>> RealType value; value.Fill(0);<br>><br>> then all is well for the VectorImage case but this does not work<br>
> (obviously) in the scalar image case. so, it's this one line / one<br>> definition that is causing the hang up. i am hoping someone with more<br>> familiarity with NumericTraits might point me to the right solution<br>
> i.e. the solution that would let me use the<br>> LinearInterpolateImageFunction in this context.<br>><br>> for reference, the variable length vector Zero implementation:<br>><br>> static const Self Zero(const Self & a)<br>
> {<br>> Self b( a.Size() );<br>> b.Fill(NumericTraits< T >::Zero);<br>> return b;<br>> }<br>><br>> from Common/itkNumericTraitsVariableLengthVectorPixel.h .... any help<br>> is appreciated.<br>
><br>> brian<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>> Kitware offers ITK Training Courses, for more information visit:<br>> <a href="http://kitware.com/products/protraining.html" target="_blank">http://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-developers" target="_blank">http://www.itk.org/mailman/listinfo/insight-developers</a><br>><br>> Jim Miller<br>> Senior Scientist<br>> GE Research<br>> Interventional and Therapy<br>
> GE imagination at work<br>><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>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://kitware.com/products/protraining.html" target="_blank">http://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-developers" target="_blank">http://www.itk.org/mailman/listinfo/insight-developers</a></div>
</div></blockquote><div><br></div><div><br></div></div>