Inviwo  0.9.10.1
Inviwo documentation
inviwo::ImageSpatialSampler< DataDims, T > Class Template Reference

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

#include <imagesampler.h>

+ Inheritance diagram for inviwo::ImageSpatialSampler< DataDims, T >:

Public Member Functions

 ImageSpatialSampler (const LayerRAM *ram)
 
 ImageSpatialSampler (const Layer *layer)
 
 ImageSpatialSampler (const Image *img)
 
 ImageSpatialSampler (std::shared_ptr< const Image > sharedImage)
 
Vector< DataDims, T > sample (double x, double y, CoordinateSpace space) const
 
Vector< DataDims, T > sample (double x, double y) const
 
- Public Member Functions inherited from inviwo::SpatialSampler< 2, DataDims, T >
 SpatialSampler (const SpatialEntity< SpatialDims > &spatialEntity, Space space=Space::Data)
 
virtual Vector< DataDims, T > sample (const Vector< SpatialDims, double > &pos) const
 
virtual Vector< DataDims, T > sample (const Vector< SpatialDims, float > &pos) const
 
virtual Vector< DataDims, T > sample (const Vector< SpatialDims, double > &pos, Space space) const
 
virtual Vector< DataDims, T > sample (const Vector< SpatialDims, float > &pos, Space space) const
 
virtual bool withinBounds (const Vector< SpatialDims, double > &pos) const
 
virtual bool withinBounds (const Vector< SpatialDims, float > &pos) const
 
virtual bool withinBounds (const Vector< SpatialDims, double > &pos, Space space) const
 
virtual bool withinBounds (const Vector< SpatialDims, float > &pos, Space space) const
 
Matrix< SpatialDims, float > getBasis () const
 
Matrix< SpatialDims+1, float > getModelMatrix () const
 
Matrix< SpatialDims+1, float > getWorldMatrix () const
 
const SpatialCoordinateTransformer< SpatialDims > & getCoordinateTransformer () const
 

Protected Member Functions

virtual Vector< DataDims, T > sampleDataSpace (const dvec2 &pos) const
 
virtual bool withinBoundsDataSpace (const dvec2 &pos) const
 
- Protected Member Functions inherited from inviwo::SpatialSampler< 2, DataDims, T >
virtual Vector< DataDims, T > sampleDataSpace (const Vector< SpatialDims, double > &pos) const=0
 
virtual bool withinBoundsDataSpace (const Vector< SpatialDims, double > &pos) const=0
 

Additional Inherited Members

- Public Types inherited from inviwo::SpatialSampler< 2, DataDims, T >
using Space = CoordinateSpace
 
using ReturnType = Vector< DataDims, T >
 
- Static Public Attributes inherited from inviwo::SpatialSampler< 2, DataDims, T >
static const unsigned SpatialDimensions
 
static const unsigned DataDimensions
 
- Protected Attributes inherited from inviwo::SpatialSampler< 2, DataDims, T >
Space space_
 
const SpatialEntity< SpatialDims > & spatialEntity_
 
Matrix< SpatialDims+1, double > transform_
 

Detailed Description

template<unsigned int DataDims, typename T = double>
class inviwo::ImageSpatialSampler< DataDims, T >

ImageSpatialSampler 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

◆ ImageSpatialSampler() [1/4]

template<unsigned int DataDims, typename T = double>
inviwo::ImageSpatialSampler< DataDims, T >::ImageSpatialSampler ( const LayerRAM ram)
inline

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

◆ ImageSpatialSampler() [2/4]

template<unsigned int DataDims, typename T = double>
inviwo::ImageSpatialSampler< DataDims, T >::ImageSpatialSampler ( const Layer layer)
inline

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

◆ ImageSpatialSampler() [3/4]

template<unsigned int DataDims, typename T = double>
inviwo::ImageSpatialSampler< DataDims, T >::ImageSpatialSampler ( const Image img)
inline

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

◆ ImageSpatialSampler() [4/4]

template<unsigned int DataDims, typename T = double>
inviwo::ImageSpatialSampler< DataDims, T >::ImageSpatialSampler ( std::shared_ptr< const Image sharedImage)
inline

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

Member Function Documentation

◆ sample() [1/2]

template<unsigned int DataDims, typename T = double>
Vector<DataDims, T> inviwo::ImageSpatialSampler< DataDims, T >::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

◆ sample() [2/2]

template<unsigned int DataDims, typename T = double>
Vector<DataDims, T> inviwo::ImageSpatialSampler< DataDims, T >::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

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