Grangeat-based 2D/3D image registration
Loading...
Searching...
No Matches
Similarity.h
Go to the documentation of this file.
1#pragma once
2
3#include "Common.h"
4
5namespace reg23 {
6
16std::tuple<at::Tensor, double, double, double, double, double> NormalisedCrossCorrelation_CPU(
17 const at::Tensor &a, const at::Tensor &b);
18
23__host__ std::tuple<at::Tensor, double, double, double, double, double> NormalisedCrossCorrelation_CUDA(
24 const at::Tensor &a, const at::Tensor &b);
25
26struct Similarity {
27
28 __host__ static void Common(const at::Tensor &a, const at::Tensor &b, at::DeviceType device) {
29 // a and b should contain floats or doubles, match in size and be on the chosen device
30 TORCH_CHECK(a.sizes() == b.sizes())
31 TORCH_CHECK(a.dtype() == b.dtype())
32 TORCH_CHECK(a.dtype() == at::kFloat)
33 TORCH_INTERNAL_ASSERT(a.device().type() == device)
34 TORCH_INTERNAL_ASSERT(b.device().type() == device)
35 }
36};
37
38} // namespace reg23
General tools and structs.
#define __host__
Definition Global.h:17
std::tuple< at::Tensor, double, double, double, double, double > NormalisedCrossCorrelation_CPU(const at::Tensor &a, const at::Tensor &b)
Additionally returns intermediate quantities useful for evaluating the backward pass.
Definition SimilarityCPU.cpp:8
__host__ std::tuple< at::Tensor, double, double, double, double, double > NormalisedCrossCorrelation_CUDA(const at::Tensor &a, const at::Tensor &b)
An implementation of reg23::NormalisedCrossCorrelation_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 Similarity.h:26
static __host__ void Common(const at::Tensor &a, const at::Tensor &b, at::DeviceType device)
Definition Similarity.h:28