VTK-m  2.2
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
vtkm::io::BasePixel< BitDepth, Channels > Class Template Referenceabstract

Base type for more complex pixels (RGB, Greyscale, etc) that describes various values such as bit-depth, channel width, bytes per pixel, and how various data should be polled. More...

#include <PixelTypes.h>

Inheritance diagram for vtkm::io::BasePixel< BitDepth, Channels >:
vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels >

Public Types

using Superclass = vtkm::Vec< typename ComponentTypeFromSize< BitDepth >::type, Channels >
 
using ComponentType = typename Superclass::ComponentType
 
using BaseType = BasePixel< BitDepth, Channels >
 
- Public Types inherited from vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels >
using ComponentType = ComponentTypeFromSize< BitDepth >::type
 

Public Member Functions

 BasePixel ()=default
 
 BasePixel (const unsigned char *imageData, const vtkm::Id index)
 Fills in this->Components by calling ConstructPixelFromImage. More...
 
virtual ~BasePixel ()=default
 
virtual ComponentType Diff (const BaseType &pixel) const =0
 Calculates this difference between two pixels as a single value. More...
 
virtual vtkm::Vec4f_32 ToVec4f () const =0
 Generates a Vec4f_32 from the current data available in the pixel. More...
 
void FillImageAtIndexWithPixel (unsigned char *imageData, const vtkm::Id index)
 Takes an output imageData pointer and in index to a location in that dataset and fills in the pixel data at the location. More...
 
- Public Member Functions inherited from vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels >
 Vec ()=default
 
void CopyInto (Vec< ComponentTypeFromSize< BitDepth >::type, Size > &dest) const
 

Static Public Member Functions

static constexpr vtkm::IdComponent GetBitDepth ()
 

Static Public Attributes

static constexpr vtkm::IdComponent BIT_DEPTH = BitDepth
 
static constexpr vtkm::IdComponent NUM_BYTES = BitDepth / 8
 
static constexpr vtkm::IdComponent MAX_COLOR_VALUE = (1 << BitDepth) - 1
 
static constexpr vtkm::IdComponent NUM_CHANNELS = Superclass::NUM_COMPONENTS
 
static constexpr vtkm::IdComponent BYTES_PER_PIXEL = NUM_CHANNELS * NUM_BYTES
 
- Static Public Attributes inherited from vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels >
static constexpr vtkm::IdComponent NUM_COMPONENTS
 

Protected Member Functions

void ConstructPixelFromImage (const unsigned char *imageData, const vtkm::Id index)
 Takes an input imageData pointer and an index to a location in that dataset and fills in this->Components correctly using the provided BIT_DEPTH and NUM_CHANNELS. More...
 
virtual void print (std::ostream &os) const =0
 

Friends

std::ostream & operator<< (std::ostream &os, const BaseType &basePixel)
 Implement the << operator for this class type. More...
 

Detailed Description

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
class vtkm::io::BasePixel< BitDepth, Channels >

Base type for more complex pixels (RGB, Greyscale, etc) that describes various values such as bit-depth, channel width, bytes per pixel, and how various data should be polled.

BasePixel takes BitDepth and Channels as template parameters. BitDepth describes the number of bits in the pixel, while Channels describes the multiple of bits that are available. BasePixel extends vtkm::Vec. The ComponentType is pulled from the ComponentTypeFromSize SFINAE struct defined above. This helps with optimizing the pixel size for a given bit-depth. The Size is pulled from the Channels param.

BasePixel requires BitDepths that are > 8 and powers of 2 at the moment. BitDepths of 4, 2, or 1 bit are not correctly handled at the moment.

BasePixel describes how to populate itself from an unsigned char pointer (assuming that the data stored within the pointer matches the bit-depth and channels described by the BasePixel type), and how to fill in data for an unsigned char pointer. This is mostly useful in serialization and deserialization to various image formats.

Member Typedef Documentation

◆ BaseType

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
using vtkm::io::BasePixel< BitDepth, Channels >::BaseType = BasePixel<BitDepth, Channels>

◆ ComponentType

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
using vtkm::io::BasePixel< BitDepth, Channels >::ComponentType = typename Superclass::ComponentType

◆ Superclass

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
using vtkm::io::BasePixel< BitDepth, Channels >::Superclass = vtkm::Vec<typename ComponentTypeFromSize<BitDepth>::type, Channels>

Constructor & Destructor Documentation

◆ BasePixel() [1/2]

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
vtkm::io::BasePixel< BitDepth, Channels >::BasePixel ( )
default

◆ BasePixel() [2/2]

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
vtkm::io::BasePixel< BitDepth, Channels >::BasePixel ( const unsigned char *  imageData,
const vtkm::Id  index 
)
inline

Fills in this->Components by calling ConstructPixelFromImage.

Requires the base vec values to be zeroed out initially.

◆ ~BasePixel()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
virtual vtkm::io::BasePixel< BitDepth, Channels >::~BasePixel ( )
virtualdefault

Member Function Documentation

◆ ConstructPixelFromImage()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
void vtkm::io::BasePixel< BitDepth, Channels >::ConstructPixelFromImage ( const unsigned char *  imageData,
const vtkm::Id  index 
)
protected

Takes an input imageData pointer and an index to a location in that dataset and fills in this->Components correctly using the provided BIT_DEPTH and NUM_CHANNELS.

Does NOT 0 out the current Components.

◆ Diff()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
virtual ComponentType vtkm::io::BasePixel< BitDepth, Channels >::Diff ( const BaseType pixel) const
pure virtual

Calculates this difference between two pixels as a single value.

◆ FillImageAtIndexWithPixel()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
void vtkm::io::BasePixel< BitDepth, Channels >::FillImageAtIndexWithPixel ( unsigned char *  imageData,
const vtkm::Id  index 
)

Takes an output imageData pointer and in index to a location in that dataset and fills in the pixel data at the location.

Utilizes BIT_DEPTH and NUM_CHANNELS to fill in multiple bytes worth of data if necessary.

◆ GetBitDepth()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
static constexpr vtkm::IdComponent vtkm::io::BasePixel< BitDepth, Channels >::GetBitDepth ( )
inlinestaticconstexpr

◆ print()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
virtual void vtkm::io::BasePixel< BitDepth, Channels >::print ( std::ostream &  os) const
protectedpure virtual

◆ ToVec4f()

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
virtual vtkm::Vec4f_32 vtkm::io::BasePixel< BitDepth, Channels >::ToVec4f ( ) const
pure virtual

Generates a Vec4f_32 from the current data available in the pixel.

Friends And Related Function Documentation

◆ operator<<

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
std::ostream& operator<< ( std::ostream &  os,
const BaseType basePixel 
)
friend

Implement the << operator for this class type.

Will call the overloaded print method for the subclassed type.

Member Data Documentation

◆ BIT_DEPTH

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
constexpr vtkm::IdComponent vtkm::io::BasePixel< BitDepth, Channels >::BIT_DEPTH = BitDepth
staticconstexpr

◆ BYTES_PER_PIXEL

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
constexpr vtkm::IdComponent vtkm::io::BasePixel< BitDepth, Channels >::BYTES_PER_PIXEL = NUM_CHANNELS * NUM_BYTES
staticconstexpr

◆ MAX_COLOR_VALUE

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
constexpr vtkm::IdComponent vtkm::io::BasePixel< BitDepth, Channels >::MAX_COLOR_VALUE = (1 << BitDepth) - 1
staticconstexpr

◆ NUM_BYTES

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
constexpr vtkm::IdComponent vtkm::io::BasePixel< BitDepth, Channels >::NUM_BYTES = BitDepth / 8
staticconstexpr

◆ NUM_CHANNELS

template<const vtkm::Id BitDepth, const vtkm::IdComponent Channels>
constexpr vtkm::IdComponent vtkm::io::BasePixel< BitDepth, Channels >::NUM_CHANNELS = Superclass::NUM_COMPONENTS
staticconstexpr

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