SimpleITK  
itk::simple::ImageFileWriter Class Reference

Write out a SimpleITK image to the specified file location. More...

#include <sitkImageFileWriter.h>

+ Inheritance diagram for itk::simple::ImageFileWriter:
+ Collaboration diagram for itk::simple::ImageFileWriter:

Detailed Description

Public Types

using PixelIDTypeList = NonLabelPixelIDTypeList
 
using Self = ImageFileWriter
 
- Public Types inherited from itk::simple::ProcessObject
using Self = ProcessObject
 

Public Member Functions

void Execute (const Image &)
 
void Execute (const Image &, const PathType &inFileName, bool useCompression, int compressionLevel)
 
PathType GetFileName () const
 
std::string GetName () const override
 
virtual std::vector< std::string > GetRegisteredImageIOs () const
 Get a vector of the names of registered itk ImageIOs.
 
 ImageFileWriter ()
 
void SetFileName (const PathType &fileName)
 
std::string ToString () const override
 
 ~ImageFileWriter () override
 
void SetUseCompression (bool UseCompression)
 Enable compression if available for file type.
 
bool GetUseCompression () const
 Enable compression if available for file type.
 
void UseCompressionOn ()
 Enable compression if available for file type.
 
void UseCompressionOff ()
 Enable compression if available for file type.
 
void SetCompressionLevel (int)
 A hint for the amount of compression to be applied during writing.
 
int GetCompressionLevel () const
 A hint for the amount of compression to be applied during writing.
 
void SetCompressor (const std::string &)
 A compression algorithm hint.
 
std::string GetCompressor ()
 A compression algorithm hint.
 
virtual void SetImageIO (const std::string &imageio)
 Set/Get name of ImageIO to use.
 
virtual std::string GetImageIO () const
 Set/Get name of ImageIO to use.
 
void SetKeepOriginalImageUID (bool KeepOriginalImageUID)
 Use the original study/series/frame of reference.
 
bool GetKeepOriginalImageUID () const
 Set/Get name of ImageIO to use.
 
void KeepOriginalImageUIDOn ()
 Set/Get name of ImageIO to use.
 
void KeepOriginalImageUIDOff ()
 Set/Get name of ImageIO to use.
 
- Public Member Functions inherited from itk::simple::ProcessObject
virtual void Abort ()
 
virtual int AddCommand (itk::simple::EventEnum event, const std::function< void()> &func)
 Directly add a callback to observe an event.
 
virtual int AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd)
 Add a Command Object to observer the event.
 
virtual float GetProgress () const
 An Active Measurement of the progress of execution.
 
virtual bool HasCommand (itk::simple::EventEnum event) const
 Query of this object has any registered commands for event.
 
 ProcessObject ()
 
virtual void RemoveAllCommands ()
 Remove all registered commands.
 
virtual ~ProcessObject ()
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
virtual bool GetDebug () const
 
virtual void SetDebug (bool debugFlag)
 
virtual void SetNumberOfThreads (unsigned int n)
 
virtual unsigned int GetNumberOfThreads () const
 
virtual void SetNumberOfWorkUnits (unsigned int n)
 
virtual unsigned int GetNumberOfWorkUnits () const
 

Private Types

typedef void(Self::* MemberFunctionType) (const Image &)
 

Private Member Functions

template<class T>
void ExecuteInternal (const Image &)
 
itk::SmartPointer< ImageIOBaseGetImageIOBase (const PathType &fileName)
 

Static Private Member Functions

static const detail::MemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory ()
 

Private Attributes

int m_CompressionLevel { -1 }
 
std::string m_Compressor
 
PathType m_FileName
 
std::string m_ImageIOName
 
bool m_KeepOriginalImageUID { false }
 
bool m_UseCompression { false }
 

Friends

struct detail::MemberFunctionAddressor< MemberFunctionType >
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::simple::ProcessObject
static bool GetGlobalDefaultDebug ()
 
static void GlobalDefaultDebugOff ()
 
static void GlobalDefaultDebugOn ()
 
static void SetGlobalDefaultDebug (bool debugFlag)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static void SetGlobalWarningDisplay (bool flag)
 
static bool GetGlobalWarningDisplay ()
 
static double GetGlobalDefaultCoordinateTolerance ()
 Access the global tolerance to determine congruent spaces.
 
static void SetGlobalDefaultCoordinateTolerance (double)
 Access the global tolerance to determine congruent spaces.
 
static double GetGlobalDefaultDirectionTolerance ()
 Access the global tolerance to determine congruent spaces.
 
static void SetGlobalDefaultDirectionTolerance (double)
 Access the global tolerance to determine congruent spaces.
 
static bool SetGlobalDefaultThreader (const std::string &threader)
 Set/Get the default threader used for process objects.
 
static std::string GetGlobalDefaultThreader ()
 Set/Get the default threader used for process objects.
 
static void SetGlobalDefaultNumberOfThreads (unsigned int n)
 
static unsigned int GetGlobalDefaultNumberOfThreads ()
 Set/Get the default threader used for process objects.
 
- Protected Member Functions inherited from itk::simple::ProcessObject
virtual unsigned long AddITKObserver (const itk::EventObject &, itk::Command *)
 
virtual itk::ProcessObjectGetActiveProcess ()
 
virtual void OnActiveProcessDelete ()
 
virtual void onCommandDelete (const itk::simple::Command *cmd) noexcept
 
virtual void PreUpdate (itk::ProcessObject *p)
 
virtual void RemoveITKObserver (EventCommand &e)
 
- Protected Member Functions inherited from itk::simple::NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
- Static Protected Member Functions inherited from itk::simple::ProcessObject
template<class TImageType>
static TImageType::ConstPointer CastImageToITK (const Image &img)
 
template<class TPixelType, unsigned int VImageDimension, unsigned int VLength, template< typename, unsigned int > class TVector>
static Image CastITKToImage (itk::Image< TVector< TPixelType, VLength >, VImageDimension > *img)
 
template<unsigned int VImageDimension, unsigned int VLength, template< unsigned int > class TVector>
static Image CastITKToImage (itk::Image< TVector< VLength >, VImageDimension > *img)
 
template<class TImageType>
static Image CastITKToImage (TImageType *img)
 
static const itk::EventObjectGetITKEventObject (EventEnum e)
 
template<typename T>
static std::ostream & ToStringHelper (std::ostream &os, const T &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const char &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const signed char &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const unsigned char &v)
 

Member Typedef Documentation

◆ MemberFunctionType

typedef void(Self::* itk::simple::ImageFileWriter::MemberFunctionType) (const Image &)
private

Definition at line 199 of file sitkImageFileWriter.h.

◆ PixelIDTypeList

◆ Self

Constructor & Destructor Documentation

◆ ~ImageFileWriter()

itk::simple::ImageFileWriter::~ImageFileWriter ( )
override

◆ ImageFileWriter()

itk::simple::ImageFileWriter::ImageFileWriter ( )

Member Function Documentation

◆ Execute() [1/2]

◆ Execute() [2/2]

void itk::simple::ImageFileWriter::Execute ( const Image & ,
const PathType & inFileName,
bool useCompression,
int compressionLevel )

◆ ExecuteInternal()

template<class T>
void itk::simple::ImageFileWriter::ExecuteInternal ( const Image & )
private

◆ GetCompressionLevel()

int itk::simple::ImageFileWriter::GetCompressionLevel ( ) const

A hint for the amount of compression to be applied during writing.

After compression is enabled and if the itk::ImageIO support this option, then this value may be used. The range is dependent upon the compression algorithm used. It is generally 0-100 for JPEG like lossy compression and 0-9 for lossless zip or LZW like compression algorithms. Please see the specific itk::ImageIO for details.

◆ GetCompressor()

std::string itk::simple::ImageFileWriter::GetCompressor ( )

A compression algorithm hint.

The default is an empty string which enables the default compression of the ImageIO if compression is enabled. If the string identifier is not known a warning is produced and the default compressor is used. Please see the itk::ImageIO for details.

◆ GetFileName()

PathType itk::simple::ImageFileWriter::GetFileName ( ) const

◆ GetImageIO()

virtual std::string itk::simple::ImageFileWriter::GetImageIO ( ) const
virtual

Set/Get name of ImageIO to use.

An option to override the automatically detected ImageIO used to write the image. The available ImageIOs are listed by the GetRegisteredImageIOs method. If the ImageIO can not be constructed an exception will be generated.

The default value is an empty string (""). This indicates that the ImageIO will be automatically determined by the ITK ImageIO factory mechanism.

◆ GetImageIOBase()

itk::SmartPointer< ImageIOBase > itk::simple::ImageFileWriter::GetImageIOBase ( const PathType & fileName)
private

◆ GetKeepOriginalImageUID()

bool itk::simple::ImageFileWriter::GetKeepOriginalImageUID ( ) const

Set/Get name of ImageIO to use.

An option to override the automatically detected ImageIO used to write the image. The available ImageIOs are listed by the GetRegisteredImageIOs method. If the ImageIO can not be constructed an exception will be generated.

The default value is an empty string (""). This indicates that the ImageIO will be automatically determined by the ITK ImageIO factory mechanism.

◆ GetMemberFunctionFactory()

static const detail::MemberFunctionFactory< MemberFunctionType > & itk::simple::ImageFileWriter::GetMemberFunctionFactory ( )
staticprivate

◆ GetName()

std::string itk::simple::ImageFileWriter::GetName ( ) const
inlineoverridevirtual

return user readable name of the filter

Implements itk::simple::ProcessObject.

Definition at line 69 of file sitkImageFileWriter.h.

◆ GetRegisteredImageIOs()

virtual std::vector< std::string > itk::simple::ImageFileWriter::GetRegisteredImageIOs ( ) const
virtual

Get a vector of the names of registered itk ImageIOs.

◆ GetUseCompression()

bool itk::simple::ImageFileWriter::GetUseCompression ( ) const

Enable compression if available for file type.

These methods Set/Get/Toggle the UseCompression flag which gets passed to image file's itk::ImageIO object. This is only a request as not all file formats support compression.

◆ KeepOriginalImageUIDOff()

void itk::simple::ImageFileWriter::KeepOriginalImageUIDOff ( )
inline

Set/Get name of ImageIO to use.

An option to override the automatically detected ImageIO used to write the image. The available ImageIOs are listed by the GetRegisteredImageIOs method. If the ImageIO can not be constructed an exception will be generated.

The default value is an empty string (""). This indicates that the ImageIO will be automatically determined by the ITK ImageIO factory mechanism.

Definition at line 166 of file sitkImageFileWriter.h.

References SetKeepOriginalImageUID().

◆ KeepOriginalImageUIDOn()

void itk::simple::ImageFileWriter::KeepOriginalImageUIDOn ( )
inline

Set/Get name of ImageIO to use.

An option to override the automatically detected ImageIO used to write the image. The available ImageIOs are listed by the GetRegisteredImageIOs method. If the ImageIO can not be constructed an exception will be generated.

The default value is an empty string (""). This indicates that the ImageIO will be automatically determined by the ITK ImageIO factory mechanism.

Examples
DicomSeriesFromArray/DicomSeriesFromArray.cs, DicomSeriesFromArray/DicomSeriesFromArray.cxx, DicomSeriesReadModifyWrite/DicomSeriesReadModifySeriesWrite.cs, and DicomSeriesReadModifyWrite/DicomSeriesReadModifySeriesWrite.cxx.

Definition at line 161 of file sitkImageFileWriter.h.

References SetKeepOriginalImageUID().

◆ SetCompressionLevel()

void itk::simple::ImageFileWriter::SetCompressionLevel ( int )

A hint for the amount of compression to be applied during writing.

After compression is enabled and if the itk::ImageIO support this option, then this value may be used. The range is dependent upon the compression algorithm used. It is generally 0-100 for JPEG like lossy compression and 0-9 for lossless zip or LZW like compression algorithms. Please see the specific itk::ImageIO for details.

◆ SetCompressor()

void itk::simple::ImageFileWriter::SetCompressor ( const std::string & )

A compression algorithm hint.

The default is an empty string which enables the default compression of the ImageIO if compression is enabled. If the string identifier is not known a warning is produced and the default compressor is used. Please see the itk::ImageIO for details.

◆ SetFileName()

◆ SetImageIO()

virtual void itk::simple::ImageFileWriter::SetImageIO ( const std::string & imageio)
virtual

Set/Get name of ImageIO to use.

An option to override the automatically detected ImageIO used to write the image. The available ImageIOs are listed by the GetRegisteredImageIOs method. If the ImageIO can not be constructed an exception will be generated.

The default value is an empty string (""). This indicates that the ImageIO will be automatically determined by the ITK ImageIO factory mechanism.

◆ SetKeepOriginalImageUID()

void itk::simple::ImageFileWriter::SetKeepOriginalImageUID ( bool KeepOriginalImageUID)

Use the original study/series/frame of reference.

These methods Set/Get/Toggle the KeepOriginalImageUID flag which gets passed to image file's itk::ImageIO object. This is relevant only for the DICOM file format, configuring the writer to use the information in the image's meta-data dictionary or to create new study/series/frame of reference values.

Referenced by KeepOriginalImageUIDOff(), and KeepOriginalImageUIDOn().

◆ SetUseCompression()

void itk::simple::ImageFileWriter::SetUseCompression ( bool UseCompression)

Enable compression if available for file type.

These methods Set/Get/Toggle the UseCompression flag which gets passed to image file's itk::ImageIO object. This is only a request as not all file formats support compression.

Referenced by UseCompressionOff(), and UseCompressionOn().

◆ ToString()

std::string itk::simple::ImageFileWriter::ToString ( ) const
overridevirtual

Print ourselves to string

Reimplemented from itk::simple::ProcessObject.

◆ UseCompressionOff()

void itk::simple::ImageFileWriter::UseCompressionOff ( )
inline

Enable compression if available for file type.

These methods Set/Get/Toggle the UseCompression flag which gets passed to image file's itk::ImageIO object. This is only a request as not all file formats support compression.

Definition at line 97 of file sitkImageFileWriter.h.

References SetUseCompression().

◆ UseCompressionOn()

void itk::simple::ImageFileWriter::UseCompressionOn ( )
inline

Enable compression if available for file type.

These methods Set/Get/Toggle the UseCompression flag which gets passed to image file's itk::ImageIO object. This is only a request as not all file formats support compression.

Definition at line 92 of file sitkImageFileWriter.h.

References SetUseCompression().

Friends And Related Symbol Documentation

◆ detail::MemberFunctionAddressor< MemberFunctionType >

Definition at line 199 of file sitkImageFileWriter.h.

Member Data Documentation

◆ m_CompressionLevel

int itk::simple::ImageFileWriter::m_CompressionLevel { -1 }
private

Definition at line 191 of file sitkImageFileWriter.h.

◆ m_Compressor

std::string itk::simple::ImageFileWriter::m_Compressor
private

Definition at line 192 of file sitkImageFileWriter.h.

◆ m_FileName

PathType itk::simple::ImageFileWriter::m_FileName
private

Definition at line 194 of file sitkImageFileWriter.h.

◆ m_ImageIOName

std::string itk::simple::ImageFileWriter::m_ImageIOName
private

Definition at line 196 of file sitkImageFileWriter.h.

◆ m_KeepOriginalImageUID

bool itk::simple::ImageFileWriter::m_KeepOriginalImageUID { false }
private

Definition at line 195 of file sitkImageFileWriter.h.

◆ m_UseCompression

bool itk::simple::ImageFileWriter::m_UseCompression { false }
private

Definition at line 190 of file sitkImageFileWriter.h.


The documentation for this class was generated from the following file: