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 SITK_RETURN_SELF_TYPE_HEADER
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 SITK_RETURN_SELF_TYPE_HEADER
102 SetUseCompression(bool UseCompression);
103 bool
105
106 SITK_RETURN_SELF_TYPE_HEADER
107 UseCompressionOn() { return this->SetUseCompression(true); }
108 SITK_RETURN_SELF_TYPE_HEADER
109 UseCompressionOff() { return this->SetUseCompression(false); }
111
118 SITK_RETURN_SELF_TYPE_HEADER
120 int
123
130 SITK_RETURN_SELF_TYPE_HEADER
131 SetCompressor(const std::string &);
132 std::string
135
141 SITK_RETURN_SELF_TYPE_HEADER
142 SetFileNames(const std::vector<PathType> & fileNames);
143 const std::vector<PathType> &
146
147
148 SITK_RETURN_SELF_TYPE_HEADER
149 Execute(const Image &);
150 SITK_RETURN_SELF_TYPE_HEADER
151 Execute(const Image & image, const std::vector<PathType> & inFileNames, bool useCompression, int compressionLevel);
152
153protected:
154 template <class TImageType>
155 Self &
156 ExecuteInternal(const Image & inImage);
157
158private:
160 GetImageIOBase(const PathType & fileName);
161
162 // function pointer type
163 typedef Self & (Self::*MemberFunctionType)(const Image &);
164
165 // friend to get access to executeInternal member
167 std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType>> m_MemberFactory;
168
171 std::string m_Compressor;
172
173 std::vector<PathType> m_FileNames;
174
175 std::string m_ImageIOName;
176};
177
178
193SITKIO_EXPORT void
194WriteImage(const Image & image,
195 const std::vector<PathType> & fileNames,
196 bool useCompression = false,
197 int compressionLevel = -1);
198} // namespace simple
199} // namespace itk
200
201#endif
Self & SetUseCompression(bool UseCompression)
Enable compression if available for file type.
Self & UseCompressionOff()
Set/Get name of ImageIO to use.
std::string ToString() const override
Self &(Self::* MemberFunctionType)(const Image &)
Self & SetCompressor(const std::string &)
A compression algorithm hint.
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Self & Execute(const Image &image, const std::vector< PathType > &inFileNames, bool useCompression, int compressionLevel)
Self & SetFileNames(const std::vector< PathType > &fileNames)
std::string GetName() const override
std::string GetCompressor()
A compression algorithm hint.
virtual std::string GetImageIO() const
Set/Get name of ImageIO to use.
Self & UseCompressionOn()
Set/Get name of ImageIO to use.
itk::SmartPointer< ImageIOBase > GetImageIOBase(const PathType &fileName)
const std::vector< PathType > & GetFileNames() const
virtual Self & SetImageIO(const std::string &imageio)
Set/Get name of ImageIO to use.
Self & Execute(const Image &)
Self & SetCompressionLevel(int)
A hint for the amount of compression to be applied during writing.
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.
virtual std::vector< std::string > GetRegisteredImageIOs() const
Get a vector of the names of registered itk ImageIOs.
Self & ExecuteInternal(const Image &inImage)
The Image class for SimpleITK.
Definition sitkImage.h:77
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