Grangeat-based 2D/3D image registration
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
reg23::Texture2DCPU Class Reference

A 2D texture stored for access by the CPU. More...

#include <Texture2DCPU.h>

Inheritance diagram for reg23::Texture2DCPU:
reg23::Texture< 2, int64_t, double >

Public Types

using Base = Texture< 2, int64_t, double >
 
- Public Types inherited from reg23::Texture< 2, int64_t, double >
using IntType = int64_t
 
using FloatType = double
 
using SizeType = Vec< int64_t, dimensionality >
 
using VectorType = Vec< double, dimensionality >
 
using AddressModeType = Vec< TextureAddressMode, dimensionality >
 

Public Member Functions

 Texture2DCPU ()=default
 
 Texture2DCPU (const float *_ptr, SizeType _size, VectorType _spacing, VectorType _centrePosition=VectorType::Full(0), AddressModeType _addressModes=AddressModeType::Full(TextureAddressMode::ZERO))
 
 Texture2DCPU (const Texture2DCPU &)=default
 
Texture2DCPUoperator= (const Texture2DCPU &)=default
 
 Texture2DCPU (Texture2DCPU &&)=default
 
Texture2DCPUoperator= (Texture2DCPU &&)=default
 
__host__ __device__ float At (const SizeType &index) const
 
__host__ __device__ float Sample (VectorType texCoord) const
 
__host__ __device__ float DSampleDX (VectorType texCoord) const
 
__host__ __device__ float DSampleDY (VectorType texCoord) const
 
__host__ __device__ VectorType DSampleDTexCoord (VectorType texCoord) const
 
- Public Member Functions inherited from reg23::Texture< 2, int64_t, double >
__host__ __device__ const SizeTypeSize () const
 
__host__ __device__ const VectorTypeSpacing () const
 Get the spacing of the texture's values in world coordinates as (X, Y, Z)
 
__host__ __device__ const VectorTypeCentrePosition () const
 Get the position of the centre of the texture in world coordinates as (X, Y, Z)
 
__host__ __device__ VectorType SizeWorld () const
 
__host__ __device__ bool In (const SizeType &index) const
 
__host__ __device__ Linear< VectorTypeMappingWorldToTexCoord () const
 

Static Public Member Functions

static Texture2DCPU FromTensor (const at::Tensor &image, VectorType spacing, VectorType centrePosition=VectorType::Full(0), AddressModeType addressModes=AddressModeType::Full(TextureAddressMode::ZERO))
 

Additional Inherited Members

- Static Public Attributes inherited from reg23::Texture< 2, int64_t, double >
static constexpr std::size_t DIMENSIONALITY
 
- Protected Member Functions inherited from reg23::Texture< 2, int64_t, double >
 Texture ()=default
 
 Texture (SizeType _size, VectorType _spacing, VectorType _centrePosition={})
 
 Texture (const Texture &)=default
 
 Texture (Texture &&) noexcept=default
 
Textureoperator= (const Texture &)=default
 
Textureoperator= (Texture &&) noexcept=default
 

Detailed Description

A 2D texture stored for access by the CPU.

This object does not own the data it provides access to, it just holds a pointer to it

Both copy and move-constructable.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ Texture2DCPU() [1/4]

reg23::Texture2DCPU::Texture2DCPU ( )
default

◆ Texture2DCPU() [2/4]

reg23::Texture2DCPU::Texture2DCPU ( const float _ptr,
SizeType  _size,
VectorType  _spacing,
VectorType  _centrePosition = VectorType::Full(0),
AddressModeType  _addressModes = AddressModeType::Full(TextureAddressMode::ZERO) 
)
inline

◆ Texture2DCPU() [3/4]

reg23::Texture2DCPU::Texture2DCPU ( const Texture2DCPU )
default

◆ Texture2DCPU() [4/4]

reg23::Texture2DCPU::Texture2DCPU ( Texture2DCPU &&  )
default

Member Function Documentation

◆ At()

__host__ __device__ float reg23::Texture2DCPU::At ( const SizeType index) const
inline
Parameters
indexThe location in the texture at which to fetch the value
Returns
The value in this texture at the given location, according to the texture's address mode

◆ DSampleDTexCoord()

__host__ __device__ VectorType reg23::Texture2DCPU::DSampleDTexCoord ( VectorType  texCoord) const
inline
Parameters
texCoordThe texture coordinates at which to sample the texture
Returns
The derivative of the sample from this texture at the given texture coordinates using bilinear interpolation, with respect to the texture coordinate.

◆ DSampleDX()

__host__ __device__ float reg23::Texture2DCPU::DSampleDX ( VectorType  texCoord) const
inline
Parameters
texCoordThe texture coordinates at which to sample the texture
Returns
The derivative of the sample from this texture at the given texture coordinates using bilinear interpolation, with respect to the X-component of the texture coordinate.

◆ DSampleDY()

__host__ __device__ float reg23::Texture2DCPU::DSampleDY ( VectorType  texCoord) const
inline
Parameters
texCoordThe texture coordinates at which to sample the texture
Returns
The derivative of the sample from this texture at the given texture coordinates using bilinear interpolation, with respect to the Y-component of the texture coordinate.

◆ FromTensor()

static Texture2DCPU reg23::Texture2DCPU::FromTensor ( const at::Tensor &  image,
VectorType  spacing,
VectorType  centrePosition = VectorType::Full(0),
AddressModeType  addressModes = AddressModeType::Full(TextureAddressMode::ZERO) 
)
inlinestatic
Parameters
imageA 2D tensor of torch.float32s
spacingA tensor of torch.float64s of size (2,)
centrePosition
addressModes
Returns
An instance of this texture object that points to the data in the given image

◆ operator=() [1/2]

Texture2DCPU & reg23::Texture2DCPU::operator= ( const Texture2DCPU )
default

◆ operator=() [2/2]

Texture2DCPU & reg23::Texture2DCPU::operator= ( Texture2DCPU &&  )
default

◆ Sample()

__host__ __device__ float reg23::Texture2DCPU::Sample ( VectorType  texCoord) const
inline
Parameters
texCoordThe texture coordinates at which to sample the texture
Returns
The sample from this texture at the given texture coordinates using bilinear interpolation

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