Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::Image Class Reference
+ Inheritance diagram for inviwo::Image:

Public Types

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

Public Member Functions

 Image (size2_t dimensions=size2_t(8, 8), const DataFormatBase *format=DataVec4UInt8::get())
 Create a new image with dimensions and format. The image will hold one color layer, one depth layer and one picking layer. The layers will not have any representations.
 
 Image (std::vector< std::shared_ptr< Layer > > layers)
 Create an Image from the given layers. Any number of color layers can be added. The color layers will be added in the same order as in the list. For any LayerType not in the list default layers will added.
 
 Image (std::shared_ptr< Layer > layer)
 Create a new image from the given layer. Default layers will be added for the other two LayerTypes.
 
 Image (const Image &rhs)
 
 Image (const Image &rhs, NoData, const DataFormatBase *colorLayerFormat=nullptr)
 
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)
 
ColorLayerIterator begin ()
 
ColorLayerIterator end ()
 
ConstColorLayerIterator begin () const
 
ConstColorLayerIterator end () const
 
ConstColorLayerIterator cbegin () const
 
ConstColorLayerIterator cend () const
 
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
 
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
 
template<typename C >
void forEachLayer (C callback)
 
template<typename C >
void forEachLayer (C callback) const
 
void updateResource (const ResourceMeta &meta) 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
 
 MetaDataOwner (MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (const MetaDataOwner &rhs)=default
 
MetaDataOwneroperator= (MetaDataOwner &)=default
 
void copyMetaDataFrom (const MetaDataOwner &src)
 
void copyMetaDataTo (MetaDataOwner &dst)
 
template<typename T >
requires std::derived_from<T, MetaData>
T * createMetaData (std::string_view key)
 
template<typename T , typename U >
requires std::derived_from<T, MetaData> && Settable<T, U>
void setMetaData (std::string_view key, U value)
 
template<typename T >
requires std::derived_from<T, MetaData>
bool unsetMetaData (std::string_view key)
 unset, i.e. remove the metadata entry matching the given key and type
 
template<typename T , typename U >
requires std::derived_from<T, MetaData> && Gettable<T, U>
getMetaData (std::string_view key, U val) const
 
template<typename T >
requires std::derived_from<T, MetaData>
T * getMetaData (std::string_view key)
 
template<typename T >
requires std::derived_from<T, MetaData>
const T * getMetaData (std::string_view key) const
 
MetaDataMapgetMetaDataMap ()
 
const MetaDataMapgetMetaDataMap () const
 
bool hasMetaData (std::string_view key) const
 
template<typename T >
requires std::derived_from<T, MetaData>
bool hasMetaData (std::string_view key) const
 
void serialize (Serializer &s) const
 
void deserialize (Deserializer &d)
 

Static Public Attributes

static const uvec3 colorCode
 
static const std::string classIdentifier
 
static const std::string dataName
 

Static Protected Member Functions

static std::shared_ptr< LayercreateColorLayer (size2_t dimensions=size2_t(8, 8), const DataFormatBase *format=DataVec4UInt8::get())
 
static std::vector< std::shared_ptr< Layer > > createColorLayers (const Image &srcImage, const DataFormatBase *format=nullptr)
 
static std::shared_ptr< LayercreateDepthLayer (size2_t dimensions=size2_t(8, 8))
 
static std::shared_ptr< LayercreatePickingLayer (size2_t dimensions=size2_t(8, 8))
 

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 Typedef Documentation

◆ ColorLayerIterator

Initial value:
util::IndirectIterator<std::vector<std::shared_ptr<Layer>>::iterator>

◆ ConstColorLayerIterator

Initial value:
util::IndirectIterator<std::vector<std::shared_ptr<Layer>>::const_iterator>

Constructor & Destructor Documentation

◆ Image() [1/4]

inviwo::Image::Image ( size2_t dimensions = size2_t(8, 8),
const DataFormatBase * format = DataVec4UInt8::get() )

Create a new image with dimensions and format. The image will hold one color layer, one depth layer and one picking layer. The layers will not have any representations.

Parameters
dimensionsof the new image
formatof the new image

◆ Image() [2/4]

inviwo::Image::Image ( std::vector< std::shared_ptr< Layer > > layers)

Create an Image from the given layers. Any number of color layers can be added. The color layers will be added in the same order as in the list. For any LayerType not in the list default layers will added.

Precondition
The list of layers may only contain one Depth and one Picking layers.
All Layers in the list must have the same dimensions.
Parameters
layersto use

◆ Image() [3/4]

inviwo::Image::Image ( std::shared_ptr< Layer > layer)

Create a new image from the given layer. Default layers will be added for the other two LayerTypes.

Parameters
layerto use

◆ Image() [4/4]

inviwo::Image::Image ( const Image & rhs,
NoData ,
const DataFormatBase * colorLayerFormat = nullptr )

Create an image based on rhs without copying any data. If colorLayerFormat is a nullptr, the format of color layers matches the ones in rhs.

Parameters
rhssource image providing the necessary information for all layers like dimensions, spatial transformations, etc.
colorLayerFormatdata format for color layers. If equal to nullptr, the formats of the color layers in rhs are used instead.

Member Function Documentation

◆ clone()

virtual Image * inviwo::Image::clone ( ) const
virtual

◆ 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.

◆ forEachLayer() [1/2]

template<typename C >
void inviwo::Image::forEachLayer ( C callback)

Call the given callback for each layer including depth and picking, if existing. The signature of the callback is void(Layer&).

◆ forEachLayer() [2/2]

template<typename C >
void inviwo::Image::forEachLayer ( C callback) const

Call the given callback for each layer including depth and picking, if existing. The signature of the callback is void(const Layer&).

◆ getLayerAsCodedBuffer()

DataBuffer 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 file: