Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef _MITK_IMAGE_WRITER__H_
18 #define _MITK_IMAGE_WRITER__H_
19 
20 #include <MitkLegacyIOExports.h>
22 
23 namespace mitk
24 {
25  class Image;
35  {
36  public:
38 
39  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
40 
42 
47  virtual void SetFileName(const char *fileName) override;
48  virtual void SetFileName(const std::string &fileName);
49 
53  itkGetStringMacro(FileName);
54 
60  virtual void SetExtension(const char *extension);
61  virtual void SetExtension(const std::string &extension);
62 
68  itkGetStringMacro(Extension);
69 
73  void SetDefaultExtension();
74 
78  itkSetStringMacro(FilePrefix);
79 
83  itkGetStringMacro(FilePrefix);
84 
88  itkSetStringMacro(FilePattern);
89 
93  itkGetStringMacro(FilePattern);
94 
99  void SetInput(mitk::Image *input);
100 
101  //##Documentation
102  //## @brief Return the possible file extensions for the data type associated with the writer
103  virtual std::vector<std::string> GetPossibleFileExtensions() override;
104 
105  virtual std::string GetSupportedBaseData() const override;
106 
110  virtual std::string GetFileExtension() override;
111 
115  virtual bool CanWriteDataType(DataNode *) override;
116 
120  virtual std::string GetWritenMIMEType() override;
121 
122  using Superclass::SetInput;
126  virtual void SetInput(DataNode *);
127 
131  const mitk::Image *GetInput();
132 
133  // FileWriterWithInformation methods
134  virtual const char *GetDefaultFilename() override;
135  virtual const char *GetFileDialogPattern() override;
136  virtual const char *GetDefaultExtension() override;
137  virtual bool CanWriteBaseDataType(BaseData::Pointer data) override;
138  virtual void DoWrite(BaseData::Pointer data) override;
139 
140  void SetUseCompression(bool useCompression);
141 
142  protected:
146  ImageWriter();
147 
151  virtual ~ImageWriter();
152 
153  virtual void GenerateData() override;
154 
155  virtual void WriteByITK(mitk::Image *image, const std::string &fileName);
156 
157  std::string m_FileName;
158 
159  std::string m_FileNameWithoutExtension;
160 
161  std::string m_FilePrefix;
162 
163  std::string m_FilePattern;
164 
165  std::string m_Extension;
166 
167  std::string m_MimeType;
168 
169  bool m_UseCompression;
170  };
171 }
172 
173 #endif //_MITK_IMAGE_WRITER__H_
#define MITKLEGACYIO_EXPORT
Base of all data objects.
Definition: mitkBaseData.h:39
STL namespace.
DataCollection - Class to facilitate loading/accessing structured data.
Interface for FileWriters with extra information. Should be merged into FileWriter.
Writer for mitk::Image.
class ITK_EXPORT Image
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
Image class for storing images.
Definition: mitkImage.h:76
Interface class of writers that write data to files.
itk::ProcessObject Superclass
#define mitkWriterMacro
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66