Medical Imaging Interaction Toolkit  2018.4.99-9a29ffc6
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:
40  itkFactorylessNewMacro(Self);
41  itkCloneMacro(Self);
42 
44  typedef TInputImage InputImageType;
45  typedef typename InputImageType::Pointer InputImagePointer;
46  typedef typename InputImageType::ConstPointer InputImageConstPointer;
47  typedef typename InputImageType::RegionType InputImageRegionType;
48  typedef typename InputImageType::PixelType InputImagePixelType;
49 
51  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
52  itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension);
53 
55  InputImageType *GetInput(void);
56 
58  void SetInput(const InputImageType *);
59  using itk::ProcessObject::SetInput;
60 
72  void SetGeometry(const BaseGeometry *geometry);
73 
74  protected:
76 
77  ~ITKImageImport() override;
78 
79  void GenerateOutputInformation() override;
80 
81  void GenerateInputRequestedRegion() override;
82 
83  void GenerateData() override;
84 
85  void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override;
86 
89  typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension),
90  itkGetStaticConstMacro(RegionDimension)>
92 
94  };
95 
111  template <typename ItkOutputImageType>
113  const BaseGeometry *geometry = nullptr,
114  bool update = true);
115 
148  template <typename ItkOutputImageType>
149  Image::Pointer ImportItkImage(const ItkOutputImageType *itkimage,
150  const BaseGeometry *geometry = nullptr,
151  bool update = true);
152 
168  template <typename ItkOutputImageType>
170  mitk::Image *mitkImage = nullptr,
171  const BaseGeometry *geometry = nullptr,
172  bool update = true);
173 
189  template <typename ItkOutputImageType>
190  Image::Pointer GrabItkImageMemory(ItkOutputImageType *itkimage,
191  mitk::Image *mitkImage = nullptr,
192  const BaseGeometry *geometry = nullptr,
193  bool update = true);
194 
195 } // namespace mitk
196 
197 #ifndef MITK_MANUAL_INSTANTIATION
198 #include "mitkITKImageImport.txx"
199 #endif
200 
201 #endif /* MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D */
BaseGeometry::Pointer m_Geometry
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
#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.
InputImageType::ConstPointer InputImageConstPointer