[ITK Community] [Insight-users] display 3D raw file

Massinissa Bandou Massinissa.Bandou at USherbrooke.ca
Tue Dec 10 03:28:12 EST 2013


Hello everyone!!

I try to do something like that;

(read a raw file with vtk)->GetOutput() as vtkImageData ----> ITK
----->display with VTK

the problem is I'm getting a 2D image instead of 3D
   
typedef itk::Image<short, 3> ImageType;

    typedef itk::VTKImageToImageFilter<ImageType> VTKToITKConnector;
    VTKToITKConnector::Pointer VTK2ITKfilter = VTKToITKConnector::New();
	VTK2ITKfilter->SetInput(imageData);// my vtkImageData

	typedef itk::ImageToVTKImageFilter<ImageType>  ConnectorType;
	ConnectorType::Pointer connector = ConnectorType::New();
	connector->SetInput(VTK2ITKfilter->GetOutput());
 
	vtkSmartPointer<vtkImageActor> actor =
vtkSmartPointer<vtkImageActor>::New();
	actor->SetInput(connector->GetOutput());
	
	vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
	vtkSmartPointer<vtkRenderer> renderer = 
vtkSmartPointer<vtkRenderer>::New();
	renderer->AddActor(actor);
	renderer->ResetCamera();
	renderer->SetBackground(0.1,0.2,0.3);
	renderer->GradientBackgroundOn();
	renderWindow->AddRenderer(renderer);

	vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
	vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
	renderWindowInteractor->SetInteractorStyle(style);
 
	renderWindowInteractor->SetRenderWindow(renderWindow);
	renderWindowInteractor->Initialize();
 
	renderWindowInteractor->Start();




--
View this message in context: http://itk-users.7.n7.nabble.com/display-3D-raw-file-tp32947.html
Sent from the ITK - Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users



More information about the Community mailing list