Inviwo  0.9.10.1
Inviwo documentation
inviwo::Image Class Reference
+ Inheritance diagram for inviwo::Image:

Public Types

using DataBuffer = std::unique_ptr< std::vector< unsigned char > >
 
- Public Types inherited from inviwo::DataGroup< Image, ImageRepresentation >
using self = Image
 
using repr = ImageRepresentation
 

Public Member Functions

 Image (size2_t dimensions=size2_t(8, 8), const DataFormatBase *format=DataVec4UInt8::get())
 
 Image (std::shared_ptr< Layer > layer)
 
 Image (const Image &)
 
Imageoperator= (const Image &that)
 
virtual Imageclone () const
 
virtual Document getInfo () const
 
const LayergetLayer (LayerType, size_t idx=0) const
 
LayergetLayer (LayerType, size_t idx=0)
 
const LayergetColorLayer (size_t idx=0) const
 
LayergetColorLayer (size_t idx=0)
 
void addColorLayer (std::shared_ptr< Layer > layer)
 
size_t getNumberOfColorLayers () const
 
const LayergetDepthLayer () const
 
LayergetDepthLayer ()
 
const LayergetPickingLayer () const
 
LayergetPickingLayer ()
 
size2_t getDimensions () const
 
void setDimensions (size2_t dimensions)
 
DataBuffer getLayerAsCodedBuffer (LayerType layerType, const std::string &fileExtension, size_t idx=0) const
 encode the requested layer contents to a buffer considering the given image extension More...
 
DataBuffer getColorLayerAsCodedBuffer (const std::string &fileExtension, size_t idx=0) const
 
DataBuffer getDepthLayerAsCodedBuffer (const std::string &fileExtension) const
 
DataBuffer getPickingLayerAsCodedBuffer (const std::string &fileExtension) const
 
void copyRepresentationsTo (Image *target) const
 
const DataFormatBasegetDataFormat () const
 
dvec4 readPixel (size2_t pos, LayerType layer, size_t index=0) const
 
- Public Member Functions inherited from inviwo::DataGroup< Image, ImageRepresentation >
const T * getRepresentation () const
 
T * getEditableRepresentation ()
 
bool hasRepresentation () const
 
bool hasRepresentations () const
 
void clearRepresentations ()
 
- Public Member Functions inherited from inviwo::MetaDataOwner
 MetaDataOwner (const MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
 
void copyMetaDataFrom (const MetaDataOwner &src)
 
void copyMetaDataTo (MetaDataOwner &dst)
 
template<typename T >
T * createMetaData (const std::string &key)
 
template<typename T , typename U >
void setMetaData (const std::string &key, U value)
 
template<typename T >
bool unsetMetaData (const std::string &key)
 unset, i.e. remove the metadata entry matching the given key and type More...
 
template<typename T , typename U >
getMetaData (const std::string &key, U val) const
 
template<typename T >
T * getMetaData (const std::string &key)
 
template<typename T >
const T * getMetaData (const std::string &key) const
 
MetaDataMapgetMetaDataMap ()
 
const MetaDataMapgetMetaDataMap () const
 
template<typename T >
bool hasMetaData (const std::string &key) const
 
virtual void serialize (Serializer &s) const
 
virtual void deserialize (Deserializer &d)
 

Static Public Attributes

static uvec3 colorCode = uvec3(90, 127, 183)
 
static const std::string classIdentifier = "org.inviwo.Image"
 
static const std::string dataName = "Image"
 

Static Protected Member Functions

static std::shared_ptr< LayercreateColorLayer (size2_t dimensions=size2_t(8, 8), const DataFormatBase *format=DataVec4UInt8::get())
 
static std::shared_ptr< LayercreateDepthLayer (size2_t dimensions=size2_t(8, 8))
 
static std::shared_ptr< LayercreatePickingLayer (size2_t dimensions=size2_t(8, 8), const DataFormatBase *format=DataVec4UInt8::get())
 

Protected Attributes

std::vector< std::shared_ptr< Layer > > colorLayers_
 
std::shared_ptr< LayerdepthLayer_
 
std::shared_ptr< LayerpickingLayer_
 
- Protected Attributes inherited from inviwo::DataGroup< Image, ImageRepresentation >
std::mutex mutex_
 
std::unordered_map< std::type_index, std::shared_ptr< ImageRepresentation > > representations_
 
- Protected Attributes inherited from inviwo::MetaDataOwner
MetaDataMap metaData_
 

Additional Inherited Members

- Protected Member Functions inherited from inviwo::DataGroup< Image, ImageRepresentation >
 DataGroup (const DataGroup< Image, ImageRepresentation > &rhs)
 
DataGroup< Image, ImageRepresentation > & operator= (const DataGroup< Image, ImageRepresentation > &rhs)
 

Member Function Documentation

◆ copyRepresentationsTo()

void inviwo::Image::copyRepresentationsTo ( Image target) const

Copy and resize the representation of this onto the representations of target. Does not change the dimensions of target.

◆ getLayerAsCodedBuffer()

std::unique_ptr< std::vector< unsigned char > > inviwo::Image::getLayerAsCodedBuffer ( LayerType  layerType,
const std::string &  fileExtension,
size_t  idx = 0 
) const

encode the requested layer contents to a buffer considering the given image extension

Parameters
layerTypeIndicate which type of layer to return. see LayerType
fileExtensionfile extension of the requested image format
idxIn case of layerType being LayerType::ColorLayer, than return color layer at index idx
Returns
encoded layer contents as std::vector

◆ readPixel()

dvec4 inviwo::Image::readPixel ( size2_t  pos,
LayerType  layer,
size_t  index = 0 
) const

Read a single pixel value out of the specified layer at pos. Should only be used to read single values not entire images.

◆ setDimensions()

void inviwo::Image::setDimensions ( size2_t  dimensions)

Resize all representation to dimension. This is destructive, the data will not be preserved. Use copyRepresentationsTo to update the data.


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