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

TemplateImageSampler<T,P> aids sampling of images of a given type (T) using Bi-Linear Interpolation with precision (P). More...

#include <imagesampler.h>

+ Inheritance diagram for inviwo::TemplateImageSampler< ReturnType, DataType >:

Public Member Functions

 TemplateImageSampler (const Layer *layer)
 
 TemplateImageSampler (const Image *img)
 
 TemplateImageSampler (std::shared_ptr< const Image > sharedImage)
 
ReturnType sample2D (const dvec2 &pos) const
 
ReturnType sample (double x, double y) const
 
- Public Member Functions inherited from inviwo::SpatialSampler< ReturnType >
 SpatialSampler (const SpatialEntity &spatialEntity, CoordinateSpace space=CoordinateSpace::Data)
 
ReturnType sample (const dvec3 &pos) const
 
ReturnType sample (const vec3 &pos) const
 
ReturnType sample (const dvec2 &pos) const
 
ReturnType sample (const vec2 &pos) const
 
ReturnType sample (const dvec3 &pos, CoordinateSpace space) const
 
ReturnType sample (const vec3 &pos, CoordinateSpace space) const
 
ReturnType sample (const dvec2 &pos, CoordinateSpace space) const
 
ReturnType 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
 
ReturnType getPixel (const size2_t &pos) const
 
- Protected Member Functions inherited from inviwo::SpatialSampler< ReturnType >

Protected Attributes

const DataType * data_
 
size2_t dims_
 
util::IndexMapper2D ic_
 
std::shared_ptr< const ImagesharedImage_
 
- Protected Attributes inherited from inviwo::SpatialSampler< ReturnType >
CoordinateSpace space_
 
const SpatialEntityspatialEntity_
 
dmat4 transform_
 

Additional Inherited Members

- Public Types inherited from inviwo::SpatialSampler< ReturnType >
using type = ReturnType
 
- Static Public Attributes inherited from inviwo::SpatialSampler< ReturnType >
static const unsigned SpatialDimensions = 3
 

Detailed Description

template<typename ReturnType, typename DataType>
class inviwo::TemplateImageSampler< ReturnType, DataType >

TemplateImageSampler<T,P> aids sampling of images of a given type (T) using Bi-Linear Interpolation with precision (P).

A helper class to aid sampling of images of a given type (T). 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.

The template parameter P should be either double or float. When T is either float our double P should be the same.

Member Function Documentation

◆ sample()

template<typename ReturnType , typename DataType >
ReturnType inviwo::TemplateImageSampler< ReturnType, DataType >::sample ( double x,
double y ) const
See also
sample()
Parameters
xX coordinate of the position to sample at, expects range [0 1]
yY coordinate of the position to sample at, expects range [0 1]

◆ sample2D()

template<typename ReturnType , typename DataType >
ReturnType inviwo::TemplateImageSampler< ReturnType, DataType >::sample2D ( const dvec2 & pos) const

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

Parameters
posPosition to sample at, expects range [0 1]

◆ sampleDataSpace()

template<typename ReturnType , typename DataType >
auto inviwo::TemplateImageSampler< ReturnType, DataType >::sampleDataSpace ( const dvec3 & pos) const
overrideprotectedvirtual

◆ withinBoundsDataSpace()

template<typename ReturnType , typename DataType >
bool inviwo::TemplateImageSampler< ReturnType, DataType >::withinBoundsDataSpace ( const dvec3 & pos) const
overrideprotectedvirtual

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