Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
14 #define MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
15 
16 #include "itkImageToImageFilterDetail.h"
17 #include "mitkImageSource.h"
18 #include <MitkCoreExports.h>
19 
20 namespace mitk
21 {
35  template <class TInputImage>
37  {
38  public:
39  mitkClassMacro(ITKImageImport, ImageSource) itkFactorylessNewMacro(Self) itkCloneMacro(Self)
40 
41 
42  typedef TInputImage InputImageType;
43  typedef typename InputImageType::Pointer InputImagePointer;
44  typedef typename InputImageType::ConstPointer InputImageConstPointer;
45  typedef typename InputImageType::RegionType InputImageRegionType;
46  typedef typename InputImageType::PixelType InputImagePixelType;
47 
49  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
50  itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension);
51 
53  InputImageType *GetInput(void);
54 
56  void SetInput(const InputImageType *);
57  using itk::ProcessObject::SetInput;
58 
70  void SetGeometry(const BaseGeometry *geometry);
71 
72  protected:
74 
75  ~ITKImageImport() override;
76 
77  void GenerateOutputInformation() override;
78 
79  void GenerateInputRequestedRegion() override;
80 
81  void GenerateData() override;
82 
83  void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override;
84 
87  typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension),
88  itkGetStaticConstMacro(RegionDimension)>
90 
91  BaseGeometry::Pointer m_Geometry;
92  };
93 
109  template <typename ItkOutputImageType>
110  Image::Pointer ImportItkImage(const itk::SmartPointer<ItkOutputImageType> &itkimage,
111  const BaseGeometry *geometry = nullptr,
112  bool update = true);
113 
146  template <typename ItkOutputImageType>
147  Image::Pointer ImportItkImage(const ItkOutputImageType *itkimage,
148  const BaseGeometry *geometry = nullptr,
149  bool update = true);
150 
166  template <typename ItkOutputImageType>
167  Image::Pointer GrabItkImageMemory(itk::SmartPointer<ItkOutputImageType> &itkimage,
168  mitk::Image *mitkImage = nullptr,
169  const BaseGeometry *geometry = nullptr,
170  bool update = true);
171 
187  template <typename ItkOutputImageType>
188  Image::Pointer GrabItkImageMemory(ItkOutputImageType *itkimage,
189  mitk::Image *mitkImage = nullptr,
190  const BaseGeometry *geometry = nullptr,
191  bool update = true);
192 
193 } // namespace mitk
194 
195 #ifndef MITK_MANUAL_INSTANTIATION
196 #include "mitkITKImageImport.txx"
197 #endif
198 
199 #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:40
Image class for storing images.
Definition: mitkImage.h:72
itk::ImageToImageFilterDetail::ImageRegionCopier< itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(RegionDimension)> OutputToInputRegionCopierType
#define MITK_EXPORT
Definition: mitkCommon.h:195
BaseGeometry Describes the geometry of a data object.
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51
InputImageType::ConstPointer InputImageConstPointer