Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkITKImageImport.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
18 #define MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
19 
20 #include "itkImageToImageFilterDetail.h"
21 #include "mitkImageSource.h"
22 #include <MitkCoreExports.h>
23 
24 namespace mitk
25 {
39  template <class TInputImage>
41  {
42  public:
43  mitkClassMacro(ITKImageImport, ImageSource) itkFactorylessNewMacro(Self) itkCloneMacro(Self)
44 
46  typedef TInputImage InputImageType;
47  typedef typename InputImageType::Pointer InputImagePointer;
48  typedef typename InputImageType::ConstPointer InputImageConstPointer;
49  typedef typename InputImageType::RegionType InputImageRegionType;
50  typedef typename InputImageType::PixelType InputImagePixelType;
51 
53  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
54  itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension);
55 
57  InputImageType *GetInput(void);
58 
60  void SetInput(const InputImageType *);
61  using itk::ProcessObject::SetInput;
62 
74  void SetGeometry(const BaseGeometry *geometry);
75 
76  protected:
78 
79  virtual ~ITKImageImport();
80 
81  virtual void GenerateOutputInformation() override;
82 
83  virtual void GenerateInputRequestedRegion() override;
84 
85  virtual void GenerateData() override;
86 
87  virtual void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override;
88 
91  typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension),
92  itkGetStaticConstMacro(RegionDimension)>
94 
95  BaseGeometry::Pointer m_Geometry;
96  };
97 
113  template <typename ItkOutputImageType>
114  Image::Pointer ImportItkImage(const itk::SmartPointer<ItkOutputImageType> &itkimage,
115  const BaseGeometry *geometry = nullptr,
116  bool update = true);
117 
150  template <typename ItkOutputImageType>
151  Image::Pointer ImportItkImage(const ItkOutputImageType *itkimage,
152  const BaseGeometry *geometry = nullptr,
153  bool update = true);
154 
170  template <typename ItkOutputImageType>
171  Image::Pointer GrabItkImageMemory(itk::SmartPointer<ItkOutputImageType> &itkimage,
172  mitk::Image *mitkImage = nullptr,
173  const BaseGeometry *geometry = nullptr,
174  bool update = true);
175 
191  template <typename ItkOutputImageType>
192  Image::Pointer GrabItkImageMemory(ItkOutputImageType *itkimage,
193  mitk::Image *mitkImage = nullptr,
194  const BaseGeometry *geometry = nullptr,
195  bool update = true);
196 
197 } // namespace mitk
198 
199 #ifndef MITK_MANUAL_INSTANTIATION
200 #include "mitkITKImageImport.txx"
201 #endif
202 
203 #endif /* MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D */
InputImageType::PixelType InputImagePixelType
Superclass of all classes generating Images (instances of class Image) as output. ...
TInputImage InputImageType
The type of the input image.
InputImageType::RegionType InputImageRegionType
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
Pipelined import of itk::Image.
Image::Pointer ImportItkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, const BaseGeometry *geometry=nullptr, bool update=true)
Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImpor...
Image::Pointer GrabItkImageMemory(itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=nullptr, const BaseGeometry *geometry=nullptr, bool update=true)
Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
InputImageType::Pointer InputImagePointer
Super class of data objects consisting of slices.
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Image class for storing images.
Definition: mitkImage.h:76
itk::ImageToImageFilterDetail::ImageRegionCopier< itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(RegionDimension)> OutputToInputRegionCopierType
#define MITK_EXPORT
Definition: mitkCommon.h:199
BaseGeometry Describes the geometry of a data object.
Class for defining the data type of pixels.
Definition: mitkPixelType.h:55
InputImageType::ConstPointer InputImageConstPointer