[Insight-users] Display the original image and smoothened image together in one VTK window- manual II
Niha G Beig
niha.beig at gmail.com
Mon Feb 21 10:27:24 EST 2011
I have been working with the second manual which tells about ITK+VTK. I want
to know how we can display both the original image and smoothened image
together in one VTK window. Is it possible?
The code builds without any errors but I must going terribly wrong with
my understanding of the concepts because only one image is being displayed..
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkImageToVTKImageFilter.h"
#include "vtkImageViewer.h"
#include "vtkRenderWindowInteractor.h"
#include "itkCurvatureFlowImageFilter.h"
int main(int argc, char **argv)
{
typedef itk::Image<unsigned short,2>ImageType;
typedef itk::ImageFileReader<ImageType>ReaderType;
typedef itk::ImageToVTKImageFilter<ImageType>ConnectorType;
typedef
itk::CurvatureFlowImageFilter<ImageType,ImageType>SmoothingFilterType;
ReaderType::Pointer reader=ReaderType::New();
ConnectorType::Pointer connector=ConnectorType::New();
SmoothingFilterType::Pointer smoother= SmoothingFilterType::New();
reader->SetFileName(argv[1]);
connector->SetInput(reader->GetOutput());
smoother->SetNumberOfIterations(7);
smoother->SetTimeStep(0.2);
vtkImageViewer * viewer= vtkImageViewer::New();
vtkRenderWindowInteractor * renderWindowInteractor=
vtkRenderWindowInteractor::New();
viewer->SetupInteractor(renderWindowInteractor);
viewer->SetInput(connector->GetOutput());
viewer->Render();
viewer->SetColorWindow(255);
viewer->SetColorLevel(128);
renderWindowInteractor->Start();
smoother->SetInput(reader->GetOutput());
viewer->SetupInteractor(renderWindowInteractor);
viewer->SetInput(connector->GetOutput());
viewer->Render();
viewer->SetColorWindow(255);
viewer->SetColorLevel(128);
renderWindowInteractor->Start();
return 0;
}
Looking forward to hear from you.
Regards,
Niha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110221/0810838c/attachment.htm>
More information about the Insight-users
mailing list