Grangeat-based 2D/3D image registration
Loading...
Searching...
No Matches
SinogramClassic3D.h
Go to the documentation of this file.
1#pragma once
2
3#include "Common.h"
4#include "Texture.h"
5
6namespace reg23 {
7
22template <typename texture_t> class SinogramClassic3D : texture_t {
23public:
24 using Base = texture_t;
25 static_assert(Base::DIMENSIONALITY == 3, "The texture type of a `SinogramClassic3D` must have dimensionality 3.");
26 using IntType = typename Base::IntType;
27 using FloatType = typename Base::FloatType;
28 using SizeType = typename Base::SizeType;
29 using VectorType = typename Base::VectorType;
30 using AddressModeType = typename Base::AddressModeType;
31
32 static constexpr FloatType THETA_RANGE_LOW = -.5 * M_PI;
33 static constexpr FloatType THETA_RANGE_HIGH = .5 * M_PI;
34 static constexpr FloatType PHI_RANGE_LOW = -.5 * M_PI;
35 static constexpr FloatType PHI_RANGE_HIGH = .5 * M_PI;
36
37 SinogramClassic3D() = default;
38
44 mappingRThetaPhiToTexCoord = Base::MappingWorldToTexCoord();
45 }
46
47 // yes copy
49
51
52 // yes move
54
56
65 // tensor should be a 3D array of floats
66 TORCH_CHECK(tensor.sizes().size() == 3)
67 TORCH_CHECK(tensor.dtype() == at::kFloat)
68 const SizeType tensorSizeRThetaPhi = SizeType::FromIntArrayRef(tensor.sizes()).Flipped();
70 tensorSizeRThetaPhi[1] - 2);
72 tensorSizeRThetaPhi[2] - 2);
73 return SinogramClassic3D{Base::FromTensor(tensor, {rSpacing, thetaSpacing, phiSpacing})};
74 }
75
90
96 return Base::Sample(mappingRThetaPhiToTexCoord(rThetaPhi));
97 }
98
99private:
100 Linear<VectorType> mappingRThetaPhiToTexCoord{};
101};
102
103} // namespace reg23
General tools and structs.
#define __host__
Definition Global.h:17
#define __device__
Definition Global.h:22
A 3D texture stored for access by the CPU, structured for storing an even distribution of values over...
Definition SinogramClassic3D.h:22
SinogramClassic3D & operator=(SinogramClassic3D &&)=default
__host__ __device__ float Sample(const VectorType &rThetaPhi) const
Definition SinogramClassic3D.h:95
static constexpr FloatType PHI_RANGE_HIGH
Definition SinogramClassic3D.h:35
SinogramClassic3D & operator=(const SinogramClassic3D &)=default
SinogramClassic3D(SinogramClassic3D &&)=default
static constexpr FloatType THETA_RANGE_HIGH
Definition SinogramClassic3D.h:33
typename Base::VectorType VectorType
Definition SinogramClassic3D.h:29
static constexpr FloatType PHI_RANGE_LOW
Definition SinogramClassic3D.h:34
typename Base::SizeType SizeType
Definition SinogramClassic3D.h:28
static SinogramClassic3D FromCUDAHandle(int64_t textureHandle, const Vec< int64_t, 3 > &sizeRThetaPhi, FloatType rSpacing)
Definition SinogramClassic3D.h:82
SinogramClassic3D(Base texture)
Construct the texture with data.
Definition SinogramClassic3D.h:43
typename Base::FloatType FloatType
Definition SinogramClassic3D.h:27
typename Base::AddressModeType AddressModeType
Definition SinogramClassic3D.h:30
SinogramClassic3D(const SinogramClassic3D &)=default
static constexpr FloatType THETA_RANGE_LOW
Definition SinogramClassic3D.h:32
texture_t Base
Definition SinogramClassic3D.h:24
typename Base::IntType IntType
Definition SinogramClassic3D.h:26
static SinogramClassic3D FromTensor(const at::Tensor &tensor, FloatType rSpacing)
Definition SinogramClassic3D.h:64
A simple vector class derived from std::array<T, N>, providing overrides for all useful operators.
Definition Vec.h:21
Vec< TextureAddressMode, DIMENSIONALITY > StringsToAddressModes(const std::array< std::string_view, DIMENSIONALITY > &strings)
Definition Texture.h:44
Definition GridSample3DCPU.cpp:6
A functor class that represents a linear transformation: intercept + gradient * x.
Definition Common.h:27