aimstil  5.0.5
scalingMapTools.h
Go to the documentation of this file.
1 #ifndef TIL_SCALING_MAP_TOOLS_H
2 #define TIL_SCALING_MAP_TOOLS_H
3 
5 
6 // includes from TIL library
7 #include "til/til_declarations.h"
8 
9 
10 namespace til {
11 
12 
16  template < class TImage1, class TImage2 >
17  ScalingMap<double>
18  getScalingBetween(const TImage1 & from, const TImage2 & to)
19  {
20  allocationCheck(from, to);
21  // To prevent from dividing by zero below
22  if (from.size() == 0)
23  {
24  throw std::invalid_argument("Input image has no elements");
25  }
26  numeric_array<double,3> mulFactor;
27  convert(mulFactor, to.dim());
28  mulFactor /= from.dim();
29  return ScalingMap<double>(mulFactor, 0.5*mulFactor - 0.5);
30  }
31 
32 
33 } // namespace
34 
35 #endif
36 
void convert(TTo &x, const TFrom &y)
Definition: functors.h:410
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10
ScalingMap< double > getScalingBetween(const TImage1 &from, const TImage2 &to)
Computes the mapping that transforms im1 into im2, assuming that they cover exactly the same volume i...
This file contains forward declarations of classes defined in the TIL library.
INLINE void allocationCheck(const TImage &im)
Check whether smart pointer and image are allocated.
Definition: imageTools.h:42