Medical Imaging Interaction Toolkit  2021.02.99-4e0dbe47
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 
114  template <typename ItkOutputImageType>
116  const BaseGeometry *geometry = nullptr,
117  bool update = true);
118 
154  template <typename ItkOutputImageType>
155  Image::Pointer ImportItkImage(const ItkOutputImageType *itkimage,
156  const BaseGeometry *geometry = nullptr,
157  bool update = true);
158 
179  template <typename ItkOutputImageType>
181  mitk::Image *mitkImage = nullptr,
182  const BaseGeometry *geometry = nullptr,
183  bool update = true);
184 
205  template <typename ItkOutputImageType>
206  Image::Pointer GrabItkImageMemory(ItkOutputImageType *itkimage,
207  mitk::Image *mitkImage = nullptr,
208  const BaseGeometry *geometry = nullptr,
209  bool update = true);
210 
211 } // namespace mitk
212 
213 #ifndef MITK_MANUAL_INSTANTIATION
214 #include "mitkITKImageImport.txx"
215 #endif
216 
217 #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:73
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