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">&lt;<a href="mailto:stnava@gmail.com">stnava@gmail.com</a>&gt;</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&lt; T &gt;::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 &lt;<a href="mailto:millerjv@ge.com">millerjv@ge.com</a>&gt; wrote:<br>&gt; Brian,<br>
&gt; There is a ZeroValue() function in NumericTraits.  Can you utilize that?<br>&gt; Jim<br>&gt; On Mar 11, 2011, at 9:05 AM, brian avants wrote:<br>&gt;<br>&gt; hi everyone<br>&gt;<br>&gt; i&#39;m putting together a registration metric for VectorImages and the<br>
&gt; code reuse from the scalar image metric is very high.  which is great.<br>&gt;  except there is a small hang up with the<br>&gt; LinearInterpolateImageFunction.<br>&gt;<br>&gt; i am defining:<br>&gt;<br>&gt;  typedef itk::VectorImage&lt; float,ImageDimension &gt; ImageType;<br>
&gt;<br>&gt; and<br>&gt;<br>&gt;  typedef LinearInterpolateImageFunction&lt; FixedImageType,<br>&gt; CoordinateRepresentationType &gt; FixedInterpolatorType;<br>&gt;<br>&gt; relevant code from that function is:<br>&gt;<br>
&gt;  /**<br>&gt;   * Interpolated value is the weighted sum of each of the surrounding<br>&gt;   * neighbors. The weight for each neighbor is the fraction overlap<br>&gt;   * of the neighbor pixel with respect to a pixel centered on point.<br>
&gt;   */<br>&gt; RealType value= NumericTraits&lt; RealType &gt;::Zero;<br>&gt;<br>&gt; so, if i compile with the original code in place, i get this error :<br>&gt;<br>&gt; itkLinearInterpolateImageFunction.txx:89: error: invalid conversion<br>
&gt; from ‘const itk::VariableLengthVector&lt;double&gt; (*)(const<br>&gt; itk::VariableLengthVector&lt;double&gt;&amp;)’ to ‘unsigned int’<br>&gt; /Users/brianavants/code/ITKv4/ITK/Code/Common/itkLinearInterpolateImageFunction.txx:89:<br>
&gt; error:   initializing argument 1 of<br>&gt; ‘itk::VariableLengthVector&lt;TValueType&gt;::VariableLengthVector(unsigned<br>&gt; int) [with TValueType = double]’<br>&gt;<br>&gt; the Zero function is defined in<br>&gt; Common/itkNumericTraitsVariableLengthVectorPixel.h<br>
&gt;<br>&gt; if i replace<br>&gt;<br>&gt;  RealType value= NumericTraits&lt; RealType &gt;::Zero;<br>&gt;<br>&gt; with<br>&gt;<br>&gt;  RealType value; value.Fill(0);<br>&gt;<br>&gt; then all is well for the VectorImage case but this does not work<br>
&gt; (obviously) in the scalar image case.   so, it&#39;s this one line / one<br>&gt; definition that is causing the hang up.  i am hoping someone with more<br>&gt; familiarity with NumericTraits might point me to the right solution<br>
&gt; i.e. the solution that would let me use the<br>&gt; LinearInterpolateImageFunction in this context.<br>&gt;<br>&gt; for reference, the variable length vector Zero implementation:<br>&gt;<br>&gt;  static const Self Zero(const Self  &amp; a)<br>
&gt;  {<br>&gt;    Self b( a.Size() );<br>&gt;    b.Fill(NumericTraits&lt; T &gt;::Zero);<br>&gt;    return b;<br>&gt;  }<br>&gt;<br>&gt; from Common/itkNumericTraitsVariableLengthVectorPixel.h .... any help<br>&gt; is appreciated.<br>
&gt;<br>&gt; brian<br>&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://kitware.com/products/protraining.html" target="_blank">http://kitware.com/products/protraining.html</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-developers" target="_blank">http://www.itk.org/mailman/listinfo/insight-developers</a><br>&gt;<br>&gt; Jim Miller<br>&gt; Senior Scientist<br>&gt; GE Research<br>&gt; Interventional and Therapy<br>
&gt; GE imagination at work<br>&gt;<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>