23 const at::Tensor &detectorSpacing);
32 const at::Tensor &detectorSpacing);
128 const at::Tensor &detectorSpacing, at::DeviceType
device) {
138 TORCH_CHECK(homographyMatrixInverse.sizes() == at::IntArrayRef({4, 4}));
139 TORCH_CHECK(homographyMatrixInverse.dtype() == at::kDouble);
142 TORCH_CHECK(outputOffset.sizes() == at::IntArrayRef{2});
146 TORCH_CHECK(detectorSpacing.sizes() == at::IntArrayRef{2});
147 TORCH_CHECK(detectorSpacing.dtype() == at::kDouble);
161 ret.cuboidBelow.facePoints =
ret.cuboidAbove.facePoints;
165 ret.cuboidAbove.faceOutUnitNormals =
ret.cuboidIn.faceOutUnitNormals;
166 ret.cuboidBelow.faceOutUnitNormals =
ret.cuboidIn.faceOutUnitNormals;
168 ret.sourcePositionTransformed =
MatMul(
ret.homographyMatrixInverse,
169 Vec<float, 4>{0.0f, 0.0f, static_cast<float>(sourceDistance), 1.0f}).
174 at::TensorOptions{at::Device{
device}});
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 > StaticCast() const
Construct a Vec with the elements form this one cast to a new type.
Definition Vec.h:237
static __host__ Vec FromTensor(const at::Tensor &t)
Construct a Vec from a 1D PyTorch tensor.
Definition Vec.h:98
__host__ __device__ constexpr Vec< T,(Ns+...)> VecCat(const Vec< T, Ns > &... vecs)
reg23::Vec concatenation of any number of vectors
Definition Vec.h:841
__host__ __device__ constexpr T VecDot(const Vec< T, N > &lhs, const Vec< T, N > &rhs)
reg23::Vec dot product
Definition Vec.h:667
__host__ __device__ constexpr Vec< Vec< T, N1 >, N2 > VecOuter(const Vec< T, N1 > &lhs, const Vec< T, N2 > &rhs)
reg23::Vec outer product; returns a column major matrix of size N1 x N2.
Definition Vec.h:682
__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 ProjectDRRCuboidMask_CPU(const at::Tensor &volumeSize, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing)
Calculate the distances of the intersections between the DRR-generation rays and the domain of the vo...
Definition ProjectDRRCuboidMaskCPU.cpp:9
__host__ at::Tensor ProjectDRRCuboidMask_CUDA(const at::Tensor &volumeSize, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing)
An implementation of reg23::ProjectDRRCuboidMask_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 ProjectDRRCuboidMaskCPU.h:114
at::Tensor flatOutput
Definition ProjectDRRCuboidMaskCPU.h:122
Vec< float, 2 > detectorSpacing
Definition ProjectDRRCuboidMaskCPU.h:117
Vec< Vec< float, 4 >, 4 > homographyMatrixInverse
Definition ProjectDRRCuboidMaskCPU.h:115
Cuboid cuboidAbove
Definition ProjectDRRCuboidMaskCPU.h:120
Cuboid cuboidIn
Definition ProjectDRRCuboidMaskCPU.h:119
Vec< float, 3 > sourcePositionTransformed
Definition ProjectDRRCuboidMaskCPU.h:118
Vec< float, 2 > outputOffset
Definition ProjectDRRCuboidMaskCPU.h:116
Cuboid cuboidBelow
Definition ProjectDRRCuboidMaskCPU.h:121
Definition ProjectDRRCuboidMaskCPU.h:109
Vec< Vec< float, 3 >, 6 > facePoints
Definition ProjectDRRCuboidMaskCPU.h:110
Vec< Vec< float, 3 >, 6 > faceOutUnitNormals
Definition ProjectDRRCuboidMaskCPU.h:111
Definition ProjectDRRCuboidMaskCPU.h:107
static __host__ CommonData Common(const at::Tensor &volumeSize, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing, at::DeviceType device)
Definition ProjectDRRCuboidMaskCPU.h:125