Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkImageWriter.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 mitkImageWriter_h
14 #define mitkImageWriter_h
15 
16 #include <MitkLegacyIOExports.h>
18 
19 namespace mitk
20 {
21  class Image;
31  {
32  public:
34 
35  itkFactorylessNewMacro(Self);
36 
37  itkCloneMacro(Self);
38 
40 
45  void SetFileName(const char *fileName) override;
46  virtual void SetFileName(const std::string &fileName);
47 
51  itkGetStringMacro(FileName);
52 
58  virtual void SetExtension(const char *extension);
59  virtual void SetExtension(const std::string &extension);
60 
66  itkGetStringMacro(Extension);
67 
72 
76  itkSetStringMacro(FilePrefix);
77 
81  itkGetStringMacro(FilePrefix);
82 
86  itkSetStringMacro(FilePattern);
87 
91  itkGetStringMacro(FilePattern);
92 
97  void SetInput(mitk::Image *input);
98 
99  //##Documentation
100  //## @brief Return the possible file extensions for the data type associated with the writer
101  std::vector<std::string> GetPossibleFileExtensions() override;
102 
103  std::string GetSupportedBaseData() const override;
104 
108  std::string GetFileExtension() override;
109 
113  bool CanWriteDataType(DataNode *) override;
114 
118  std::string GetWritenMIMEType() override;
119 
120  using Superclass::SetInput;
124  virtual void SetInput(DataNode *);
125 
130 
131  // FileWriterWithInformation methods
132  const char *GetDefaultFilename() override;
133  const char *GetFileDialogPattern() override;
134  const char *GetDefaultExtension() override;
135  bool CanWriteBaseDataType(BaseData::Pointer data) override;
136  void DoWrite(BaseData::Pointer data) override;
137 
138  void SetUseCompression(bool useCompression);
139 
140  protected:
145 
149  ~ImageWriter() override;
150 
151  void GenerateData() override;
152 
153  virtual void WriteByITK(mitk::Image *image, const std::string &fileName);
154 
155  std::string m_FileName;
156 
158 
159  std::string m_FilePrefix;
160 
161  std::string m_FilePattern;
162 
163  std::string m_Extension;
164 
165  std::string m_MimeType;
166 
168  };
169 }
170 
171 #endif
#define MITKLEGACYIO_EXPORT
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64
Interface for FileWriters with extra information. Should be merged into FileWriter.
Interface class of writers that write data to files.
Writer for mitk::Image.
std::string m_FilePrefix
const mitk::Image * GetInput()
virtual void SetInput(DataNode *)
Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
std::string GetWritenMIMEType() override
Return the MimeType of the saved File.
const char * GetFileDialogPattern() override
void SetInput(mitk::Image *input)
void SetUseCompression(bool useCompression)
virtual void SetExtension(const char *extension)
Explicitly set the extension to be added to the filename.
virtual void SetFileName(const std::string &fileName)
bool CanWriteBaseDataType(BaseData::Pointer data) override
mitkClassMacro(ImageWriter, mitk::FileWriter)
std::string m_FileNameWithoutExtension
std::string m_Extension
virtual void WriteByITK(mitk::Image *image, const std::string &fileName)
std::string GetSupportedBaseData() const override
bool CanWriteDataType(DataNode *) override
Check if the Writer can write the Content of the.
~ImageWriter() override
void GenerateData() override
const char * GetDefaultExtension() override
std::string m_MimeType
void DoWrite(BaseData::Pointer data) override
std::string m_FilePattern
std::string GetFileExtension() override
Return the extension to be added to the filename.
void SetFileName(const char *fileName) override
std::string m_FileName
const char * GetDefaultFilename() override
std::vector< std::string > GetPossibleFileExtensions() override
Return the possible file extensions for the data type associated with the writer.
void SetDefaultExtension()
Set the extension to be added to the filename to the default.
virtual void SetExtension(const std::string &extension)
Image class for storing images.
Definition: mitkImage.h:70
class ITK_EXPORT Image
Find image slices visible on a given plane.