[vtkusers] Does vtkImageBlend or vtkAppendPolyData generate 3D / Volumetric representation of 2D Image Data or PolyData respectively

Neel007 sayanmaity.10 at gmail.com
Mon Jul 13 20:10:35 EDT 2015

Dear Cory,

I was following the second-step you mentioned: "Alternatively, you could
*create a 3D image from your input 2D image*s, then use *vtkThreshold to
create an unstructured grid of just the white parts of the 3D image*. To
convert the resulting hexahedral elements in the *unstructured grid to
tetrahedra, use vtkDataSetTriangleFilter*." I am able to complete the first
step successfully the second one partially. I have included the code & the
output window, if you can have a look and give me some input It will be very
much appreciated. Thank you for your time. 

*/create a 3D image from your input 2D images...(Working Fine as I have
visualized it similar as Matlab)/*

// Start by loading some data.
  vtkSmartPointer<vtkTIFFReader> reader =
  reader->SetDataExtent(0, 63, 0, 63, 1, 551);

*/vtkThreshold to create an unstructured grid of just the white parts of the
3D image/*

As you have suggested to use vtkThreshold but the input data being binary
"Image Thresholding" operation is not applicable. Thus, I tried to convert
the 3D volume of *.tif stack of images to vtkImageData and trying to use
vtkClipVolume to create an unstructured grid using the white pixels. Here
I'm facing an issue: vtkImageData pixel values of the Binary Image resulting
-5.4861292803319049e+303 ; Instead of 0 & 1;  Any suggestion if I am missing
something here. The code snippet & the output-window:
// Create an image data
  vtkSmartPointer<vtkImageData> imageData = 
  //vtkImageData *imageData=0;
  imageData =reader->GetOutput() ;

  int* dims = imageData->GetDimensions();
  // int dims[3]; // can't do this
  std::cout << "Dims: " << " x: " << dims[0] << " y: " << dims[1] << " z: "
<< dims[2] << std::endl;
  std::cout << "Number of points: " << imageData->GetNumberOfPoints() <<
  std::cout << "Number of cells: " << imageData->GetNumberOfCells() <<
  int extent[6];
  imageData->GetExtent(extent) ;


  vtkIdType numberOfPointArrays =
  std::cout << "Number of PointData arrays: " << numberOfPointArrays <<

  cout<< "Number of Scalar Components:

  for(vtkIdType i = 0; i < numberOfPointArrays; i++)
    // The following two lines are equivalent
    int dataTypeID = imageData->GetPointData()->GetArray(i)->GetDataType();
    std::cout << "Array " << i << ": " <<
              << " (type: " << dataTypeID << ")" << std::endl;

vtkSmartPointer<vtkClipVolume> vol =

	double tryval=-5.4861292803319049e+303;//* */Not sure which value I should
for clipping/*

*For few slices (50) vtkClipVolume is working but for entire series it
throwing memory exception. I think I might need to use some other
functionalities. Please give me some suggestion.*

*/unstructured grid to tetrahedra, use vtkDataSetTriangleFilter/*

vtkNew<vtkDataSetTriangleFilter> tf;

View this message in context: http://vtk.1045678.n5.nabble.com/Does-vtkImageBlend-or-vtkAppendPolyData-generate-3D-Volumetric-representation-of-2D-Image-Data-or-Poy-tp5732834p5732876.html
Sent from the VTK - Users mailing list archive at Nabble.com.

More information about the vtkusers mailing list