Medical Imaging Interaction Toolkit  2023.04.00
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 
71  void SetDefaultExtension();
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 
129  const mitk::Image *GetInput();
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:
144  ImageWriter();
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
mitk::ImageWriter::m_FilePrefix
std::string m_FilePrefix
Definition: mitkImageWriter.h:159
mitk::ImageWriter::m_Extension
std::string m_Extension
Definition: mitkImageWriter.h:163
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
mitk::ImageWriter::mitkWriterMacro
mitkWriterMacro
Definition: mitkImageWriter.h:37
MitkLegacyIOExports.h
mitk::ImageWriter::m_FileNameWithoutExtension
std::string m_FileNameWithoutExtension
Definition: mitkImageWriter.h:157
mitk::ImageWriter::m_FilePattern
std::string m_FilePattern
Definition: mitkImageWriter.h:161
mitk::FileWriter
Interface class of writers that write data to files.
Definition: mitkFileWriter.h:26
mitk::ImageWriter::m_MimeType
std::string m_MimeType
Definition: mitkImageWriter.h:165
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::ImageWriter::m_FileName
std::string m_FileName
Definition: mitkImageWriter.h:155
mitkFileWriterWithInformation.h
MITKLEGACYIO_EXPORT
#define MITKLEGACYIO_EXPORT
Definition: MitkLegacyIOExports.h:15
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
itk::Image
class ITK_EXPORT Image
Definition: mitkGeometryClipImageFilter.h:25
mitk::ImageWriter::m_UseCompression
bool m_UseCompression
Definition: mitkImageWriter.h:167
mitk::ImageWriter
Writer for mitk::Image.
Definition: mitkImageWriter.h:30
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::FileWriterWithInformation
Interface for FileWriters with extra information. Should be merged into FileWriter.
Definition: mitkFileWriterWithInformation.h:27