[vtkusers] How to visualize an ITK field using vtkGlyph3D
Ariel Hernán Curiale
curiale at gmail.com
Thu Oct 11 10:15:55 EDT 2012
I can do it !
If anyone want to know how i do it this is a summary:
1) Create a vtkImageData from the deformationField:
- Set properly the vtkImageData(SetDimensions, SetOrigin, SetSpacing, SetNumberOfScalarComponents and AllocateScalars memory
- Fill the vtkImageData using GetScalarPointer (x,y,z). If the TField::ImageDimension is 2 use z=0 and dim[z]=1
2) I used the vtkExtractVOI to select a particular ROI or subsample the deformation field.
- Set the sample rate and the input. I my case I use VOI->SetInput(deformationFielVTK)
3) Update the vtkExtractVOI
3) SetActiveVectors("ImageScalars") into the vtkExtractVOI. For example: VOI->GetPointData()->SetActiveVectors("ImageScalars")
4) Create an arrow.
5) create a glyph3D and set: ScalingOn, SetScaleFactor, SetVectorModelToUseVector, SetScaleModeToScaleByVector, OrientOn and the Source (the arrow)
6) Se the input connection into the glyph3D using VOI->GetOutputPort.
7) Create an Actor and mapper for the glyph3D
8) create an Actor and for the vtkImage
9) set this two actors inside the render (I omitted the creation of the renderWindow because is the same in all the vtk examples).
Saludos
__________________________________
| 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
|_________________________________
El 10/10/2012, a las 09:28, Ariel Hernán Curiale escribió:
> Hi,
>
> I'm trying to do a simple task in VTK but I can't to do that. I want to show a deformation field over an image using vtkGlyph3D oriented by the deformation field.
>
> I have this data type:
>
> 1) itk::Image<itk::Vector<float,3> ,3> deformationField
> 2) itk::Image<short,3> image
>
> I did this:
> 1) Convert the image to vtkDataImage using ImageToVTKImageFilter.
> 2) Create an arrow using vtkArrowSource.
> 3) Create a glyph3D using vtkGlyph3D.
> 4) Set the arrow into the glyph3D using the method SetSource provided by vtkGlyph3D.
>
> My problems are:
> 1) I don't know if exist an easy way to convert the an itk field into a vtkPolyData or I just need to fill an empty vtkPolyData structure.
> 2) If I can convert the field into a vtkPolyData and set into the vtkGlyph3D using the method SetInput what I need to do to add the vtk image and render the glyph3D over the image ?
>
> I'd really appreciate any help or guide you could give me.
>
> Thanks
> __________________________________
> | 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/20121011/b43ddebc/attachment.htm>
More information about the vtkusers
mailing list