Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkITKImageToImageFilterFF.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Copyright Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: vtkITK
9  Module: $HeadURL$
10  Date: $Date$
11  Version: $Revision$
12 
13 ==========================================================================*/
14 
15 #ifndef __vtkITKImageToImageFilterFF_h
16 #define __vtkITKImageToImageFilterFF_h
17 
19 #include "vtkImageAlgorithm.h"
20 #include "itkImageToImageFilter.h"
21 #include "itkVTKImageExport.h"
22 #include "itkVTKImageImport.h"
23 #include "vtkITKUtility.h"
24 
26 {
27 public:
29  static vtkITKImageToImageFilterFF* New() { return 0; };
30  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE
31  {
32  Superclass::PrintSelf ( os, indent );
33  os << m_Filter;
34  };
35 
36 protected:
37 
39  typedef float InputImagePixelType;
40  typedef float OutputImagePixelType;
41  typedef itk::Image<InputImagePixelType, 3> InputImageType;
42  typedef itk::Image<OutputImagePixelType, 3> OutputImageType;
43 
44  typedef itk::VTKImageImport<InputImageType> ImageImportType;
45  typedef itk::VTKImageExport<OutputImageType> ImageExportType;
46  ImageImportType::Pointer itkImporter;
47  ImageExportType::Pointer itkExporter;
48 
49  typedef itk::ImageToImageFilter<InputImageType,OutputImageType> GenericFilterType;
50  GenericFilterType::Pointer m_Filter;
51 
52  vtkITKImageToImageFilterFF ( GenericFilterType* filter )
53  {
55  m_Filter = filter;
56  this->itkImporter = ImageImportType::New();
57  this->itkExporter = ImageExportType::New();
58  ConnectPipelines(this->vtkExporter, this->itkImporter);
59  ConnectPipelines(this->itkExporter, this->vtkImporter);
60  this->LinkITKProgressToVTKProgress ( m_Filter );
61 
63  m_Filter->SetInput ( this->itkImporter->GetOutput() );
64  this->itkExporter->SetInput ( m_Filter->GetOutput() );
65  this->vtkCast->SetOutputScalarTypeToFloat();
66  };
67 
69  {
70  };
71 
72 private:
74  void operator=(const vtkITKImageToImageFilterFF&);
75 };
76 
77 #endif
void ConnectPipelines(ITK_Exporter exporter, VTK_Importer *importer)
Definition: vtkITKUtility.h:26
itk::VTKImageExport< OutputImageType > ImageExportType
static vtkITKImageToImageFilterFF * New()
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
GenericFilterType::Pointer m_Filter
ImageExportType::Pointer itkExporter
Abstract base class for connecting ITK and VTK.
itk::VTKImageImport< InputImageType > ImageImportType
itk::ImageToImageFilter< InputImageType, OutputImageType > GenericFilterType
ImageImportType::Pointer itkImporter
void LinkITKProgressToVTKProgress(itk::ProcessObject *process)
BTX.
itk::Image< InputImagePixelType, 3 > InputImageType
vtkITKImageToImageFilterFF(GenericFilterType *filter)
itk::Image< OutputImagePixelType, 3 > OutputImageType