[vtkusers] TensorGlyph

Ariel Hernán Curiale curiale at gmail.com
Tue Nov 27 05:37:32 EST 2012


Hi,

I did an example using glyph 2D and 3D but wen I try to do the same with TensorGlyph I didn't find the way to show the data.
For glyph 2D, 3D and TensorGlyph I used the same code to set the active Vector:

....GetPointData()->SetActiveVectors("ImageScalars");




This is the code that I used to tensor glyph:

  /** Create the vtkImage from the itk tensor */
  TensorImageInfo field = this->TensorImages[id];
  vtkSmartPointer<vtkImageData> vtkField = ITKTensorFieldToVTK(field.m_Image);

  /** reduce the number of points to show */
  vtkSmartPointer<vtkExtractVOI> VOI = vtkSmartPointer<vtkExtractVOI>::New();
  VOI->SetSampleRate(m_SampleRate);
  VOI->SetInput(vtkField);
  VOI->Update();
  VOI->GetOutput()->GetPointData()->SetActiveTensors("ImageScalars");

  /** Create the shape to replicate using the TensorGlyph */
  vtkSmartPointer<vtkSphereSource> sphere =
      vtkSmartPointer<vtkSphereSource>::New();
  sphere->SetThetaResolution(8);
  sphere->SetPhiResolution(8);

  /** Create and set the glyph3D */
  vtkSmartPointer<vtkTensorGlyph> tensorGlyph =
      vtkSmartPointer<vtkTensorGlyph>::New();
  tensorGlyph->SetSourceConnection(sphere->GetOutputPort());
  tensorGlyph->ScalingOn();
  tensorGlyph->SetScaleFactor(m_ScaleFactor);
  tensorGlyph->ClampScalingOn();
  tensorGlyph->ColorGlyphsOn();
  tensorGlyph->ThreeGlyphsOff();
  tensorGlyph->ExtractEigenvaluesOn();
  tensorGlyph->SetColorModeToEigenvalues();


  /** Set the PolyData into the glyph3D */
  tensorGlyph->SetInputConnection(VOI->GetOutputPort());
  tensorGlyph->Update();

  /** Attach the glyph3D to the mapper */
  mapper->SetInputConnection(tensorGlyph->GetOutputPort());



Am I doing something wrong ?

I really appreciate any help. 

Thanks in advance,
__________________________________
| Ariel Hernán Curiale Ph.D Student
| ETSI Telecomunicación
| Universidad de Valladolid
| Campus Miguel Delibes
| 47011 Valladolid, Spain
| Phone: 983-423000 ext. 5590
| Web: www.curiale.com.ar
|_________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121127/54e36b5a/attachment.htm>


More information about the vtkusers mailing list