newimage
 
Loading...
Searching...
No Matches
edt.h
1// Matthew Webster, WIN Analysis Group
2//Copyright (C) 2022 University of Oxford
3/* CCOPYRIGHT */
4
5#include <limits>
6#include <utility>
7#include <vector>
8
9#include "newimage.h"
10
11namespace NEWIMAGE {
12
13 inline double intersection(const std::vector<double>& f, const int64_t& q, const int64_t& vk, const double weight=1) {
14 double diff = (q - vk) * weight;
15 double sum = q + vk;
16 double intersection = (f[q] - f[vk] + (diff * sum)) / (2 * diff);
17 //Safety addition: isnan(intersection)
18 if ( isnan(intersection) )
19 return std::numeric_limits<double>::infinity();
20 return intersection;
21 }
22
23 template<class AUX=std::vector<double>>
24 std::vector<double> edt(const std::vector<double>& f, const float weight=1, AUX&& aux={});
25
26 template <class T>
27 NEWIMAGE::volume<double> euclideanDistanceTransform(const NEWIMAGE::volume<T>& input);
28
29 template <typename T>
30 std::tuple<NEWIMAGE::volume<double>,NEWIMAGE::volume<T>> euclideanDistanceTransform(const NEWIMAGE::volume<T>& binary, const NEWIMAGE::volume<T>& data);
31
32 template<class T>
33 NEWIMAGE::volume<T> sparseInterpolate(const NEWIMAGE::volume<T>& data, const NEWIMAGE::volume<T>& isSample, const double sigma=3);
34}
Definition: newimage.h:100