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 repr
using self

Public Member Functions

void addColorLayer (std::shared_ptr< Layer > layer)
ColorLayerIterator begin ()
ConstColorLayerIterator begin () const
ConstColorLayerIterator cbegin () const
ConstColorLayerIterator cend () const
virtual Imageclone () const
void copyRepresentationsTo (Image *target) const
ColorLayerIterator end ()
ConstColorLayerIterator end () const
template<typename C>
void forEachLayer (C callback)
template<typename C>
void forEachLayer (C callback) const
LayergetColorLayer (size_t idx=0)
const LayergetColorLayer (size_t idx=0) const
DataBuffer getColorLayerAsCodedBuffer (const std::string &fileExtension, size_t idx=0) const
const DataFormatBasegetDataFormat () const
LayergetDepthLayer ()
const LayergetDepthLayer () const
DataBuffer getDepthLayerAsCodedBuffer (const std::string &fileExtension) const
size2_t getDimensions () const
virtual Document getInfo () const
LayergetLayer (LayerType, size_t idx=0)
const LayergetLayer (LayerType, size_t idx=0) const
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
size_t getNumberOfColorLayers () const
LayergetPickingLayer ()
const LayergetPickingLayer () const
DataBuffer getPickingLayerAsCodedBuffer (const std::string &fileExtension) const
 Image (const Image &rhs)
 Image (const Image &rhs, NoData, const DataFormatBase *colorLayerFormat=nullptr)
 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::shared_ptr< Layer > layer)
 Create a new image from the given layer. Default layers will be added for the other two LayerTypes.
 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.
Imageoperator= (const Image &that)
dvec4 readPixel (size2_t pos, LayerType layer, size_t index=0) const
void setDimensions (size2_t dimensions)
void updateResource (const ResourceMeta &meta) const
Public Member Functions inherited from inviwo::DataGroup< Image, ImageRepresentation >
void clearRepresentations ()
T * getEditableRepresentation ()
const T * getRepresentation () const
bool hasRepresentation () const
bool hasRepresentations () const
Public Member Functions inherited from inviwo::MetaDataOwner
void copyMetaDataFrom (const MetaDataOwner &src)
void copyMetaDataTo (MetaDataOwner &dst)
template<typename T>
requires std::derived_from<T, MetaData>
T * createMetaData (std::string_view key)
void deserialize (Deserializer &d)
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
template<typename T, typename U>
requires std::derived_from<T, MetaData> && Gettable<T, U>
getMetaData (std::string_view key, U val) const
MetaDataMapgetMetaDataMap ()
const MetaDataMapgetMetaDataMap () const
template<typename T>
requires std::derived_from<T, MetaData>
bool hasMetaData (std::string_view key) const
bool hasMetaData (std::string_view key) const
 MetaDataOwner (const MetaDataOwner &rhs)=default
 MetaDataOwner (MetaDataOwner &rhs)=default
MetaDataOwner & operator= (const MetaDataOwner &rhs)=default
MetaDataOwner & operator= (MetaDataOwner &)=default
void serialize (Serializer &s) const
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

Static Public Attributes

static constexpr std::string_view classIdentifier {"org.inviwo.Image"}
static constexpr uvec3 colorCode {90, 127, 183}
static constexpr std::string_view 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::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< Image, ImageRepresentation > & operator= (const DataGroup< Image, ImageRepresentation > &rhs)

Member Typedef Documentation

◆ ColorLayerIterator

using inviwo::Image::ColorLayerIterator
Initial value:

◆ ConstColorLayerIterator

using inviwo::Image::ConstColorLayerIterator

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:
  • include/inviwo/core/datastructures/image/image.h