DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
itkRGBImageToVTKImageDataFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: RGB Image to VTK Image Data Converter
4 
5  Copyright (c) Pew-Thian Yap. All rights reserved.
6  See http://www.unc.edu/~ptyap/ for details.
7 
8  This software is distributed WITHOUT ANY WARRANTY; without even
9  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10  PURPOSE. See the above copyright notices for more information.
11 
12  =========================================================================*/
13 
14 #ifndef __itkRGBImageToVTKImageDataFilter_h
15 #define __itkRGBImageToVTKImageDataFilter_h
16 
17 #include "itkProcessObject.h"
18 #include "itkImageRegionConstIterator.h"
19 
20 #include "vtkSmartPointer.h"
21 #include "vtkImageData.h"
22 
23 namespace itk
24 {
25 
29 template <class TInputImage >
30 class ITK_EXPORT RGBImageToVTKImageDataFilter : public ProcessObject
31 {
32 public:
35  typedef ProcessObject Superclass;
36  typedef SmartPointer<Self> Pointer;
37  typedef SmartPointer<const Self> ConstPointer;
38 
40  itkNewMacro(Self);
41 
43  itkTypeMacro(RGBImageToVTKImageDataFilter, ProcessObject);
44 
46  itkStaticConstMacro(Dimension, unsigned int, TInputImage::ImageDimension);
47 
49  typedef TInputImage InputImageType;
50  typedef typename InputImageType::Pointer InputImagePointer;
51  typedef typename InputImageType::RegionType InputRegionType;
52  typedef typename InputImageType::SizeType InputSizeType;
53  typedef typename InputImageType::SpacingType InputSpacingType;
54  typedef typename InputImageType::PointType InputPointType;
55  typedef typename InputImageType::IndexType InputIndexType;
56  typedef typename InputImageType::PixelType InputPixelType;
57  typedef typename InputImageType::ConstPointer InputImageConstPointer;
58  typedef ImageRegionConstIterator<InputImageType> InputImageIteratorType;
59 
60  typedef vtkSmartPointer<vtkImageData> OutputImageType;
61 
64  vtkImageData * GetOutput() const;
65 
67  using Superclass::SetInput;
68  virtual void SetInput(const InputImageType *image);
69  const InputImageType * GetInput() const;
70 
71  virtual void Update() ITK_OVERRIDE
72  {
73  this->GenerateData();
74  }
75 
76 protected:
79 
80  virtual void GenerateData() ITK_OVERRIDE;
81 
82 private:
83  RGBImageToVTKImageDataFilter(const Self&); //purposely not implemented
84  void operator=(const Self&); //purposely not implemented
85 
86  OutputImageType m_Image;
87 };
88 
89 } // end namespace itk
90 
91 #ifndef ITK_MANUAL_INSTANTIATION
93 #endif
94 
95 #endif
vtkSmartPointer< vtkImageData > OutputImageType
ImageRegionConstIterator< InputImageType > InputImageIteratorType
#define ITK_OVERRIDE
Definition: utlITKMacro.h:46
InputImageType::ConstPointer InputImageConstPointer
Converts an ITK image to VTK image data.