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: 'static_cast' : cannot convert from 'itk::CovariantVector<T,NVectorDimension>' to 'float'<br><br>Thanks a lot!<br>Cheers,<br>Melanie<br><br><br>class ThresholdVectorPixelAccessor <br>
{<br>public:<br> typedef itk::CovariantVector<float,3> InternalType;<br> typedef float InternalPixelType;<br> typedef itk::CovariantVector<float,3> ExternalType;<br><br> void operator=( const ThresholdVectorPixelAccessor & vpa )<br>
{<br> m_Index = vpa.m_Index;<br> }<br> ExternalType Get( const InternalType & input ) const <br> {<br> if(static_cast<InternalPixelType>( input[ m_Index ] ) < 0)<br> {<br> ExternalType empty;<br>
for(int i = 0; i < 3; i++)<br> empty[i]=0;<br> return empty;<br> }<br> else<br> return static_cast<ExternalType>( 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>