27#ifndef improc_eigenImage_hpp 
   28#define improc_eigenImage_hpp 
   30#pragma GCC system_header 
   33#include "../math/vectorUtils.hpp" 
   43template <
typename scalarT>
 
   49template <
typename scalarT>
 
   50using eigenMap = Eigen::Map<Eigen::Array<scalarT, -1, -1>>;
 
   72    template <
typename imageT>
 
   73    static yes &test( 
typename imageT::is_eigenCube * );
 
   76    static no &test( ... );
 
   80    static const bool value = 
sizeof( test<T>( 0 ) ) == 
sizeof( yes );
 
 
   88template <typename arrT, bool isCube = is_eigenCube<arrT>::value>
 
   92    int operator()( 
const arrT &arr )
 
 
   98template <
typename arrT>
 
  102    int operator()( 
const arrT &arr )
 
  120template <
typename imageT, 
typename maskT = imageT>
 
  121typename imageT::Scalar
 
  124             std::vector<typename imageT::Scalar> *work =
 
  128    typename imageT::Scalar med;
 
  130    bool localWork = 
false;
 
  133        work = 
new std::vector<typename imageT::Scalar>;
 
  147    for( 
int i = 0; i < mat.rows(); ++i )
 
  149        for( 
int j = 0; j < mat.cols(); ++j )
 
  153                if( ( *mask )( i, j ) == 0 )
 
  157            ( *work )[ii] = mat( i, j );
 
 
  181template <
typename imageT>
 
  184    std::vector<typename imageT::Scalar> *work = 0 
 
  187    return imageMedian( mat, (Eigen::Array<typename imageT::Scalar, -1, -1> *)0, work );
 
 
imageT::Scalar imageMedian(const imageT &mat, const maskT *mask, std::vector< typename imageT::Scalar > *work=0)
Calculate the median of an Eigen-like array.
 
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.
 
Eigen::Map< Eigen::Array< scalarT, -1, -1 > > eigenMap
Definition of the eigenMap type, which is an alias for Eigen::Map<Array>.
 
vectorT::value_type vectorMedianInPlace(vectorT &vec)
Calculate median of a vector in-place, altering the vector.
 
Function object to return the number of planes for any Eigen like object, whether 2D or a 3D cube.
 
Test whether a type is an eigenCube by testing whether it has a typedef of "is_eigenCube".