Inviwo 0.9.12-pre
Inviwo documentation
|
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) | |
Image & | operator= (const Image &that) |
virtual Image * | clone () const |
virtual Document | getInfo () const |
const Layer * | getLayer (LayerType, size_t idx=0) const |
Layer * | getLayer (LayerType, size_t idx=0) |
ColorLayerIterator | begin () |
ColorLayerIterator | end () |
ConstColorLayerIterator | begin () const |
ConstColorLayerIterator | end () const |
ConstColorLayerIterator | cbegin () const |
ConstColorLayerIterator | cend () const |
const Layer * | getColorLayer (size_t idx=0) const |
Layer * | getColorLayer (size_t idx=0) |
void | addColorLayer (std::shared_ptr< Layer > layer) |
size_t | getNumberOfColorLayers () const |
const Layer * | getDepthLayer () const |
Layer * | getDepthLayer () |
const Layer * | getPickingLayer () const |
Layer * | getPickingLayer () |
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 DataFormatBase * | getDataFormat () 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 | |
MetaDataOwner & | operator= (const MetaDataOwner &rhs)=default |
MetaDataOwner & | operator= (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> | |
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 |
MetaDataMap * | getMetaDataMap () |
const MetaDataMap * | getMetaDataMap () 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 constexpr uvec3 | colorCode {90, 127, 183} |
static constexpr std::string_view | classIdentifier {"org.inviwo.Image"} |
static constexpr std::string_view | dataName {"Image"} |
Static Protected Member Functions | |
static std::shared_ptr< Layer > | createColorLayer (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< Layer > | createDepthLayer (size2_t dimensions=size2_t(8, 8)) |
static std::shared_ptr< Layer > | createPickingLayer (size2_t dimensions=size2_t(8, 8)) |
Protected Attributes | |
std::vector< std::shared_ptr< Layer > > | colorLayers_ |
std::shared_ptr< Layer > | depthLayer_ |
std::shared_ptr< Layer > | pickingLayer_ |
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) |
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.
dimensions | of the new image |
format | of the new image |
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.
layers | to use |
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.
layer | to use |
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
.
rhs | source image providing the necessary information for all layers like dimensions, spatial transformations, etc. |
colorLayerFormat | data format for color layers. If equal to nullptr, the formats of the color layers in rhs are used instead. |
|
virtual |
Implements inviwo::DataGroup< Image, ImageRepresentation >.
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.
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&)
.
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&)
.
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
layerType | Indicate which type of layer to return. see LayerType |
fileExtension | file extension of the requested image format |
idx | In case of layerType being LayerType::ColorLayer, than return color layer at index idx |
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.
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.