Hi all,<br><br>I wanted to write a threshold accessor for vector pixels. I wanted to give back a zero vector if one of the vector components, specified by the index, is smaller than zero. Otherwise I wanted to give back the original vector. I never worked with accessors but I checked the SoftwareGuide. So far I could start a (non-working) example for this (see below). Can anybody tell me if this is the right way to do such a thresholding with ITK and if yes how to correct my example. At the moment I become the following error:<br>
error C2440: &#39;static_cast&#39; : cannot convert from &#39;itk::CovariantVector&lt;T,NVectorDimension&gt;&#39; to &#39;float&#39;<br><br>Thanks a lot!<br>Cheers,<br>Melanie<br><br><br>class ThresholdVectorPixelAccessor  <br>
{<br>public:<br>  typedef itk::CovariantVector&lt;float,3&gt;   InternalType;<br>  typedef                      float      InternalPixelType;<br>  typedef itk::CovariantVector&lt;float,3&gt;   ExternalType;<br><br>  void operator=( const ThresholdVectorPixelAccessor &amp; vpa )<br>
    {<br>      m_Index = vpa.m_Index;<br>    }<br>  ExternalType Get( const InternalType &amp; input ) const <br>    {<br>    if(static_cast&lt;InternalPixelType&gt;( input[ m_Index ] ) &lt; 0)<br>      {<br>          ExternalType empty;<br>
          for(int i = 0; i &lt; 3; i++)<br>              empty[i]=0;<br>          return empty;<br>      }<br>    else<br>        return static_cast&lt;ExternalType&gt;( input);<br>    }<br>  void SetIndex( unsigned int index )<br>
    {<br>    m_Index = index;<br>    }<br>private:<br>  unsigned int m_Index;<br>};<br><br><br>