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

Public Types

using Config = LayerConfig
Public Types inherited from inviwo::Data< Layer, LayerRepresentation >
using repr
using self

Public Member Functions

HistogramCache::Result calculateHistograms (const std::function< void(const std::vector< Histogram1D > &)> &whenDone) const
virtual Layer * clone () const override
LayerConfig config () const
void discardHistograms ()
std::unique_ptr< std::vector< unsigned char > > getAsCodedBuffer (const std::string &fileExtension) const
 encode the layer contents to a buffer considering the requested image format
virtual const AxisgetAxis (size_t index) const override
const DataFormatBasegetDataFormat () const
virtual size2_t getDimensions () const override
InterpolationType getInterpolation () const
LayerType getLayerType () const
SwizzleMask getSwizzleMask () const
vec3 getWorldSpaceGradientSpacing () const
 Computes the spacing to be used for gradient computation. Also works for layers with non-orthogonal basis.
Wrapping2D getWrapping () const
 Layer (const Layer &)=default
 Layer (const Layer &rhs, NoData noData, const LayerConfig &config={})
 Layer (const LayerConfig &config)
 Layer (Layer &&)=default
 Layer (size2_t defaultDimensions=LayerConfig::defaultDimensions, const DataFormatBase *defaultFormat=LayerConfig::defaultFormat, LayerType type=LayerConfig::defaultType, const SwizzleMask &defaultSwizzleMask=LayerConfig::defaultSwizzleMask, InterpolationType interpolation=LayerConfig::defaultInterpolation, const Wrapping2D &wrapping=LayerConfig::defaultWrapping)
 Layer (std::shared_ptr< LayerRepresentation >)
Layer & operator= (const Layer &that)=default
Layer & operator= (Layer &&that)=default
void setDataFormat (const DataFormatBase *format)
virtual void setDimensions (const size2_t &dim)
void setInterpolation (InterpolationType interpolation)
void setSwizzleMask (const SwizzleMask &mask)
 update the swizzle mask of the channels for sampling color layers The swizzle mask is only affecting Color layers.
void setWrapping (const Wrapping2D &wrapping)
Public Member Functions inherited from inviwo::Data< Layer, LayerRepresentation >
void addRepresentation (std::shared_ptr< LayerRepresentation > representation)
void clearRepresentations ()
T * getEditableRepresentation ()
const T * getRepresentation () const
std::shared_ptr< const T > getRepresentationShared () const
bool hasRepresentation () const
bool hasRepresentations () const
void invalidateAllOther (const LayerRepresentation *repr)
void removeOtherRepresentations (const LayerRepresentation *representation)
void removeRepresentation (const LayerRepresentation *representation)
void updateResource (const ResourceMeta &meta) const
Public Member Functions inherited from inviwo::StructuredGridEntity< 2 >
virtual const StructuredCoordinateTransformergetCoordinateTransformer () const override
glm::mat4 getIndexMatrix () const
StructuredGridEntity< N > & operator= (const StructuredGridEntity< N > &that)=default
Public Member Functions inherited from inviwo::SpatialEntity
glm::mat3 getBasis () const
virtual const SpatialCameraCoordinateTransformergetCoordinateTransformer (const Camera &camera) const
glm::mat4 getModelMatrix () const
glm::vec3 getOffset () const
glm::mat4 getWorldMatrix () const
SpatialEntity & operator= (const SpatialEntity &that)
void setBasis (const glm::mat3 &basis)
void setModelMatrix (const glm::mat4 &modelMatrix)
void setOffset (const glm::vec3 &offset)
void setWorldMatrix (const glm::mat4 &worldMatrix)
 SpatialEntity (const glm::mat4 &modelMatrix)
 SpatialEntity (const glm::mat4 &modelMatrix, const glm::mat4 &worldMatrix)
 SpatialEntity (const SpatialEntity &rhs)

Public Attributes

std::array< Axis, 2 > axes
DataMapper dataMap

Friends

class LayerRepresentation

Additional Inherited Members

Protected Member Functions inherited from inviwo::Data< Layer, LayerRepresentation >
decltype(auto) getLastOr (F &&f, T &&fallback) const
Data< Layer, LayerRepresentation > & operator= (const Data< Layer, LayerRepresentation > &that)
void setLastAndInvalidateOther (F &&f, T &&value)
Protected Attributes inherited from inviwo::SpatialEntity
std::unique_ptr< SpatialCameraCoordinateTransformercameraTransformer_
glm::mat4 modelMatrix_
std::unique_ptr< SpatialCoordinateTransformertransformer_
glm::mat4 worldMatrix_

Constructor & Destructor Documentation

◆ Layer()

inviwo::Layer::Layer ( const Layer & rhs,
NoData noData,
const LayerConfig & config = {} )

Create a layer based on rhs without copying any representations. State from rhs can be overridden by the config

Parameters
rhssource layer providing the necessary information like dimensions, swizzle masks, interpolation, spatial transformations, etc.
noDataTag type to indicate that representations should not be copied from rhs
configcustom parameters overriding values from rhs

Member Function Documentation

◆ clone()

virtual Layer * inviwo::Layer::clone ( ) const
overridevirtual

◆ getAsCodedBuffer()

std::unique_ptr< std::vector< unsigned char > > inviwo::Layer::getAsCodedBuffer ( const std::string & fileExtension) const

encode the layer contents to a buffer considering the requested image format

Parameters
fileExtensionfile extension of the requested image format
Returns
encoded layer contents as std::vector

◆ getAxis()

virtual const Axis * inviwo::Layer::getAxis ( size_t index) const
overridevirtual

returns the axis information corresponding to index

Exceptions
RangeExceptionif index is out of bounds, i.e. index >= 2

Implements inviwo::SpatialEntity.

◆ getDimensions()

virtual size2_t inviwo::Layer::getDimensions ( ) const
overridevirtual

◆ getWorldSpaceGradientSpacing()

vec3 inviwo::Layer::getWorldSpaceGradientSpacing ( ) const

Computes the spacing to be used for gradient computation. Also works for layers with non-orthogonal basis.

For orthogonal lattices this will be equal to the world space texel spacing. For non-orthogonal lattices it will be the longer of the axes projected onto the world space axes.

   World space

    b ^           ^
     /            |

y ^ / dy | / texel | | /__________>a \/ | <-—dx---> |____________> x

The actual gradient spacing vectors are given by mat3{ gradientSpacing.x, 0, 0, 0, gradientSpacing.y, 0, 0, 0, gradientSpacing.y } However, we do not return the zeroes.

To get the spacing in texture space use: mat3{glm::scale(worldToTextureMatrix, getWorldSpaceGradientSpacing())};

Returns
Step size for gradient computation in world space.

◆ setDataFormat()

void inviwo::Layer::setDataFormat ( const DataFormatBase * format)

Set the format of the data.

See also
DataFormatBase
Parameters
formatThe format of the data.

◆ setDimensions()

virtual void inviwo::Layer::setDimensions ( const size2_t & dim)
virtual

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

Note
Resizes the last valid representation and erases all other representations. Last valid representation will remain valid after changing the dimension.

◆ setSwizzleMask()

void inviwo::Layer::setSwizzleMask ( const SwizzleMask & mask)

update the swizzle mask of the channels for sampling color layers The swizzle mask is only affecting Color layers.

Parameters
masknew swizzle mask

The documentation for this class was generated from the following file:
  • include/inviwo/core/datastructures/image/layer.h