[prev in list] [next in list] [prev in thread] [next in thread]
List: insight-users
Subject: Re: [Insight-users] image does not display with itk+vtk
From: zhq <15891495523 () 126 ! com>
Date: 2013-07-29 8:20:23
Message-ID: 1375086023833-7583606.post () n2 ! nabble ! com
[Download RAW message or body]
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.
_____________________________________
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic