34#ifndef CARTODATA_VOLUME_VOLUMEUTIL_H
35#define CARTODATA_VOLUME_VOLUMEUTIL_H
41#include <cartobase/type/datatypetraits.h>
42#include <cartobase/smart/rcptr.h>
43#include <cartobase/containers/nditerator.h>
70 inline bool sameSize(
const std::vector<int> & s1,
71 const std::vector<int> & s2 );
73 inline std::vector<int>
maxSize(
const std::vector<int> & s1,
74 const std::vector<int> & s2 );
76 inline std::vector<int>
minSize(
const std::vector<int> & s1,
77 const std::vector<int> & s2 );
82 template <
typename T,
typename UnaryFunction>
83 Volume<typename UnaryFunction::result_type>
84 apply(
const Volume<T> & vol, UnaryFunction func );
85 template <
typename T,
typename U,
typename BinaryFunction>
86 Volume<typename BinaryFunction::result_type>
87 apply(
const Volume<T> & vol1,
const Volume<U> & vol2, BinaryFunction func );
88 template <
typename T,
typename UnaryFunction>
89 rc_ptr<Volume<typename UnaryFunction::result_type> >
90 apply(
const rc_ptr<Volume<T> > & vol, UnaryFunction func );
91 template <
typename T,
typename U,
typename BinaryFunction>
92 rc_ptr<Volume<typename BinaryFunction::result_type> >
93 apply(
const rc_ptr<Volume<T> > & vol1,
const Volume<U> & vol2, BinaryFunction func );
98 template <
typename T,
typename UnaryFunction>
99 Volume<T> &
selfApply( Volume<T> & vol, UnaryFunction func );
100 template <
typename T,
typename U,
typename BinaryFunction>
101 Volume<T> &
selfApply( Volume<T> & vol1,
const Volume<U> & vol2, BinaryFunction func );
102 template <
typename T,
typename UnaryFunction>
103 rc_ptr<Volume<T> > &
selfApply( rc_ptr<Volume<T> > & vol, UnaryFunction func );
104 template <
typename T,
typename U,
typename BinaryFunction>
105 rc_ptr<Volume<T> > &
selfApply( rc_ptr<Volume<T> > & vol1,
const Volume<U> & vol2, BinaryFunction func );
114 template <
typename T,
typename OUTP,
typename UnaryFunction>
116 applyTowards(
const Volume<T> & vol, Volume<OUTP> & dst, UnaryFunction func );
117 template <
typename T,
typename OUTP,
typename UnaryFunction>
119 applyTowards(
const T & cst, Volume<OUTP> & dst, UnaryFunction func );
120 template <
typename T,
typename U,
typename OUTP,
typename BinaryFunction>
122 applyTowards(
const Volume<T> & vol1,
const Volume<U> & vol2, Volume<OUTP> & dst, BinaryFunction func );
123 template <
typename T,
typename U,
typename OUTP,
typename BinaryFunction>
125 applyTowards(
const Volume<T> & vol1,
const U & cst2, Volume<OUTP> & dst, BinaryFunction func );
141 template <
typename OUTP,
typename T,
typename BinaryFunction>
142 OUTP
accumulate(
const Volume<T> & vol, BinaryFunction func, OUTP initial );
143 template <
typename OUTP,
typename T,
typename BinaryFunction>
144 OUTP
accumulate(
const rc_ptr<Volume<T> > & vol, BinaryFunction func, OUTP initial );
156 template <
typename T>
158 template <
typename T>
160 template <
typename OUTP,
typename INP>
162 template <
typename OUTP,
typename INP>
169 template <
typename T>
171 const std::vector<int> & size = std::vector<int>() );
172 template <
typename T>
175 const std::vector<int> & size = std::vector<int>() );
176 template <
typename OUTP,
typename INP>
178 const std::vector<int> & size = std::vector<int>() );
179 template <
typename OUTP,
typename INP>
182 const std::vector<int> & size = std::vector<int>() );
189 template <
typename T>
191 template <
typename T>
193 template <
typename OUTP,
typename INP>
195 template <
typename OUTP,
typename INP>
201 template <
typename T>
203 template <
typename T>
205 template <
typename OUTP,
typename INP>
207 template <
typename OUTP,
typename INP>
219 template <
typename T>
221 template <
typename T>
229 template <
typename T>
231 template <
typename T>
237 template <
typename T>
239 template <
typename OUTP,
typename T>
241 template <
typename T>
243 template <
typename OUTP,
typename T>
249 template <
typename T>
251 template <
typename T>
257 template <
typename T>
259 template <
typename T>
274 template <
typename T,
typename U>
276 template <
typename T,
typename U>
287 template <
typename T,
typename U>
289 template <
typename T,
typename U>
298 template <
typename T,
typename U>
300 template <
typename T,
typename U>
308 template <
typename T>
310 template <
typename T>
315 template <
typename T>
318 template <
typename T>
322 template <
typename T>
328 template <
typename T>
333 template <
typename T>
337 if( thing->getSizeT() != 1 || thing->getSizeZ() != 1
338 || thing->getSizeY() != 1 )
339 throw std::runtime_error(
"diag expects a 1D (Nx1x1x1) vector as input");
341 int n = thing->getSizeX();
345 for(
int x = 0; x < n; x++ )
346 m->at( x, x ) = thing->at( x );
352 template <
typename T>
356 if( thing->getSizeT() != 1 || thing->getSizeZ() != 1 )
357 throw std::runtime_error(
358 "undiag expects a 2D (NxMx1x1) matrix as input");
360 int n = std::min( thing->getSizeX(), thing->getSizeY() );
363 AllocatorContext::fast() ) );
365 for(
int x = 0; x < n; x++ )
366 m->at( x, 0 ) = thing->at( x, x );
383 template <
typename T>
385 const typename Volume<T>::Position4Di & top,
386 const typename Volume<T>::Position4Di & bottom
387 =
typename Volume<T>::Position4Di(-1, -1, -1, -1) );
390 template <
typename T>
392 const typename Volume<T>::Position4Di & top,
393 const typename Volume<T>::Position4Di & bottom
394 =
typename Volume<T>::Position4Di(-1, -1, -1, -1) );
404 template <
typename T>
406 const typename Volume<T>::Position4Di & top,
407 const typename Volume<T>::Position4Di & bottom
408 =
typename Volume<T>::Position4Di(-1, -1, -1, -1) );
411 template <
typename T>
413 const typename Volume<T>::Position4Di & top,
414 const typename Volume<T>::Position4Di & bottom
415 =
typename Volume<T>::Position4Di(-1, -1, -1, -1) );
423 std::vector<int> dim1 = v1.
getSize();
424 std::vector<int> dim2 = v2.
getSize();
425 std::size_t i, n1 = dim1.size(), n2 = dim2.size(), n = std::min( n1, n2 );
427 if( dim1[i] != dim2[i] )
455 namespace volumeutil {
461 bool sameSize(
const std::vector<int> & s1,
const std::vector<int> & s2 )
463 std::size_t s0 = s1.size();
467 for( i=0; i<s0; ++i )
470 for( ; i<s1.size(); ++i )
473 for( ; i<s2.size(); ++i )
480 std::vector<int>
maxSize(
const std::vector<int> & s1,
481 const std::vector<int> & s2 )
483 std::vector<int> dim( std::max( s1.size(), s2.size() ), 1 );
484 std::size_t s0 = s1.size();
488 for( i=0; i<s0; ++i )
489 dim[i] = std::max( s1[i], s2[i] );
490 for( ; i<s1.size(); ++i )
492 for( ; i<s2.size(); ++i )
498 std::vector<int>
minSize(
const std::vector<int> & s1,
499 const std::vector<int> & s2 )
501 std::vector<int> dim( std::min( s1.size(), s2.size() ), 1 );
502 std::size_t s0 = s1.size();
506 for( i=0; i<s0; ++i )
507 dim[i] = std::min( s1[i], s2[i] );
508 for( ; i<dim.size(); ++i )
516 template <
typename T,
typename UnaryFunction>
521 typedef typename UnaryFunction::result_type OUTP;
527 template <
typename T,
typename U,
typename BinaryFunction>
532 typedef typename BinaryFunction::result_type OUTP;
541 template <
typename T,
typename UnaryFunction>
546 typedef typename UnaryFunction::result_type OUTP;
552 template <
typename T,
typename U,
typename BinaryFunction>
557 typedef typename BinaryFunction::result_type OUTP;
566 template <
typename T,
typename UnaryFunction>
574 template <
typename T,
typename U,
typename BinaryFunction>
584 template <
typename T,
typename UnaryFunction>
592 template <
typename T,
typename U,
typename BinaryFunction>
601 template <
typename T,
typename OUTP,
typename UnaryFunction>
614 std::vector<int> pos( size.size(), 0 );
634 for( ; !it.
ended(); ++it, ++dit )
645 template <
typename T,
typename OUTP,
typename UnaryFunction>
654 OUTP value = func( cst );
655 for( ; !dit.
ended(); ++dit )
664 template <
typename T,
typename U,
typename OUTP,
typename BinaryFunction>
679 std::vector<int> pos( size.size(), 0 );
708 for( ; !it1.
ended(); ++it1, ++it2, ++dit )
716 *d = func( *p, *p2 );
721 template <
typename T,
typename U,
typename OUTP,
typename BinaryFunction>
732 std::vector<int> pos( size.size(), 0 );
755 for( ; !it2.
ended(); ++it2, ++dit )
761 *d = func( cst1, *p2 );
766 template <
typename T,
typename U,
typename OUTP,
typename BinaryFunction>
779 std::vector<int> pos( size.size(), 0 );
800 for( ; !it1.
ended(); ++it1, ++dit )
806 *d = func( *p, cst2 );
813 template <
typename OUTP,
typename T,
typename BinaryFunction>
820 for( ; !it.
ended(); ++it )
824 initial = func( initial, *p );
831 template <
typename OUTP,
typename T,
typename BinaryFunction>
846 template <
typename T>
853 template <
typename T>
860 template <
typename OUTP,
typename INP>
867 template <
typename OUTP,
typename INP>
876 template <
typename T>
883 template <
typename T>
886 const std::vector<int> & size )
891 template <
typename OUTP,
typename INP>
894 const std::vector<int> & size )
896 std::vector<int> nsize = size;
905 != AllocatorStrategy::Unallocated )
912 srcparent->getSize(),
913 srcparent->allocatorContext(),
914 srcparent->allocatorContext().isAllocated() ) );
915 if( srcparent->allocatorContext().isAllocated()
916 && srcparent->allocatorContext().allocatorType()
917 != AllocatorStrategy::Unallocated )
926 while( srcchild->refVolume().
get() )
930 srcparent->getSize(),
931 srcparent->allocatorContext(),
932 srcparent->allocatorContext().isAllocated() ) );
933 dstparent->copyHeaderFrom( srcparent->header() );
934 if( srcparent->allocatorContext().isAllocated()
935 && srcparent->allocatorContext().allocatorType()
936 != AllocatorStrategy::Unallocated )
938 dstchild->setRefVolume( dstparent );
939 dstchild->setPosInRefVolume( srcchild->posInRefVolume() );
940 srcchild = srcparent;
941 dstchild = dstparent;
947 template <
typename OUTP,
typename INP>
950 const std::vector<int> & size )
952 std::vector<int> nsize = size;
954 nsize = src->getSize();
957 src->allocatorContext(),
958 src->allocatorContext().isAllocated() ) );
959 dst->copyHeaderFrom( src->header() );
960 if( src->allocatorContext().isAllocated()
961 && src->allocatorContext().allocatorType()
962 != AllocatorStrategy::Unallocated )
968 while( srcchild->refVolume().
get() )
972 srcparent->getSize(),
973 srcparent->allocatorContext(),
974 srcparent->allocatorContext().isAllocated() ) );
975 dstparent->copyHeaderFrom( srcparent->header() );
976 if( srcparent->allocatorContext().isAllocated()
977 && srcparent->allocatorContext().allocatorType()
978 != AllocatorStrategy::Unallocated )
980 dstchild->setRefVolume( dstparent );
981 dstchild->setPosInRefVolume( srcchild->posInRefVolume() );
982 srcchild = srcparent;
983 dstchild = dstparent;
992 template <
typename T>
999 template <
typename T>
1006 template <
typename OUTP,
typename INP>
1016 template <
typename OUTP,
typename INP>
1021 dst->copyHeaderFrom( src->header() );
1029 template <
typename T>
1036 template <
typename T>
1043 template <
typename OUTP,
typename INP>
1058 srcparent->getSize(),
1059 srcparent->allocatorContext(),
1060 srcparent->allocatorContext().isAllocated() ) );
1069 while( srcchild->refVolume().
get() )
1073 srcparent->getSize(),
1074 srcparent->allocatorContext(),
1075 srcparent->allocatorContext().isAllocated() ) );
1076 dstparent->copyHeaderFrom( srcparent->header() );
1079 dstchild->setRefVolume( dstparent );
1080 dstchild->setPosInRefVolume( srcchild->posInRefVolume() );
1081 srcchild = srcparent;
1082 dstchild = dstparent;
1090 template <
typename OUTP,
typename INP>
1099 src->allocatorContext(),
1100 src->allocatorContext().isAllocated() ) );
1101 dst->copyHeaderFrom( src->header() );
1108 while( srcchild->refVolume().
get() )
1112 srcparent->getSize(),
1113 srcparent->allocatorContext(),
1114 srcparent->allocatorContext().isAllocated() ) );
1115 dstparent->copyHeaderFrom( srcparent->header() );
1118 dstchild->setRefVolume( dstparent );
1119 dstchild->setPosInRefVolume( srcchild->posInRefVolume() );
1120 srcchild = srcparent;
1121 dstchild = dstparent;
1132 template <
typename T>
1138 throw std::runtime_error(
"Cannot compute min of an empty volume");
1142 template <
typename T>
1146 if( !vol.get() || ( vol->getSizeX() == 0 && vol->getSizeY() == 0 &&
1147 vol->getSizeZ() == 0 && vol->getSizeT() == 0 ) )
1148 throw std::runtime_error(
"Cannot compute min of an empty volume");
1152 template <
typename T>
1158 throw std::runtime_error(
"Cannot compute max of an empty volume");
1162 template <
typename T>
1166 if( !vol.get() || ( vol->getSizeX() == 0 && vol->getSizeY() == 0 &&
1167 vol->getSizeZ() == 0 && vol->getSizeT() == 0 ) )
1168 throw std::runtime_error(
"Cannot compute max of an empty volume");
1172 template <
typename T>
1180 template <
typename OUTP,
typename T>
1187 template <
typename T>
1194 template <
typename OUTP,
typename T>
1199 return static_cast<OUTP
>(0);
1203 template <
typename T>
1210 template <
typename T>
1217 template <
typename T>
1224 template <
typename T>
1236 template <
typename T,
typename U>
1237 struct inSet:
public std::binary_function<T, U, bool>
1241 for(
typename U::const_iterator k = y.begin(); k != y.end(); ++k )
1249 template <
typename T,
typename U>
1258 template <
typename T,
typename U>
1268 template <
typename T,
typename U>
1269 struct notInSet:
public std::binary_function<T, U, bool>
1273 for(
typename U::const_iterator k = y.begin(); k != y.end(); ++k )
1281 template <
typename T,
typename U>
1290 template <
typename T,
typename U>
1300 template <
typename T,
typename U>
1306 return y ? _value : x;
1313 template <
typename T,
typename U>
1320 template <
typename T,
typename U>
1328 template <
typename T>
1346 template <
typename T>
1355 template <
typename T>
1368 template <
typename T>
1378 if( b[0] != top[0] || b[1] != bot[0] ||
1379 b[2] != top[1] || b[3] != bot[1] ||
1380 b[4] != top[2] || b[5] != bot[2] ||
1381 b[6] != top[3] || b[7] != bot[3] )
1384 volume.
getSizeX() + top[0] + bot[0],
1385 volume.
getSizeY() + top[1] + bot[1],
1386 volume.
getSizeZ() + top[2] + bot[2],
1387 volume.
getSizeT() + top[3] + bot[3] ) );
1388 parent->copyHeaderFrom( volume.
header() );
1403 template <
typename T>
1413 if( b[0] != top[0] || b[1] != bot[0] ||
1414 b[2] != top[1] || b[3] != bot[1] ||
1415 b[4] != top[2] || b[5] != bot[2] ||
1416 b[6] != top[3] || b[7] != bot[3] )
1419 volume->getSizeX() + top[0] + bot[0],
1420 volume->
getSizeY() + top[1] + bot[1],
1421 volume->
getSizeZ() + top[2] + bot[2],
1422 volume->
getSizeT() + top[3] + bot[3] ) );
1423 parent->copyHeaderFrom( volume->header() );
1427 volume->getSizeT() );
1430 volume->reallocate( volume->getSizeX(), volume->getSizeY(),
1431 volume->getSizeZ(), volume->getSizeT(),
1432 true, volume->allocatorContext(),
false );
1433 volume->setRefVolume( parent );
1434 volume->setPosInRefVolume( top );
1438 template <
typename T>
1448 if( b[0] < top[0] || b[1] < bot[0] ||
1449 b[2] < top[1] || b[3] < bot[1] ||
1450 b[4] < top[2] || b[5] < bot[2] ||
1451 b[6] < top[3] || b[7] < bot[3] )
1454 volume.
getSizeX() + top[0] + bot[0],
1455 volume.
getSizeY() + top[1] + bot[1],
1456 volume.
getSizeZ() + top[2] + bot[2],
1457 volume.
getSizeT() + top[3] + bot[3] ) );
1458 parent->copyHeaderFrom( volume.
header() );
1473 template <
typename T>
1483 if( b[0] < top[0] || b[1] < bot[0] ||
1484 b[2] < top[1] || b[3] < bot[1] ||
1485 b[4] < top[2] || b[5] < bot[2] ||
1486 b[6] < top[3] || b[7] < bot[3] )
1489 volume->getSizeX() + top[0] + bot[0],
1490 volume->
getSizeY() + top[1] + bot[1],
1491 volume->
getSizeZ() + top[2] + bot[2],
1492 volume->
getSizeT() + top[3] + bot[3] ) );
1493 parent->copyHeaderFrom( volume->header() );
1497 volume->getSizeT() );
1500 volume->reallocate( volume->getSizeX(), volume->getSizeY(),
1501 volume->getSizeZ(), volume->getSizeT(),
1502 true, volume->allocatorContext(),
false );
1503 volume->setRefVolume( parent );
1504 volume->setPosInRefVolume( top );
1513 template <
typename T>
class VolumeRef;
1521 template <
typename T,
class BinaryFunction>
1526 :
value( x ),
f( func ) {}
1528 {
return f( y,
value ); }
1538 template <
typename T,
class BinaryFunction>
1543 :
value( x ),
f( func ) {}
1545 {
return f(
value, y ); }
1553 template <
typename T,
typename U>
1559 {
return (T) ( x *
scale ); }
1566 return x * (float)
scale;
1572 return x * (float)
scale;
1578 return x * (double)
scale;
1584 return x * (double)
scale;
1591 template <
typename T,
typename U>
1597 {
return (T) ( x /
divisor ); }
1604 return x * (float) ( 1. /
divisor );
1610 return x * (float) ( 1. / (
double)
divisor );
1622 return x * (double) ( 1. /
divisor );
1628 return x * (double) ( 1. /
divisor );
1631 template <
typename T,
bool Scalar>
1636 template <
typename T>
1649 template <
typename T>
1654 template <
typename T>
1659 template <
class UnaryFunction>
static
1667 template <
class UnaryFunction>
static
1671 template <
class BinaryFunction>
static
1684 template <
class BinaryFunction>
static
1687 template <
class BinaryFunction>
static
1692 template <
typename T>
1701 for( j=1; j<n; ++j )
1703 tmp = thing.
at( j );
1705 while( i >= 0L && thing.
at( i ) > tmp )
1707 thing.
at( i + 1 ) = thing.
at( i );
1710 thing.
at( i + 1 ) = tmp;
1715 for( j=1; j<n; ++j )
1717 tmp = thing.
at( j );
1719 while( i >= 0L && thing.
at( i ) < tmp )
1721 thing.
at( i + 1 ) = thing.
at( i );
1724 thing.
at( i + 1 ) = tmp;
1730 template <
typename T>
1734 sort( *thing, ascending );
T operator()(const T &x) const
T operator()(const T &x) const
T operator()(const T &y) const
UnaryFromConstantBinaryFunctor2(const T &x, BinaryFunction func)
T operator()(const T &y) const
UnaryFromConstantBinaryFunctor(const T &x, BinaryFunction func)
virtual void copyHeaderFrom(const PropertySet &other, bool stopOnError=true)
copy properties from other to this, avoiding forbidden properties like size.
std::vector< int > getSize() const
get the 4 dimensions in a vector
Convenient handle for a Volume - this is normally the entry point for all volumes handling.
Volume utilities classes.
static T accumulate(BinaryFunction f, const VolumeRef< T > &o2, T initial)
Apply a binary function to each voxel of the volume, with a "current" value as second argument.
static void selfApply(UnaryFunction f, VolumeRef< T > &o)
applies a binary function to each voxel of a pair of volumes
static VolumeRef< T > apply(UnaryFunction f, const VolumeRef< T > &o)
applies a unary function to each voxel of a volume
const AllocatorContext & allocatorContext() const
returns volume's AllocatorContext
void setPosInRefVolume(const Position4Di &pos)
Set position in parent volume.
const Position & posInRefVolume() const
Get position in parent volume.
void setRefVolume(const rc_ptr< Volume< T > > &refvol)
Set parent volume.
rc_ptr< Volume< T > > refVolume() const
Get parent volume.
std::vector< int > getBorders() const
Get borders for the volume.
std::vector< long > getStrides() const
Get strides for the volume.
const T & at(long x, long y=0, long z=0, long t=0) const
virtual void reallocate(int sizeX=1, int sizeY=1, int sizeZ=1, int sizeT=1, bool keepcontents=false, const AllocatorContext &allocatorContext=AllocatorContext(), bool allocate=true, const std::vector< long > *strides=0)
allows resizing and changing allocator
std::ptrdiff_t line_length() const
void inc_line_ptr(const T *&p) const
std::ptrdiff_t line_length() const
void inc_line_ptr(T *&p) const
Volume< OUTP > & applyTowards(const Volume< T > &vol, Volume< OUTP > &dst, UnaryFunction func)
Apply a function to all the elements of a volume (already allocated output version)
OUTP accumulate(const Volume< T > &vol, BinaryFunction func, OUTP initial)
Accumulation over a volume.
std::vector< int > minSize(const std::vector< int > &s1, const std::vector< int > &s2)
return the smallest dimensions between s1 and s2
Volume< T > & selfApply(Volume< T > &vol, UnaryFunction func)
Apply a function to all the elements of a volume (in place version)
std::vector< int > maxSize(const std::vector< int > &s1, const std::vector< int > &s2)
return the largest dimensions between s1 and s2
Volume< typename UnaryFunction::result_type > apply(const Volume< T > &vol, UnaryFunction func)
Apply a function to all the elements of a volume (create output version)
bool sameSize(const std::vector< int > &s1, const std::vector< int > &s2)
Used by the actual Volume and VolumeRef operators It allows to keep the loops in one place and to spe...
bool any(const Volume< T > &vol)
Returns true if at least one value compares to true.
Volume< bool > valuesIn(const Volume< T > &volume, const U &set)
Find values contained in a set.
Volume< T > invertMinMax(const Volume< T > &volume)
Invert a volume between its min and max values.
bool isSameVolumeSize(const Volume< T > &v1, const Volume< T > &v2)
rc_ptr< Volume< T > > undiag(const rc_ptr< Volume< T > > &thing)
Volume< T > deepcopy(const Volume< T > &src, const std::vector< int > &size=std::vector< int >())
Performs a copy of the data (not only a reference copy) The whole view hierarchy is fully duplicated.
void conditionalSet(Volume< T > &volume, const Volume< U > &condition, const T &value)
Conditionally fill a volume.
void transfer(const Volume< T > &src, Volume< T > &dst)
Transfer data from an allocated volume to another Allocated sizes must be equal (same number of voxel...
Volume< T > copyStructure(const Volume< T > &src)
Performs a copy of the view structure without transfering the data.
Volume< T > copy(const Volume< T > &src)
Performs a copy of the data (not only a reference copy) Only the data inside the view is copied.
T min(const Volume< T > &vol)
Returns the minimum value of the volume.
T max(const Volume< T > &vol)
Returns the maximum value of the volume.
DataTypeTraits< T >::LongType sum(const Volume< T > &vol)
Returns the sum of the volume values.
void sort(Volume< T > &thing, bool ascending=true)
VolumeRef< T > matrix_product(const Volume< T > &v1, const Volume< T > &v2)
matrix product
VolumeRef< T > transpose(const Volume< T > &v)
transpose
bool all(const Volume< T > &vol)
Returns true if all values compare to true.
void setBorders(Volume< T > &volume, const typename Volume< T >::Position4Di &top, const typename Volume< T >::Position4Di &bottom=typename Volume< T >::Position4Di(-1, -1, -1, -1))
Set border width.
void setMinBorders(Volume< T > &volume, const typename Volume< T >::Position4Di &top, const typename Volume< T >::Position4Di &bottom=typename Volume< T >::Position4Di(-1, -1, -1, -1))
Set border width.
Volume< bool > valuesNotIn(const Volume< T > &volume, const U &set)
Find values not contained in a set.
rc_ptr< Volume< T > > diag(const rc_ptr< Volume< T > > &thing)
Build a diagonal matrix from a line (1D) vector.
bool operator()(const T &x, const U &y)
bool operator()(const T &x, const U &y)
invMinMax(const T &min, const T &max)
bool operator()(const T &x, const U &y)
std::complex< double > cdouble
std::complex< float > cfloat