Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkITKImageToImageFilterSS.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 __vtkITKImageToImageFilterSS_h
16 #define __vtkITKImageToImageFilterSS_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 vtkITKImageToImageFilterSS* New() { return nullptr; }
30  void PrintSelf(ostream& os, vtkIndent indent) override
31  {
32  Superclass::PrintSelf ( os, indent );
33  os << m_Filter;
34  }
35 
39  void SetReleaseDataFlag(int f) override
40  {
41  Superclass::SetReleaseDataFlag(f);
42  m_Filter->SetReleaseDataFlag(f);
43  }
44 
45 protected:
46 
48  typedef short InputImagePixelType;
49  typedef short OutputImagePixelType;
50  typedef itk::Image<InputImagePixelType, 3> InputImageType;
51  typedef itk::Image<OutputImagePixelType, 3> OutputImageType;
52 
53  typedef itk::VTKImageImport<InputImageType> ImageImportType;
54  typedef itk::VTKImageExport<OutputImageType> ImageExportType;
55  ImageImportType::Pointer itkImporter;
56  ImageExportType::Pointer itkExporter;
57 
58  typedef itk::ImageToImageFilter<InputImageType,OutputImageType> GenericFilterType;
59  GenericFilterType::Pointer m_Filter;
60 
62  {
64  m_Filter = filter;
65  this->itkImporter = ImageImportType::New();
66  this->itkExporter = ImageExportType::New();
67  ConnectPipelines(this->vtkExporter, this->itkImporter);
68  ConnectPipelines(this->itkExporter, this->vtkImporter);
69  this->LinkITKProgressToVTKProgress ( m_Filter );
70 
72  m_Filter->SetInput ( this->itkImporter->GetOutput() );
73  this->itkExporter->SetInput ( m_Filter->GetOutput() );
74  this->vtkCast->SetOutputScalarTypeToShort();
75  };
76 
77  ~vtkITKImageToImageFilterSS() override = default;
78 
79 private:
81  void operator=(const vtkITKImageToImageFilterSS&) = delete;
82 };
83 
84 #endif
void ConnectPipelines(ITK_Exporter exporter, VTK_Importer *importer)
Definition: vtkITKUtility.h:26
itk::VTKImageImport< InputImageType > ImageImportType
itk::VTKImageExport< OutputImageType > ImageExportType
ImageExportType::Pointer itkExporter
Abstract base class for connecting ITK and VTK.
vtkITKImageToImageFilterSS(GenericFilterType *filter)
void PrintSelf(ostream &os, vtkIndent indent) override
itk::Image< OutputImagePixelType, 3 > OutputImageType
itk::Image< InputImagePixelType, 3 > InputImageType
ImageImportType::Pointer itkImporter
void LinkITKProgressToVTKProgress(itk::ProcessObject *process)
BTX.
GenericFilterType::Pointer m_Filter
itk::ImageToImageFilter< InputImageType, OutputImageType > GenericFilterType
static vtkITKImageToImageFilterSS * New()