Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkItkImageIO.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 mitkItkImageIO_h
14 #define mitkItkImageIO_h
15 
16 #include "mitkAbstractFileIO.h"
17 #include <mitkImage.h>
18 #include <itkImageIOBase.h>
19 
20 namespace mitk
21 {
34  {
35  public:
36  ItkImageIO(itk::ImageIOBase::Pointer imageIO);
37  ItkImageIO(const CustomMimeType &mimeType, itk::ImageIOBase::Pointer imageIO, int rank);
38 
39  // -------------- AbstractFileReader -------------
40 
42 
43  ConfidenceLevel GetReaderConfidenceLevel() const override;
44 
45  // -------------- AbstractFileWriter -------------
46 
47  void Write() override;
48  ConfidenceLevel GetWriterConfidenceLevel() const override;
49 
57  static PropertyList::Pointer ExtractMetaDataAsPropertyList(const itk::MetaDataDictionary& dictionary, const std::string& mimeTypeName, const std::vector<std::string>& defaultMetaDataKeys);
58 
61  static Image::Pointer LoadRawMitkImageFromImageIO(itk::ImageIOBase* imageIO, const std::string& path);
62 
65  static void PreparImageIOToWriteImage(itk::ImageIOBase* imageIO, const Image* image);
66 
67  static void SavePropertyListAsMetaData(itk::MetaDataDictionary& dictionary, const PropertyList* properties, const std::string& mimeTypeName);
68 
69 
70  protected:
71  virtual std::vector<std::string> FixUpImageIOExtensions(const std::string &imageIOName);
72  virtual void FixUpCustomMimeTypeName(const std::string &imageIOName, CustomMimeType &customMimeType);
73 
74  // Fills the m_DefaultMetaDataKeys vector with default values
75  virtual void InitializeDefaultMetaDataKeys();
76 
77  // -------------- AbstractFileReader -------------
78  std::vector<itk::SmartPointer<BaseData>> DoRead() override;
79 
80  private:
81  ItkImageIO(const ItkImageIO &other);
82 
83  ItkImageIO *IOClone() const override;
84 
85  itk::ImageIOBase::Pointer m_ImageIO;
86 
87  std::vector<std::string> m_DefaultMetaDataKeys;
88  };
89 
92  MITKCORE_EXPORT std::vector<TimePointType> ConvertMetaDataObjectToTimePointList(const itk::MetaDataObjectBase* data);
93 
94 
98  MITKCORE_EXPORT itk::MetaDataObjectBase::Pointer ConvertTimePointListToMetaDataObject(const mitk::TimeGeometry* timeGeometry);
99 
100 } // namespace mitk
101 
102 #endif
mitk::ConvertTimePointListToMetaDataObject
MITKCORE_EXPORT itk::MetaDataObjectBase::Pointer ConvertTimePointListToMetaDataObject(const mitk::TimeGeometry *timeGeometry)
mitk::TimeGeometry
Definition: mitkTimeGeometry.h:45
mitkImage.h
mitk::CustomMimeType
The CustomMimeType class represents a custom mime-type which may be registered as a service object....
Definition: mitkCustomMimeType.h:44
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkAbstractFileIO.h
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::ConvertMetaDataObjectToTimePointList
MITKCORE_EXPORT std::vector< TimePointType > ConvertMetaDataObjectToTimePointList(const itk::MetaDataObjectBase *data)
mitk::IFileIO::ConfidenceLevel
ConfidenceLevel
A confidence level describing the confidence of the reader or writer in handling the given data.
Definition: mitkIFileIO.h:45
mitk::AbstractFileIO
Abstract class for implementing a reader and writer.
Definition: mitkAbstractFileIO.h:69
mitk::AbstractFileReader::Read
std::vector< itk::SmartPointer< BaseData > > Read() override
Reads a path or stream and creates a list of BaseData objects.
mitk::ItkImageIO
Definition: mitkItkImageIO.h:33
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15