<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hello,</div><div><br></div><div>I am trying to build a unit vector field, my code is as follows:</div><div><br></div><div>************************************</div><div>&nbsp; typedef itk::Vector&lt;float, Dimension &gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; VectorType;<br></div><div>&nbsp; typedef itk::Image&lt;VectorType,Dimension&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; VectorImageType;</div><div>&nbsp; typedef itk::ImageRegionConstIterator&lt; VectorImageType &gt; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NeighborhoodIterator;<br></div><div><br></div><div>&nbsp; VectorImageType::Pointer image = VectorImageType::New();<br>&nbsp;
 image-&gt;SetRegions(vec_region);<br>&nbsp; image-&gt;SetSpacing(vec_spacing_image);<br>&nbsp; image-&gt;SetOrigin(vector_origin_image);<br>&nbsp; image-&gt;SetDirection(vec_direction_image);<br>&nbsp; image-&gt;SetNumberOfComponentsPerPixel(3);<br>&nbsp; image-&gt;Allocate();&nbsp;</div><div><br></div><div>&nbsp; VectorImageType::IndexType vec_start;<br>&nbsp; vec_start[0] =&nbsp;&nbsp; 0;<br>&nbsp; vec_start[1] =&nbsp;&nbsp; 0;<br>&nbsp; vec_start[2] =&nbsp;&nbsp; 0;<br></div><div><br></div><div>&nbsp; typedef itk::VariableLengthVector&lt;double&gt; VariableVectorType;<br>&nbsp; VariableVectorType variableLengthVector;<br>&nbsp; variableLengthVector.SetSize(2);<br>&nbsp; variableLengthVector[0] = 1.0;<br>&nbsp; variableLengthVector[1] = 0.0;<br>&nbsp; variableLengthVector[2] = 0.0;</div><div><br></div><div>&nbsp; NeighborhoodIterator vec_it(image, image-&gt;GetLargestPossibleRegion());<br><br>&nbsp; for (vec_it_i.GoToBegin();&nbsp;
 !vec_it_i.IsAtEnd();&nbsp; ++vec_it_i)<br>&nbsp; {<br><br>&nbsp;&nbsp; image-&gt;SetPixel(vec_start, variableLengthVector); <br><br>&nbsp; }</div><div><br></div><div>************************************<br></div><div>Then I got an error, saying that "image" does not have a function for "SetPixel". Is there some one can help me?? How should I build a unit vector?<br></div><div>Thanks in advance. <br></div><div><br></div><div>Regards</div><div>Abayiz<br></div><div><br></div><div></div></div></body></html>