Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::ImageSampler< ReturnType > Class Template Reference

ImageSampler aids sampling of images using Bi-Linear Interpolation. More...

#include <imagesampler.h>

+ Inheritance diagram for inviwo::ImageSampler< ReturnType >:

Public Member Functions

 ImageSampler (const Layer *layer)
 
 ImageSampler (std::shared_ptr< const Layer > layer)
 
 ImageSampler (const Image *img)
 
 ImageSampler (std::shared_ptr< const Image > sharedImage)
 
ReturnType sample (double x, double y, CoordinateSpace space) const
 
ReturnType sample (double x, double y) const
 
- Public Member Functions inherited from inviwo::SpatialSampler< dvec4 >
 SpatialSampler (const SpatialEntity &spatialEntity, CoordinateSpace space=CoordinateSpace::Data)
 
dvec4 sample (const dvec3 &pos) const
 
dvec4 sample (const vec3 &pos) const
 
dvec4 sample (const dvec2 &pos) const
 
dvec4 sample (const vec2 &pos) const
 
dvec4 sample (const dvec3 &pos, CoordinateSpace space) const
 
dvec4 sample (const vec3 &pos, CoordinateSpace space) const
 
dvec4 sample (const dvec2 &pos, CoordinateSpace space) const
 
dvec4 sample (const vec2 &pos, CoordinateSpace space) const
 
bool withinBounds (const dvec3 &pos) const
 
bool withinBounds (const vec3 &pos) const
 
bool withinBounds (const dvec2 &pos) const
 
bool withinBounds (const vec2 &pos) const
 
bool withinBounds (const dvec3 &pos, CoordinateSpace space) const
 
bool withinBounds (const vec3 &pos, CoordinateSpace space) const
 
bool withinBounds (const dvec2 &pos, CoordinateSpace space) const
 
bool withinBounds (const vec2 &pos, CoordinateSpace space) const
 
mat3 getBasis () const
 
mat4 getModelMatrix () const
 
mat4 getWorldMatrix () const
 
const SpatialCoordinateTransformergetCoordinateTransformer () const
 

Protected Member Functions

virtual ReturnType sampleDataSpace (const dvec3 &pos) const override
 
virtual bool withinBoundsDataSpace (const dvec3 &pos) const override
 
- Protected Member Functions inherited from inviwo::SpatialSampler< dvec4 >

Additional Inherited Members

- Public Types inherited from inviwo::SpatialSampler< dvec4 >
using type
 
- Static Public Attributes inherited from inviwo::SpatialSampler< dvec4 >
static const unsigned SpatialDimensions
 
- Protected Attributes inherited from inviwo::SpatialSampler< dvec4 >
CoordinateSpace space_
 
const SpatialEntityspatialEntity_
 
dmat4 transform_
 

Detailed Description

template<typename ReturnType = dvec4>
class inviwo::ImageSampler< ReturnType >

ImageSampler aids sampling of images using Bi-Linear Interpolation.

A helper class to aid sampling of images. Expects the input to be on the range [0 1]. Eg., input of (0,0) will return the color of the bottom left pixel and (1,1) will return then top right pixel. Output values are bi-linear interpolated between the 4 nearest neighbors.

Constructor & Destructor Documentation

◆ ImageSampler() [1/3]

template<typename ReturnType = dvec4>
inviwo::ImageSampler< ReturnType >::ImageSampler ( const Layer * layer)
inline

Creates a ImageSampler for the given Layer, does not take ownership of layer. Use ImageSampler(std::shared_ptr<const Layer>) to ensure that the Layer is available for the lifetime of the ImageSampler

◆ ImageSampler() [2/3]

template<typename ReturnType = dvec4>
inviwo::ImageSampler< ReturnType >::ImageSampler ( const Image * img)
inline

Creates a ImageSampler for the given Image, does not take ownership of ram. Use ImageSampler(std::shared_ptr<const Image>) to ensure that the Image is available for the lifetime of the ImageSampler

◆ ImageSampler() [3/3]

template<typename ReturnType = dvec4>
inviwo::ImageSampler< ReturnType >::ImageSampler ( std::shared_ptr< const Image > sharedImage)
inline

Creates a ImageSampler for the given Image. The shared_ptr will ensure that the Image is available for the lifetime of the ImageSampler

Member Function Documentation

◆ sample() [1/2]

template<typename ReturnType = dvec4>
ReturnType inviwo::ImageSampler< ReturnType >::sample ( double x,
double y ) const
inline
See also
sample(double, double, CoordinateSpace)
Parameters
xX coordinate of the position to sample at
yY coordinate of the position to sample at

◆ sample() [2/2]

template<typename ReturnType = dvec4>
ReturnType inviwo::ImageSampler< ReturnType >::sample ( double x,
double y,
CoordinateSpace space ) const
inline

Samples the image at the given position using bi-linear interpolation.

Parameters
xposition to sample at
yposition to sample at
spacein what CoordinateSpace x and y is defined in

◆ sampleDataSpace()

template<typename ReturnType = dvec4>
virtual ReturnType inviwo::ImageSampler< ReturnType >::sampleDataSpace ( const dvec3 & pos) const
inlineoverrideprotectedvirtual

◆ withinBoundsDataSpace()

template<typename ReturnType = dvec4>
virtual bool inviwo::ImageSampler< ReturnType >::withinBoundsDataSpace ( const dvec3 & pos) const
inlineoverrideprotectedvirtual

The documentation for this class was generated from the following file: