[Insight-users] Building Unit Vector Field
    Abayiz 
    abayiz at yahoo.com
       
    Thu May 17 15:22:19 EDT 2012
    
    
  
Hello,
I am trying to build a unit vector field, my code is as follows:
************************************
  typedef itk::Vector<float, Dimension >                         VectorType;
  typedef itk::Image<VectorType,Dimension>                        VectorImageType;
  typedef itk::ImageRegionConstIterator< VectorImageType >                 NeighborhoodIterator;
  VectorImageType::Pointer image = VectorImageType::New();
  image->SetRegions(vec_region);
  image->SetSpacing(vec_spacing_image);
  image->SetOrigin(vector_origin_image);
  image->SetDirection(vec_direction_image);
  image->SetNumberOfComponentsPerPixel(3);
  image->Allocate(); 
  VectorImageType::IndexType vec_start;
  vec_start[0] =   0;
  vec_start[1] =   0;
  vec_start[2] =   0;
  typedef itk::VariableLengthVector<double> VariableVectorType;
  VariableVectorType variableLengthVector;
  variableLengthVector.SetSize(2);
  variableLengthVector[0] = 1.0;
  variableLengthVector[1] = 0.0;
  variableLengthVector[2] = 0.0;
  NeighborhoodIterator vec_it(image, image->GetLargestPossibleRegion());
  for (vec_it_i.GoToBegin();  !vec_it_i.IsAtEnd();  ++vec_it_i)
  {
   image->SetPixel(vec_start, variableLengthVector); 
  }
************************************
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?
Thanks in advance. 
Regards
Abayiz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120517/bc522529/attachment.htm>
    
    
More information about the Insight-users
mailing list