[vtkusers] display 200 DICOM images in 3d using VTK
marco festugato
marco12nar at hotmail.it
Thu Feb 28 04:46:54 EST 2019
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
More information about the vtkusers
mailing list