38 const at::Tensor &detectorSpacing);
57 const at::Tensor &detectorSpacing,
const at::Tensor &
dLossDDRR);
66 const at::Tensor &detectorSpacing,
const at::Tensor &
dLossDDRR);
84 const at::Tensor &detectorSpacing);
94 static_assert(texture_t::DIMENSIONALITY == 3);
96 using IntType =
typename texture_t::IntType;
114 const at::Tensor &outputOffset,
const at::Tensor &detectorSpacing,
115 at::DeviceType
device, std::optional<int64_t> samplesPerRay = std::nullopt) {
124 TORCH_CHECK(homographyMatrixInverse.sizes() == at::IntArrayRef({4, 4}));
125 TORCH_CHECK(homographyMatrixInverse.dtype() == at::kDouble);
128 TORCH_CHECK(outputOffset.sizes() == at::IntArrayRef{2});
131 TORCH_CHECK(detectorSpacing.sizes() == at::IntArrayRef{2});
132 TORCH_CHECK(detectorSpacing.dtype() == at::kDouble);
General tools and structs.
#define __host__
Definition Global.h:17
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
__host__ static __device__ constexpr Vec FromIntArrayRef(const at::IntArrayRef &v)
Construct a Vec from an at::IntArrayRef (this is the type of at::Tensor::sizes())
Definition Vec.h:82
__host__ __device__ constexpr T Max() const
Find the largest element.
Definition Vec.h:195
static __host__ Vec FromTensor(const at::Tensor &t)
Construct a Vec from a 1D PyTorch tensor.
Definition Vec.h:98
__host__ __device__ constexpr Vec Flipped() const
Construct a Vec with the same elements, but in the reverse order.
Definition Vec.h:161
__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 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
__host__ at::Tensor ProjectDRRsBatched_CUDA(const at::Tensor &volume, const at::Tensor &voxelSpacing, const at::Tensor &invHMatrices, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing)
An implementation similar to reg23::ProjectDRR_CUDA that evaluates projections for multiple transform...
__host__ at::Tensor ProjectDRR_backward_CUDA(const at::Tensor &volume, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing, const at::Tensor &dLossDDRR)
An implementation of reg23::ProjectDRR_backward_CPU that uses CUDA parallelisation.
__host__ at::Tensor ProjectDRR_CUDA(const at::Tensor &volume, 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::ProjectDRR_CPU that uses CUDA parallelisation.
at::Tensor ProjectDRR_backward_CPU(const at::Tensor &volume, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing, const at::Tensor &dLossDDRR)
Evaluate the derivative of some scalar loss that is a function of a DRR projected from the given volu...
Definition ProjectDRRCPU.cpp:47
at::Tensor ProjectDRR_CPU(const at::Tensor &volume, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, int64_t outputWidth, int64_t outputHeight, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing)
Generate a DRR from the given volume at the given transformation.
Definition ProjectDRRCPU.cpp:10
Vec< TextureAddressMode, DIMENSIONALITY > StringsToAddressModes(const std::array< std::string_view, DIMENSIONALITY > &strings)
Definition Texture.h:44
Definition GridSample3DCPU.cpp:6
Definition ProjectDRR.h:102
int64_t samplesPerRay
Definition ProjectDRR.h:109
Vec< double, 2 > outputOffset
Definition ProjectDRR.h:105
texture_t inputTexture
Definition ProjectDRR.h:103
Vec< double, 2 > detectorSpacing
Definition ProjectDRR.h:106
Vec< Vec< double, 4 >, 4 > homographyMatrixInverse
Definition ProjectDRR.h:104
FloatType stepSize
Definition ProjectDRR.h:108
double lambdaStart
Definition ProjectDRR.h:107
Definition ProjectDRR.h:92
static __host__ CommonData Common(const at::Tensor &volume, const at::Tensor &voxelSpacing, const at::Tensor &homographyMatrixInverse, double sourceDistance, const at::Tensor &outputOffset, const at::Tensor &detectorSpacing, at::DeviceType device, std::optional< int64_t > samplesPerRay=std::nullopt)
Definition ProjectDRR.h:112
typename texture_t::SizeType SizeType
Definition ProjectDRR.h:98
typename texture_t::VectorType VectorType
Definition ProjectDRR.h:99
typename texture_t::FloatType FloatType
Definition ProjectDRR.h:97
typename texture_t::IntType IntType
Definition ProjectDRR.h:96
typename texture_t::AddressModeType AddressModeType
Definition ProjectDRR.h:100