35 const at::Tensor &
rValues, c10::optional<at::Tensor>
out);
44 c10::optional<at::Tensor>
out);
53 const std::string &sinogramType,
double rSpacing,
55 const at::Tensor &
rValues, c10::optional<at::Tensor>
out);
80 c10::optional<at::Tensor>
out) {
98 if (sinogramType ==
"healpix") {
100 }
else if (sinogramType !=
"classic") {
101 TORCH_WARN(
"Invalid sinogram type string given. Valid values are: 'classic', 'healpix'. Assuming default "
107 {{0.f, 0.f, 0.f, 1.f}},
118 ?
out.value().view({-1})
119 : torch::zeros(at::IntArrayRef({
phiValues.numel()}), at::TensorOptions{
device});
125 const float cp = std::cos(
phi);
126 const float sp = std::sin(
phi);
General tools and structs.
#define __host__
Definition Global.h:17
#define __device__
Definition Global.h:22
A simple vector class derived from std::array<T, N>, providing overrides for all useful operators.
Definition Vec.h:21
__host__ __device__ constexpr Vec< newT, N > Apply(const std::function< newT(T)> &f) const
Map all elements with a common std::function mapping function.
Definition Vec.h:285
__host__ __device__ constexpr const T & W() const
Get a constant reference to the fourth element.
Definition Vec.h:459
__host__ __device__ constexpr Vec< T, 3 > XYZ() const
Construct a Vec from the first three elements.
Definition Vec.h:480
__host__ __device__ Vec< T, 3 > UnflipSphericalCoordinate(const Vec< T, 3 > &coordSph)
'Unflips' the given spherical coordinates so that theta and phi both lie between -pi/2 and pi/2
Definition Common.h:108
__host__ __device__ constexpr Vec< T, R > MatMul(const Vec< Vec< T, R >, C > &lhs, const Vec< T, C > &rhs)
Matrix-vector multiplication of the Vec struct.
Definition Vec.h:894
at::Tensor ResampleSinogram3D_CPU(const at::Tensor &sinogram3d, const std::string &sinogramType, const double rSpacing, const at::Tensor &projectionMatrix, const at::Tensor &phiValues, const at::Tensor &rValues, c10::optional< at::Tensor > out)
Resample the given 3D sinogram at locations corresponding to the given 2D sinogram grid (phiValues,...
Definition ResampleSinogram3DCPU.cpp:12
__host__ at::Tensor ResampleSinogram3DCUDATexture(int64_t sinogram3dTextureHandle, int64_t sinogramWidth, int64_t sinogramHeight, int64_t sinogramDepth, const std::string &sinogramType, double rSpacing, const at::Tensor &projectionMatrix, const at::Tensor &phiValues, const at::Tensor &rValues, c10::optional< at::Tensor > out)
An implementation of reg23::ResampleSinogram3D_CUDA that takes a handle to a pre-allocated CUDA textu...
__host__ at::Tensor ResampleSinogram3D_CUDA(const at::Tensor &sinogram3d, const std::string &sinogramType, double rSpacing, const at::Tensor &projectionMatrix, const at::Tensor &phiValues, const at::Tensor &rValues, c10::optional< at::Tensor > out)
An implementation of reg23::ResampleSinogram3D_CPU that uses CUDA parallelisation.
Vec< TextureAddressMode, DIMENSIONALITY > StringsToAddressModes(const std::array< std::string_view, DIMENSIONALITY > &strings)
Definition Texture.h:44
Definition GridSample3DCPU.cpp:6
Definition ResampleSinogram3D.h:72
ConstantGeometry geometry
Definition ResampleSinogram3D.h:74
SinogramType sinogramType
Definition ResampleSinogram3D.h:73
at::Tensor flatOutput
Definition ResampleSinogram3D.h:75
Definition ResampleSinogram3D.h:66
float squareRadius
Definition ResampleSinogram3D.h:68
Vec< Vec< float, 4 >, 4 > projectionMatrixTranspose
Definition ResampleSinogram3D.h:69
Vec< float, 2 > originProjection
Definition ResampleSinogram3D.h:67
Definition ResampleSinogram3D.h:62
SinogramType
Definition ResampleSinogram3D.h:64
static __host__ CommonData Common(const std::string &sinogramType, const at::Tensor &projectionMatrix, const at::Tensor &phiValues, const at::Tensor &rValues, at::DeviceType device, c10::optional< at::Tensor > out)
Definition ResampleSinogram3D.h:78
__host__ static __device__ float ResamplePlane(const sinogram_t &sinogram, const ConstantGeometry &geometry, float phi, float r)
Definition ResampleSinogram3D.h:123