Medical Imaging Interaction Toolkit  2026.06.00
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
14 #define mitkITKImageImport_h
15 
16 #include <itkImageToImageFilterDetail.h>
17 #include <mitkImageSource.h>
18 #include <MitkCoreExports.h>
19 
20 namespace mitk
21 {
39  template <class TInputImage>
41  {
42  public:
44  itkFactorylessNewMacro(Self);
45  itkCloneMacro(Self);
46 
48  typedef TInputImage InputImageType;
49  typedef typename InputImageType::Pointer InputImagePointer;
50  typedef typename InputImageType::ConstPointer InputImageConstPointer;
51  typedef typename InputImageType::RegionType InputImageRegionType;
52  typedef typename InputImageType::PixelType InputImagePixelType;
53 
55  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
56  itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension);
57 
64 
70  void SetInput(const InputImageType *input);
71  using itk::ProcessObject::SetInput;
72 
86  void SetGeometry(const BaseGeometry *geometry);
87 
88  protected:
91 
93  ~ITKImageImport() override;
94 
96  void GenerateOutputInformation() override;
97 
100 
102  void GenerateData() override;
103 
105  void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override;
106 
109  typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension),
110  itkGetStaticConstMacro(RegionDimension)>
112 
113  BaseGeometry::Pointer m_Geometry;
114  };
115 
137  template <typename ItkOutputImageType>
139  const BaseGeometry *geometry = nullptr,
140  bool update = true);
141 
174  template <typename ItkOutputImageType>
175  Image::Pointer ImportItkImage(const ItkOutputImageType *itkimage,
176  const BaseGeometry *geometry = nullptr,
177  bool update = true);
178 
200  template <typename ItkOutputImageType>
202  mitk::Image *mitkImage = nullptr,
203  const BaseGeometry *geometry = nullptr,
204  bool update = true);
205 
227  template <typename ItkOutputImageType>
228  Image::Pointer GrabItkImageMemory(ItkOutputImageType *itkimage,
229  mitk::Image *mitkImage = nullptr,
230  const BaseGeometry *geometry = nullptr,
231  bool update = true);
232 
253  template <typename ItkOutputImageType>
254  Image::Pointer GrabItkImageMemoryChannel(ItkOutputImageType* itkimage,
255  const TimeGeometry* geometry = nullptr,
256  mitk::Image* mitkImage = nullptr,
257  bool update = true);
258 
259 } // namespace mitk
260 
261 #ifndef MITK_MANUAL_INSTANTIATION
262 #include <mitkITKImageImport.tpp>
263 #endif
264 
265 #endif
Abstract base class describing the geometry of a data object.
Pipelined import of itk::Image.
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension)
ITKImageImport()
Constructor.
InputImageType::ConstPointer InputImageConstPointer
InputImageType::Pointer InputImagePointer
void GenerateOutputInformation() override
Compute output information from the input ITK image.
void GenerateInputRequestedRegion() override
Set the requested region on the input image.
mitkClassMacro(ITKImageImport, ImageSource)
void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override
Override to set the nth output.
InputImageType::RegionType InputImageRegionType
itk::ImageToImageFilterDetail::ImageRegionCopier< itkGetStaticConstMacro(InputImageDimension), itkGetStaticConstMacro(RegionDimension)> OutputToInputRegionCopierType
void GenerateData() override
Perform the actual data import from the ITK image.
void SetGeometry(const BaseGeometry *geometry)
Set the Geometry of the result image (optional).
~ITKImageImport() override
Destructor.
BaseGeometry::Pointer m_Geometry
itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension)
void SetInput(const InputImageType *input)
Set the input itk::Image of this image importer.
TInputImage InputImageType
The type of the input image.
InputImageType::PixelType InputImagePixelType
InputImageType * GetInput(void)
Get the input itk::Image of this image importer.
Superclass of all classes generating Images (instances of class Image) as output.
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76
Image::Pointer GrabItkImageMemoryChannel(ItkOutputImageType *itkimage, const TimeGeometry *geometry=nullptr, mitk::Image *mitkImage=nullptr, bool update=true)
Grab the memory of an itk::Image and put it into an mitk::Image channel.
Image::Pointer GrabItkImageMemory(itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=nullptr, const BaseGeometry *geometry=nullptr, bool update=true)
Grab the memory of an itk::Image (with a specific type) and put it into an mitk::Image.
Image::Pointer ImportItkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, const BaseGeometry *geometry=nullptr, bool update=true)
Import an itk::Image (with a specific type) as an mitk::Image.
#define MITK_EXPORT
Definition: mitkCommon.h:222
Find image slices visible on a given plane.