<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> typedef itk::Vector<float, Dimension > VectorType;<br></div><div> typedef itk::Image<VectorType,Dimension> VectorImageType;</div><div> typedef itk::ImageRegionConstIterator< VectorImageType > NeighborhoodIterator;<br></div><div><br></div><div> VectorImageType::Pointer image = VectorImageType::New();<br>
image->SetRegions(vec_region);<br> image->SetSpacing(vec_spacing_image);<br> image->SetOrigin(vector_origin_image);<br> image->SetDirection(vec_direction_image);<br> image->SetNumberOfComponentsPerPixel(3);<br> image->Allocate(); </div><div><br></div><div> VectorImageType::IndexType vec_start;<br> vec_start[0] = 0;<br> vec_start[1] = 0;<br> vec_start[2] = 0;<br></div><div><br></div><div> typedef itk::VariableLengthVector<double> VariableVectorType;<br> VariableVectorType variableLengthVector;<br> variableLengthVector.SetSize(2);<br> variableLengthVector[0] = 1.0;<br> variableLengthVector[1] = 0.0;<br> variableLengthVector[2] = 0.0;</div><div><br></div><div> NeighborhoodIterator vec_it(image, image->GetLargestPossibleRegion());<br><br> for (vec_it_i.GoToBegin();
!vec_it_i.IsAtEnd(); ++vec_it_i)<br> {<br><br> image->SetPixel(vec_start, variableLengthVector); <br><br> }</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>