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 "sitkIO.h"
26 
27 namespace itk {
28 
29 // Forward declaration for pointer
30 class ImageIOBase;
31 
32  namespace simple {
33 
50  : public ProcessObject
51  {
52  public:
54 
55  ~ImageSeriesWriter() override;
56 
58 
60  std::string ToString() const override;
61 
64  virtual std::vector<std::string> GetRegisteredImageIOs() const;
65 
78  virtual SITK_RETURN_SELF_TYPE_HEADER SetImageIO(const std::string &imageio);
79  virtual std::string GetImageIO( ) const;
80  /* @} */
81 
83  std::string GetName() const override { return std::string("ImageSeriesWriter"); }
84 
91  SITK_RETURN_SELF_TYPE_HEADER SetUseCompression( bool UseCompression );
92  bool GetUseCompression( ) const;
93 
94  SITK_RETURN_SELF_TYPE_HEADER UseCompressionOn( ) { return this->SetUseCompression(true); }
95  SITK_RETURN_SELF_TYPE_HEADER UseCompressionOff( ) { return this->SetUseCompression(false); }
104  SITK_RETURN_SELF_TYPE_HEADER SetCompressionLevel(int);
105  int GetCompressionLevel() const;
114  SITK_RETURN_SELF_TYPE_HEADER SetCompressor(const std::string &);
115  std::string GetCompressor();
123  SITK_RETURN_SELF_TYPE_HEADER SetFileNames ( const std::vector<std::string> &fileNames );
124  const std::vector<std::string> &GetFileNames() const;
128  SITK_RETURN_SELF_TYPE_HEADER Execute( const Image& );
129  SITK_RETURN_SELF_TYPE_HEADER Execute( const Image &image, const std::vector<std::string> &inFileNames, bool useCompression, int compressionLevel );
130 
131  protected:
132 
133  template <class TImageType> Self &ExecuteInternal ( const Image& inImage );
134 
135  private:
136 
137  itk::SmartPointer<ImageIOBase> GetImageIOBase(const std::string &fileName);
138 
139  // function pointer type
140  typedef Self& (Self::*MemberFunctionType)( const Image& );
141 
142  // friend to get access to executeInternal member
143  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
144  std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
145 
148  std::string m_Compressor;
149 
150  std::vector<std::string> m_FileNames;
151 
152  std::string m_ImageIOName;
153  };
154 
155 
170  SITKIO_EXPORT void WriteImage(const Image & image,
171  const std::vector<std::string> & fileNames,
172  bool useCompression = false,
173  int compressionLevel = -1);
174  }
175 }
176 
177 #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:94
itk::simple::detail::MemberFunctionAddressor
Definition: sitkDetail.h:28
itk::simple::ImageSeriesWriter::m_CompressionLevel
int m_CompressionLevel
Definition: sitkImageSeriesWriter.h:147
SITKIO_EXPORT
#define SITKIO_EXPORT
Definition: sitkIO.h:33
sitkImage.h
itk::simple::ImageSeriesWriter::MemberFunctionType
Self &(Self::* MemberFunctionType)(const Image &)
Definition: sitkImageSeriesWriter.h:140
itk::SmartPointer
Definition: sitkImage.h:38
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:148
itk::simple::ImageSeriesWriter::UseCompressionOff
Self & UseCompressionOff()
Set/Get name of ImageIO to use.
Definition: sitkImageSeriesWriter.h:95
sitkProcessObject.h
sitkMacro.h
itk::simple::ImageSeriesWriter::GetName
std::string GetName() const override
Definition: sitkImageSeriesWriter.h:83
itk::simple::WriteImage
SITKIO_EXPORT void WriteImage(const Image &image, const std::string &fileName, bool useCompression=false, int compressionLevel=-1)
WriteImage is a procedural interface to the ImageFileWriter. class which is convenient for many image...
itk
itk::simple::ImageSeriesWriter::m_UseCompression
bool m_UseCompression
Definition: sitkImageSeriesWriter.h:146
itk::simple::ProcessObject
Base class for SimpleITK classes based on ProcessObject.
Definition: sitkProcessObject.h:51
itk::simple::ImageSeriesWriter::m_ImageIOName
std::string m_ImageIOName
Definition: sitkImageSeriesWriter.h:152
AddImageFilter
sitkIO.h
itk::simple::ImageSeriesWriter
Writer series of image from a SimpleITK image.
Definition: sitkImageSeriesWriter.h:49
itk::simple::ImageSeriesWriter::m_MemberFactory
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
Definition: sitkImageSeriesWriter.h:144
itk::simple::ImageSeriesWriter::m_FileNames
std::vector< std::string > m_FileNames
Definition: sitkImageSeriesWriter.h:150