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 
28 namespace itk
29 {
30 
31 // Forward declaration for pointer
32 class ImageIOBase;
33 
34 namespace simple
35 {
36 
53 {
54 public:
56 
57  ~ImageSeriesWriter() override;
58 
60 
62  std::string
63  ToString() const override;
64 
67  virtual std::vector<std::string>
68  GetRegisteredImageIOs() const;
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
104  GetUseCompression() const;
105 
106  SITK_RETURN_SELF_TYPE_HEADER
108  {
109  return this->SetUseCompression(true);
110  }
111  SITK_RETURN_SELF_TYPE_HEADER
113  {
114  return this->SetUseCompression(false);
115  }
124  SITK_RETURN_SELF_TYPE_HEADER
125  SetCompressionLevel(int);
126  int
127  GetCompressionLevel() const;
136  SITK_RETURN_SELF_TYPE_HEADER
137  SetCompressor(const std::string &);
138  std::string
139  GetCompressor();
147  SITK_RETURN_SELF_TYPE_HEADER
148  SetFileNames(const std::vector<PathType> & fileNames);
149  const std::vector<PathType> &
150  GetFileNames() const;
154  SITK_RETURN_SELF_TYPE_HEADER
155  Execute(const Image &);
156  SITK_RETURN_SELF_TYPE_HEADER
157  Execute(const Image & image, const std::vector<PathType> & inFileNames, bool useCompression, int compressionLevel);
158 
159 protected:
160  template <class TImageType>
161  Self &
162  ExecuteInternal(const Image & inImage);
163 
164 private:
166  GetImageIOBase(const PathType & fileName);
167 
168  // function pointer type
169  typedef Self & (Self::*MemberFunctionType)(const Image &);
170 
171  // friend to get access to executeInternal member
172  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
173  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType>> m_MemberFactory;
174 
177  std::string m_Compressor;
178 
179  std::vector<PathType> m_FileNames;
180 
181  std::string m_ImageIOName;
182 };
183 
184 
199 SITKIO_EXPORT void
200 WriteImage(const Image & image,
201  const std::vector<PathType> & fileNames,
202  bool useCompression = false,
203  int compressionLevel = -1);
204 } // namespace simple
205 } // namespace itk
206 
207 #endif
itk::simple::Image
The Image class for SimpleITK.
Definition: sitkImage.h:76
itk::simple::ImageSeriesWriter::UseCompressionOn
Self & UseCompressionOn()
Set/Get name of ImageIO to use.
Definition: sitkImageSeriesWriter.h:107
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:29
itk::simple::ImageSeriesWriter::m_CompressionLevel
int m_CompressionLevel
Definition: sitkImageSeriesWriter.h:176
SITKIO_EXPORT
#define SITKIO_EXPORT
Definition: sitkIO.h:33
sitkImage.h
itk::simple::ImageSeriesWriter::MemberFunctionType
Self &(Self::* MemberFunctionType)(const Image &)
Definition: sitkImageSeriesWriter.h:169
itk::SmartPointer
Definition: sitkImage.h:38
sitkPathType.h
itk::simple::ioutils::GetRegisteredImageIOs
SITKIO_HIDDEN std::vector< std::string > GetRegisteredImageIOs()
sitkMemberFunctionFactory.h
itk::simple::ImageSeriesWriter::m_Compressor
std::string m_Compressor
Definition: sitkImageSeriesWriter.h:177
itk::simple::ImageSeriesWriter::UseCompressionOff
Self & UseCompressionOff()
Set/Get name of ImageIO to use.
Definition: sitkImageSeriesWriter.h:112
sitkProcessObject.h
sitkMacro.h
itk::simple::WriteImage
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...
itk::simple::ImageSeriesWriter::GetName
std::string GetName() const override
Definition: sitkImageSeriesWriter.h:90
itk
itk::simple::ImageSeriesWriter::m_UseCompression
bool m_UseCompression
Definition: sitkImageSeriesWriter.h:175
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:54
itk::simple::ImageSeriesWriter::m_FileNames
std::vector< PathType > m_FileNames
Definition: sitkImageSeriesWriter.h:179
itk::simple::ImageSeriesWriter::m_ImageIOName
std::string m_ImageIOName
Definition: sitkImageSeriesWriter.h:181
AddImageFilter
sitkIO.h
itk::simple::PathType
std::string PathType
Definition: sitkPathType.h:25
itk::simple::ImageSeriesWriter
Writer series of image from a SimpleITK image.
Definition: sitkImageSeriesWriter.h:52
itk::simple::ImageSeriesWriter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkImageSeriesWriter.h:173