Viskores  1.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
viskores::io::ImageWriterBase Class Referenceabstract

Manages writing, and loading data from images. More...

#include <ImageWriterBase.h>

Inheritance diagram for viskores::io::ImageWriterBase:
viskores::io::ImageWriterHDF5 viskores::io::ImageWriterPNG viskores::io::ImageWriterPNM

Public Types

enum  PixelDepth { PixelDepth::PIXEL_8, PixelDepth::PIXEL_16 }
 
using ColorArrayType = viskores::cont::ArrayHandle< viskores::Vec4f_32 >
 

Public Member Functions

 ImageWriterBase (const char *filename)
 
 ImageWriterBase (const std::string &filename)
 Construct a writer to save data to the given file. More...
 
virtual ~ImageWriterBase () noexcept
 
 ImageWriterBase (const ImageWriterBase &)=delete
 
ImageWriterBaseoperator= (const ImageWriterBase &)=delete
 
virtual void WriteDataSet (const viskores::cont::DataSet &dataSet, const std::string &colorField={})
 Write the color field of a data set to an image file. More...
 
PixelDepth GetPixelDepth () const
 Specify the number of bits used by each color channel. More...
 
void SetPixelDepth (PixelDepth depth)
 Specify the number of bits used by each color channel. More...
 
const std::string & GetFileName () const
 
void SetFileName (const std::string &filename)
 

Protected Member Functions

virtual void Write (viskores::Id width, viskores::Id height, const ColorArrayType &pixels)=0
 

Protected Attributes

std::string FileName
 
PixelDepth Depth = PixelDepth::PIXEL_8
 

Detailed Description

Manages writing, and loading data from images.

ImageWriterBase implements methods for loading imaging data from a canvas or ArrayHandle and storing that data in a viskores::cont::DataSet. Image RGB values are represented as a point field in a 2D uniform dataset.

ImageWriterBase can be constructed from a file, canvas, or ArrayHandle. It can also be empy constructed and filled in with a dataset later.

ImageWriterBase implements virtual methods for writing files. Ideally, these methods will be overriden in various subclasses to implement specific functionality for writing data to specific image file-types.

Member Typedef Documentation

◆ ColorArrayType

Member Enumeration Documentation

◆ PixelDepth

Enumerator
PIXEL_8 
PIXEL_16 

Constructor & Destructor Documentation

◆ ImageWriterBase() [1/3]

viskores::io::ImageWriterBase::ImageWriterBase ( const char *  filename)

◆ ImageWriterBase() [2/3]

viskores::io::ImageWriterBase::ImageWriterBase ( const std::string &  filename)

Construct a writer to save data to the given file.

◆ ~ImageWriterBase()

virtual viskores::io::ImageWriterBase::~ImageWriterBase ( )
virtualnoexcept

◆ ImageWriterBase() [3/3]

viskores::io::ImageWriterBase::ImageWriterBase ( const ImageWriterBase )
delete

Member Function Documentation

◆ GetFileName()

const std::string& viskores::io::ImageWriterBase::GetFileName ( ) const
inline

◆ GetPixelDepth()

PixelDepth viskores::io::ImageWriterBase::GetPixelDepth ( ) const
inline

Specify the number of bits used by each color channel.

◆ operator=()

ImageWriterBase& viskores::io::ImageWriterBase::operator= ( const ImageWriterBase )
delete

◆ SetFileName()

void viskores::io::ImageWriterBase::SetFileName ( const std::string &  filename)
inline

◆ SetPixelDepth()

void viskores::io::ImageWriterBase::SetPixelDepth ( PixelDepth  depth)
inline

Specify the number of bits used by each color channel.

◆ Write()

virtual void viskores::io::ImageWriterBase::Write ( viskores::Id  width,
viskores::Id  height,
const ColorArrayType pixels 
)
protectedpure virtual

◆ WriteDataSet()

virtual void viskores::io::ImageWriterBase::WriteDataSet ( const viskores::cont::DataSet dataSet,
const std::string &  colorField = {} 
)
virtual

Write the color field of a data set to an image file.

The DataSet must have a 2D structured cell set.

The specified color field must be of type ColorArrayType (a basic ArrayHandle of viskores::Vec4f_32). If no color field name is given, the first point field that matches this criteria is written.

Reimplemented in viskores::io::ImageWriterHDF5.

Member Data Documentation

◆ Depth

PixelDepth viskores::io::ImageWriterBase::Depth = PixelDepth::PIXEL_8
protected

◆ FileName

std::string viskores::io::ImageWriterBase::FileName
protected

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