SimpleITK  
sitkImageSeriesWriter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef sitkImageSeriesWriter_h
19#define sitkImageSeriesWriter_h
20
21#include "sitkMacro.h"
22#include "sitkImage.h"
23#include "sitkProcessObject.h"
24#include "sitkPathType.h"
25#include "sitkIO.h"
27
28namespace itk
29{
30
31// Forward declaration for pointer
32class ImageIOBase;
33
34namespace simple
35{
36
53{
54public:
56
58
60
62 std::string
63 ToString() const override;
64
67 virtual std::vector<std::string>
69
82 virtual void
83 SetImageIO(const std::string & imageio);
84 virtual std::string
85 GetImageIO() const;
86 /* @} */
87
89 std::string
90 GetName() const override
91 {
92 return std::string("ImageSeriesWriter");
93 }
94
101 void
102 SetUseCompression(bool UseCompression);
103 bool
105
106 void
108 {
109 return this->SetUseCompression(true);
110 }
111 void
113 {
114 return this->SetUseCompression(false);
115 }
116
117
124 void
126 int
129
136 void
137 SetCompressor(const std::string &);
138 std::string
141
147 void
148 SetFileNames(const std::vector<PathType> & fileNames);
149 const std::vector<PathType> &
152
153
154 void
155 Execute(const Image &);
156 void
157 Execute(const Image & image, const std::vector<PathType> & inFileNames, bool useCompression, int compressionLevel);
158
159protected:
160 template <class TImageType>
161 void
162 ExecuteInternal(const Image & inImage);
163
164private:
166 GetImageIOBase(const PathType & fileName);
167
168 // function pointer type
169 typedef void (Self::*MemberFunctionType)(const Image &);
170
171 // friend to get access to executeInternal member
175
176 bool m_UseCompression{ false };
178 std::string m_Compressor;
179
180 std::vector<PathType> m_FileNames;
181
182 std::string m_ImageIOName;
183};
184
185
200SITKIO_EXPORT void
201WriteImage(const Image & image,
202 const std::vector<PathType> & fileNames,
203 bool useCompression = false,
204 int compressionLevel = -1);
205} // namespace simple
206} // namespace itk
207
208#endif
void SetCompressor(const std::string &)
A compression algorithm hint.
std::string ToString() const override
std::string GetName() const override
void SetFileNames(const std::vector< PathType > &fileNames)
void UseCompressionOn()
Set/Get name of ImageIO to use.
void Execute(const Image &image, const std::vector< PathType > &inFileNames, bool useCompression, int compressionLevel)
std::string GetCompressor()
A compression algorithm hint.
virtual std::string GetImageIO() const
Set/Get name of ImageIO to use.
void Execute(const Image &)
void(Self::* MemberFunctionType)(const Image &)
itk::SmartPointer< ImageIOBase > GetImageIOBase(const PathType &fileName)
const std::vector< PathType > & GetFileNames() const
void ExecuteInternal(const Image &inImage)
void UseCompressionOff()
Set/Get name of ImageIO to use.
bool GetUseCompression() const
Set/Get name of ImageIO to use.
int GetCompressionLevel() const
A hint for the amount of compression to be applied during writing.
static const detail::MemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory()
virtual std::vector< std::string > GetRegisteredImageIOs() const
Get a vector of the names of registered itk ImageIOs.
void SetCompressionLevel(int)
A hint for the amount of compression to be applied during writing.
virtual void SetImageIO(const std::string &imageio)
Set/Get name of ImageIO to use.
void SetUseCompression(bool UseCompression)
Enable compression if available for file type.
The Image class for SimpleITK.
Definition sitkImage.h:77
A class used to instantiate and generate function object to templated member functions.
std::string PathType
SITKIO_EXPORT void WriteImage(const Image &image, const PathType &fileName, bool useCompression=false, int compressionLevel=-1)
WriteImage is a procedural interface to the ImageFileWriter. class which is convenient for many image...
#define SITKIO_EXPORT
Definition sitkIO.h:33