display 200 DICOM images in 3d using VTK

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

display 200 DICOM images in 3d using VTK

marco festugato
Hi guys, Im' really new to VTK. What I want to do is displaying 200 DICOM
images in 3D using VTK but I really don't know how this works...is the
pipeline like this:

reader -> mapper -> actor -> renderer   ???

Here's my code:

#include <vtkSmartPointer.h>
#include <vtkDICOMImageReader.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkImageMapper.h>
#include <vtkActor.h>

int main(int argc, char* argv[])
{
  // Verify input arguments
  if ( argc != 2 )
    {
    std::cout << "Usage: " << argv[0]
              << "- FolderDirectoryDICOMimages" << std::endl;
    return EXIT_FAILURE;
    }
   
  std::string inputFilename = argv[1];
 
  // Read all the DICOM files in the specified directory.
  vtkSmartPointer<vtkDICOMImageReader> reader
=vtkSmartPointer<vtkDICOMImageReader>::New();
  reader->SetDirectoryName(argv[1]);
  reader->Update();

  // Visualize
  vtkSmartPointer<vtkImageMapper> mapper =
vtkSmartPointer<vtkImageMapper>::New();
  vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
  vtkSmartPointer<vtkRenderWindowInteractor> iren =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
  vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
  vtkSmartPointer<vtkRenderWindow> renWin =
vtkSmartPointer<vtkRenderWindow>::New();
 
  mapper -> SetInputData(reader -> GetOutputPort());
  actor-> SetMapper(mapper);
  renderer-> AddActor(actor);
  renderer->SetBackground(0,0,0);
  renWin-> AddRenderer(renderer);
  renWin->SetSize(800,800);
  iren->SetRenderWindow(renWin);
   
  renWin->Render();
  iren->Start();

  return EXIT_SUCCESS;
}



I receive an error when using "SetInputData" and "GetOutputPort"...what else
should I use? I can't find anything online.
Thanks in advance for your answer!



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|

Re: display 200 DICOM images in 3d using VTK

David Gobbi
Hi Marco,

The vtkImageMapper is not compatible with vtkActor, mainly because vtkImageMapper is for 2D graphics and vtkActor is for 3D graphics (but also because vtkActor is for polygonal data).  Here is a link to some examples of displaying images with VTK:


Cheers,
  David

_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers