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

Public Member Functions

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

Public Attributes

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

Friends

class LayerRepresentation

Additional Inherited Members

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

vec2 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 mat2{ gradientSpacing.x, 0, 0, gradientSpacing.y } However, we do not return the zeroes.

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

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:
  • layer.h