[vtkusers] Convert vtkPolyData to vtkImageData - wrong values at points where objects intersects

Dr. Roman Grothausmann grothausmann.roman at mh-hannover.de
Tue Jul 22 07:02:58 EDT 2014


Hi Chris,


It is likely not vtkAppendPolyData but vtkPolyDataToImageStencil. I'm not sure 
how vtkPolyDataToImageStencil evaluates within intersections.
Instead You could either use a boolean union instead of vtkAppendPolyData, which 
however is likely to be slow.
A possibly faster way could be to OR together output images of each individual 
polydata object.
What in the end actually is faster depends on the complexity of the polydata, 
the number of objects and the needed image resolution.
If both methods are too slow, modifying the code of vtkPolyDataToImageStencil 
might be best.

Hope this helps
Roman

On 16/07/14 11:22, Christian Arens wrote:
> Hi there,
>
> i want to convert several vtkpolydata objects into one imagedata object, because
> i want to read along every voxel (x,y,z). I using vtkAppendPolyData to append
> several polydataobjets like spheres. This output is used in this algorithm:
> http://www.paraview.org/Wiki/VTK/Examples/Cxx/PolyData/PolyDataToImageData
>
> My next step is:
>
> int* dims = imgstenc->GetOutput()->GetDimensions();
>
> |for (int x=0; x<dims[0]; x++)
> {
>
>      for (int y=0; y<dims[1]; y++)
>      {
>          int teiler = 0;
>          for (int z=0; z<dims[2]; z++)
>          {
>              double voxel =  imgstenc->GetOutput()->GetScalarComponentAsDouble(x,y,z,0); //Pixelwerte
>              if (voxel > 0)
>              {
>                  teiler++;
>              }
>          }
>          outputFile << teiler <<",";
>
>      }
>
>      outputFile <<  endl;
> }
> |
>
> So i want to count every voxel that has the objectvalue of 255.
>
> It works great, but if a polydata objects intersects another, at the
> intersection a voxelvalue of 0 is count, not 255 and i dont know why. Maybe
> there is a problem with the vtkAppendPolyData filter ?
>
> http://www.pic-upload.de/view-23915628/berechneteWerte2.jpg.html
>
> Best regards Chris
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>

-- 
Dr. Roman Grothausmann

Tomographie und Digitale Bildverarbeitung
Tomography and Digital Image Analysis

Institut für Funktionelle und Angewandte Anatomie, OE 4120
Medizinische Hochschule Hannover
Carl-Neuberg-Str. 1
D-30625 Hannover

Tel. +49 511 532-9574


More information about the vtkusers mailing list