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

Neel007 sayanmaity.10 at gmail.com
Mon Jul 20 18:22:36 EDT 2015


Dear Cory,

Please disregard the previous post. I was doing a silly mistake of not
including the "threshold->Update();" statement thus the threshold operation
wasn't performing. After including the statement the vtkThreshold is working
and giving me outputs: Code & plots are attached:

*Code:*
  // Start by loading some data.
   vtkSmartPointer<vtkTIFFReader> reader =
    vtkSmartPointer<vtkTIFFReader>::New();
  reader->SetFileNameSliceOffset(1);
  reader->SetFileNameSliceSpacing(1);
 
reader->SetFilePattern("S:\\GSoC_2015_Implementation\\test_images\\2.%d.bspline.tif");
  reader->SetDataExtent(0, 63, 0, 63, 1, 125);
  
  reader->SetOrientationType(3);
  reader->Update();
  
  vtkSmartPointer<vtkThreshold> threshold =
vtkSmartPointer<vtkThreshold>::New();
  threshold->SetInputConnection(reader->GetOutputPort());
  threshold->ThresholdByUpper(1);

  //threshold->SetInputArrayToProcess(0, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_POINTS, "index");
  threshold->Update();
  vtkUnstructuredGrid* thresholdedPolydata = threshold->GetOutput();
  std::cout << "There are " << thresholdedPolydata->GetNumberOfCells() 
            << " cells after thresholding." << std::endl;

  //Visualization UnstructuredGrid after threshold

  
  // Create a mapper and actor
  vtkSmartPointer<vtkDataSetMapper> mapper = 
    vtkSmartPointer<vtkDataSetMapper>::New();

  mapper->SetInputData(thresholdedPolydata);

  vtkSmartPointer<vtkActor> actor = 
    vtkSmartPointer<vtkActor>::New();
  actor->SetMapper(mapper);
  actor->GetProperty()->SetColor(1.0, 0.0, 0.0);
  actor->GetProperty()->SetRepresentationToWireframe();
  actor->GetProperty()->SetLineWidth(5);
 
  // Create a renderer, render window, and interactor
  vtkSmartPointer<vtkRenderer> renderer = 
    vtkSmartPointer<vtkRenderer>::New();
  vtkSmartPointer<vtkRenderWindow> renderWindow = 
    vtkSmartPointer<vtkRenderWindow>::New();
  renderWindow->AddRenderer(renderer);
  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = 
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
  renderWindowInteractor->SetRenderWindow(renderWindow);
 
  // Add the actors to the scene
  renderer->AddActor(actor);
  //renderer->AddActor(sphereActor);
  renderer->SetBackground(.1, .5, .8);; // Background color white
 
  // Render and interact
  renderWindow->Render();
  renderWindowInteractor->Start();

*Plot of Unstructured grid using vtkThreshold :*

<http://vtk.1045678.n5.nabble.com/file/n5733002/vtkThreshold.png> 

/***** Issue****/ *But I am facing some memory related problem, I have total
551 images (series/ stack) out of which only 125 images are loading in my PC
(16 GB memory installed)  while using vtkThreshold  anything more than that
throwing error related Memory overloading, error window shown below. Please
suggest me how to handle this memory allocation problem :*

""ERROR: In f:\vtk\vtk-6.2.0\common\core\vtkDataArrayTemplate.txx, line 142
vtkIdTypeArray (0000000001C83C90): Unable to allocate 996245250 elements of
size 8 bytes.

<http://vtk.1045678.n5.nabble.com/file/n5733002/Capture.png> 



--
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-tp5732834p5733002.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list