[Insight-users] image does not display with itk+vtk

zhq 15891495523 at 126.com
Mon Jul 29 04:20:23 EDT 2013


      I can give you some code which can meet your requirements 。 
      And I want to have the book : GettingStarted-II documentation . Could
you please tell me where can down it?




#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"
#include "vtkImageViewer.h"
#include "vtkRenderWindowInteractor.h"
#include "iostream"
using namespace std;

int main( int argc, char **argv ) 
{
	typedef itk::Image <unsigned short, 2> ImageType;
	typedef itk::ImageFileReader<ImageType>ReaderType;
	typedef itk::ImageToVTKImageFilter<ImageType>FilterType;

	ReaderType::Pointer reader = ReaderType::New();
	FilterType::Pointer connector = FilterType::New();
	argv[1] = "C:\\Users\\zhq\\Desktop\\1.jpg";
	reader->SetFileName(argv[1]);
	connector->SetInput(reader->GetOutput());

	vtkImageViewer *viewer = vtkImageViewer::New();
	vtkRenderWindowInteractor *renderWindowInteractor =
vtkRenderWindowInteractor::New();

	viewer->SetupInteractor(renderWindowInteractor);
	viewer->SetInput(connector->GetOutput());
	viewer->Render();
	viewer->SetColorWindow(255);
	viewer->SetColorLevel(128);
	renderWindowInteractor->Initialize();
	renderWindowInteractor->Start();


	return 0;
}




--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/image-does-not-display-with-itk-vtk-tp7583600p7583606.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list