60 template <
typename T =
double>
81 castget = castgetStatic<uint8_t>;
82 castset = castsetStatic<uint8_t>;
85 castget = castgetStatic<int8_t>;
86 castset = castsetStatic<int8_t>;
89 castget = castgetStatic<uint16_t>;
90 castset = castsetStatic<uint16_t>;
93 castget = castgetStatic<int16_t>;
94 castset = castsetStatic<int16_t>;
97 castget = castgetStatic<uint32_t>;
98 castset = castsetStatic<uint32_t>;
101 castget = castgetStatic<int32_t>;
102 castset = castsetStatic<int32_t>;
105 castget = castgetStatic<uint64_t>;
106 castset = castsetStatic<uint64_t>;
109 castget = castgetStatic<int64_t>;
110 castset = castsetStatic<int64_t>;
113 castget = castgetStatic<float>;
114 castset = castsetStatic<float>;
117 castget = castgetStatic<double>;
118 castset = castsetStatic<double>;
121 castget = castgetStatic<long double>;
122 castset = castsetStatic<long double>;
125 castget = castgetStatic<cfloat_t>;
126 castset = castsetStatic<cfloat_t>;
129 castget = castgetStatic<cdouble_t>;
130 castset = castsetStatic<cdouble_t>;
133 castget = castgetStatic<cquad_t>;
134 castset = castsetStatic<cquad_t>;
137 castget = castgetStatic<rgb_t>;
138 castset = castsetStatic<rgb_t>;
141 castget = castgetStatic<rgba_t>;
142 castset = castsetStatic<rgba_t>;
146 castget = castgetStatic<uint8_t>;
147 castset = castsetStatic<uint8_t>;
148 throw std::invalid_argument(
"Unknown type to FlatIter");
182 auto ptr = parent->__getAddr(m_linpos);
183 assert(
ptr >= this->parent->__getAddr(0) &&
184 ptr < this->parent->__getAddr(this->parent->elements()));
195 auto ptr = parent->__getAddr(m_linpos);
196 assert(
ptr >= this->parent->__getAddr(0) &&
197 ptr < this->parent->__getAddr(this->parent->elements()));
208 auto ptr = parent->__getAddr(m_linpos);
209 assert(
ptr >= this->parent->__getAddr(0) &&
210 ptr < this->parent->__getAddr(this->parent->elements()));
222 void goEnd() { m_linpos=parent->elements(); };
227 bool isEnd()
const {
return m_linpos==parent->elements(); };
232 bool eof()
const {
return m_linpos==parent->elements(); };
237 bool isBegin()
const {
return m_linpos == 0; };
248 return parent == other.parent && m_linpos == other.m_linpos;
260 return parent != other.parent || this->m_linpos != other.m_linpos;
273 return parent == other.parent && m_linpos < other.m_linpos;
286 return parent == other.parent && m_linpos > other.m_linpos;
299 return parent == other.parent && m_linpos <= other.m_linpos;
312 return parent == other.parent && m_linpos >= other.m_linpos;
316 template <
typename U>
317 static T castgetStatic(
void*
ptr)
319 return (T)(*((U*)ptr));
322 template <
typename U>
323 static void castsetStatic(
void* ptr,
const T& val)
325 (*((U*)ptr)) = (U)val;
329 std::shared_ptr<NDArray> parent;
331 T (*castget)(
void*
ptr);
332 void (*castset)(
void*
ptr,
const T& v);
344 template <
typename T =
double>
365 castget = castgetStatic<uint8_t>;
368 castget = castgetStatic<int8_t>;
371 castget = castgetStatic<uint16_t>;
374 castget = castgetStatic<int16_t>;
377 castget = castgetStatic<uint32_t>;
380 castget = castgetStatic<int32_t>;
383 castget = castgetStatic<uint64_t>;
386 castget = castgetStatic<int64_t>;
389 castget = castgetStatic<float>;
392 castget = castgetStatic<double>;
395 castget = castgetStatic<long double>;
398 castget = castgetStatic<cfloat_t>;
401 castget = castgetStatic<cdouble_t>;
404 castget = castgetStatic<cquad_t>;
407 castget = castgetStatic<rgb_t>;
410 castget = castgetStatic<rgba_t>;
414 castget = castgetStatic<uint8_t>;
415 throw std::invalid_argument(
"Unknown type to FlatIter");
449 auto ptr = parent->__getAddr(m_linpos);
450 assert(ptr >= this->parent->__getAddr(0) &&
451 ptr < this->parent->__getAddr(this->parent->elements()));
462 auto ptr = parent->__getAddr(m_linpos);
463 assert(ptr >= this->parent->__getAddr(0) &&
464 ptr < this->parent->__getAddr(this->parent->elements()));
476 void goEnd() { m_linpos=parent->elements(); };
481 bool isEnd()
const {
return m_linpos==parent->elements(); };
486 bool eof()
const {
return m_linpos==parent->elements(); };
491 bool isBegin()
const {
return m_linpos == 0; };
502 return parent == other.parent && m_linpos == other.m_linpos;
514 return parent != other.parent || this->m_linpos != other.m_linpos;
527 return parent == other.parent && m_linpos < other.m_linpos;
540 return parent == other.parent && m_linpos > other.m_linpos;
553 return parent == other.parent && m_linpos <= other.m_linpos;
566 return parent == other.parent && m_linpos >= other.m_linpos;
570 template <
typename U>
571 static T castgetStatic(
void* ptr)
573 return (T)(*((U*)ptr));
576 std::shared_ptr<const NDArray> parent;
578 T (*castget)(
void*
ptr);
589 template <
typename T =
double>
606 setDim(in->ndim(), in->dim());
610 castget = castgetStatic<uint8_t>;
613 castget = castgetStatic<int8_t>;
616 castget = castgetStatic<uint16_t>;
619 castget = castgetStatic<int16_t>;
622 castget = castgetStatic<uint32_t>;
625 castget = castgetStatic<int32_t>;
628 castget = castgetStatic<uint64_t>;
631 castget = castgetStatic<int64_t>;
634 castget = castgetStatic<float>;
637 castget = castgetStatic<double>;
640 castget = castgetStatic<long double>;
643 castget = castgetStatic<cfloat_t>;
646 castget = castgetStatic<cdouble_t>;
649 castget = castgetStatic<cquad_t>;
652 castget = castgetStatic<rgb_t>;
655 castget = castgetStatic<rgba_t>;
659 castget = castgetStatic<uint8_t>;
660 throw std::invalid_argument(
"Unknown type to NDConstIter");
694 auto ptr = parent->__getAddr(Slicer::operator*());
695 assert(ptr >= this->parent->__getAddr(0) &&
696 ptr < this->parent->__getAddr(this->parent->elements()));
707 auto ptr = parent->__getAddr(Slicer::operator*());
708 assert(ptr >= this->parent->__getAddr(0) &&
709 ptr < this->parent->__getAddr(this->parent->elements()));
772 if(parent != other.parent)
775 for(
size_t dd=0; dd<this->
m_dim; dd++) {
793 if(parent != other.parent)
796 for(
size_t dd=0; dd<this->
m_dim; dd++) {
814 if(parent != other.parent)
820 return *
this < other;
833 if(parent != other.parent)
839 return *
this > other;
843 template <
typename U>
844 static T castgetStatic(
void* ptr)
846 return (T)(*((U*)ptr));
849 std::shared_ptr<const NDArray> parent;
851 T (*castget)(
void*
ptr);
859 template <
typename T =
double>
877 setDim(in->ndim(), in->dim());
880 castget = castgetStatic<uint8_t>;
881 castset = castsetStatic<uint8_t>;
884 castget = castgetStatic<int8_t>;
885 castset = castsetStatic<int8_t>;
888 castget = castgetStatic<uint16_t>;
889 castset = castsetStatic<uint16_t>;
892 castget = castgetStatic<int16_t>;
893 castset = castsetStatic<int16_t>;
896 castget = castgetStatic<uint32_t>;
897 castset = castsetStatic<uint32_t>;
900 castget = castgetStatic<int32_t>;
901 castset = castsetStatic<int32_t>;
904 castget = castgetStatic<uint64_t>;
905 castset = castsetStatic<uint64_t>;
908 castget = castgetStatic<int64_t>;
909 castset = castsetStatic<int64_t>;
912 castget = castgetStatic<float>;
913 castset = castsetStatic<float>;
916 castget = castgetStatic<double>;
917 castset = castsetStatic<double>;
920 castget = castgetStatic<long double>;
921 castset = castsetStatic<long double>;
924 castget = castgetStatic<cfloat_t>;
925 castset = castsetStatic<cfloat_t>;
928 castget = castgetStatic<cdouble_t>;
929 castset = castsetStatic<cdouble_t>;
932 castget = castgetStatic<cquad_t>;
933 castset = castsetStatic<cquad_t>;
936 castget = castgetStatic<rgb_t>;
937 castset = castsetStatic<rgb_t>;
940 castget = castgetStatic<rgba_t>;
941 castset = castsetStatic<rgba_t>;
945 castget = castgetStatic<uint8_t>;
946 castset = castsetStatic<uint8_t>;
947 throw std::invalid_argument(
"Unknown type to NDIter");
981 auto ptr = parent->__getAddr(Slicer::operator*());
982 assert(ptr >= this->parent->__getAddr(0) &&
983 ptr < this->parent->__getAddr(this->parent->elements()));
994 auto ptr = parent->__getAddr(Slicer::operator*());
995 assert(ptr >= this->parent->__getAddr(0) &&
996 ptr < this->parent->__getAddr(this->parent->elements()));
1007 auto ptr = parent->__getAddr(Slicer::operator*());
1008 assert(ptr >= this->parent->__getAddr(0) &&
1009 ptr < this->parent->__getAddr(this->parent->elements()));
1010 this->castset(ptr, v);
1072 if(parent != other.parent)
1075 for(
size_t dd=0; dd<this->
m_dim; dd++) {
1093 if(parent != other.parent)
1096 for(
size_t dd=0; dd<this->
m_dim; dd++) {
1114 if(parent != other.parent)
1120 return *
this < other;
1133 if(parent != other.parent)
1139 return *
this > other;
1143 template <
typename U>
1144 static T castgetStatic(
void* ptr)
1146 return (T)(*((U*)ptr));
1149 template <
typename U>
1150 static void castsetStatic(
void* ptr,
const T& val)
1152 (*((U*)ptr)) = (U)val;
1156 std::shared_ptr<NDArray> parent;
1158 T (*castget)(
void*
ptr);
1159 void (*castset)(
void*
ptr,
const T& val);
1205 template <
typename T =
double>
1223 setDim(in->ndim(), in->dim());
1225 switch(in->type()) {
1227 castget = castgetStatic<uint8_t>;
1230 castget = castgetStatic<int8_t>;
1233 castget = castgetStatic<uint16_t>;
1236 castget = castgetStatic<int16_t>;
1239 castget = castgetStatic<uint32_t>;
1242 castget = castgetStatic<int32_t>;
1245 castget = castgetStatic<uint64_t>;
1248 castget = castgetStatic<int64_t>;
1251 castget = castgetStatic<float>;
1254 castget = castgetStatic<double>;
1257 castget = castgetStatic<long double>;
1260 castget = castgetStatic<cfloat_t>;
1263 castget = castgetStatic<cdouble_t>;
1266 castget = castgetStatic<cquad_t>;
1269 castget = castgetStatic<rgb_t>;
1272 castget = castgetStatic<rgba_t>;
1276 castget = castgetStatic<uint8_t>;
1277 throw std::invalid_argument(
"Unknown type to ChunkConstIter");
1333 auto ptr = parent->__getAddr(ChunkSlicer::operator*());
1334 assert(ptr >= this->parent->__getAddr(0) &&
1335 ptr < this->parent->__getAddr(this->parent->elements()));
1336 return castget(ptr);
1346 auto ptr = parent->__getAddr(ChunkSlicer::operator*());
1347 assert(ptr >= this->parent->__getAddr(0) &&
1348 ptr < this->parent->__getAddr(this->parent->elements()));
1349 return castget(ptr);
1411 if(parent != other.parent)
1414 for(
size_t dd=0; dd<this->
m_dim; dd++) {
1432 if(parent != other.parent)
1435 for(
size_t dd=0; dd<this->
m_dim; dd++) {
1453 if(parent != other.parent)
1459 return *
this < other;
1472 if(parent != other.parent)
1478 return *
this > other;
1482 template <
typename U>
1483 static T castgetStatic(
void* ptr)
1485 return (T)(*((U*)ptr));
1488 std::shared_ptr<const NDArray> parent;
1490 T (*castget)(
void*
ptr);
1519 template <
typename T =
double>
1538 setDim(in->ndim(), in->dim());
1539 switch(in->type()) {
1541 castget = castgetStatic<uint8_t>;
1542 castset = castsetStatic<uint8_t>;
1545 castget = castgetStatic<int8_t>;
1546 castset = castsetStatic<int8_t>;
1549 castget = castgetStatic<uint16_t>;
1550 castset = castsetStatic<uint16_t>;
1553 castget = castgetStatic<int16_t>;
1554 castset = castsetStatic<int16_t>;
1557 castget = castgetStatic<uint32_t>;
1558 castset = castsetStatic<uint32_t>;
1561 castget = castgetStatic<int32_t>;
1562 castset = castsetStatic<int32_t>;
1565 castget = castgetStatic<uint64_t>;
1566 castset = castsetStatic<uint64_t>;
1569 castget = castgetStatic<int64_t>;
1570 castset = castsetStatic<int64_t>;
1573 castget = castgetStatic<float>;
1574 castset = castsetStatic<float>;
1577 castget = castgetStatic<double>;
1578 castset = castsetStatic<double>;
1581 castget = castgetStatic<long double>;
1582 castset = castsetStatic<long double>;
1585 castget = castgetStatic<cfloat_t>;
1586 castset = castsetStatic<cfloat_t>;
1589 castget = castgetStatic<cdouble_t>;
1590 castset = castsetStatic<cdouble_t>;
1593 castget = castgetStatic<cquad_t>;
1594 castset = castsetStatic<cquad_t>;
1597 castget = castgetStatic<rgb_t>;
1598 castset = castsetStatic<rgb_t>;
1601 castget = castgetStatic<rgba_t>;
1602 castset = castsetStatic<rgba_t>;
1606 castget = castgetStatic<uint8_t>;
1607 castset = castsetStatic<uint8_t>;
1608 throw std::invalid_argument(
"Unknown type to ChunkIter");
1664 auto ptr = parent->__getAddr(ChunkSlicer::operator*());
1665 assert(ptr >= this->parent->__getAddr(0) &&
1666 ptr < this->parent->__getAddr(this->parent->elements()));
1667 return castget(ptr);
1677 auto ptr = parent->__getAddr(ChunkSlicer::operator*());
1678 assert(ptr >= this->parent->__getAddr(0) &&
1679 ptr < this->parent->__getAddr(this->parent->elements()));
1680 return castget(ptr);
1690 auto ptr = parent->__getAddr(ChunkSlicer::operator*());
1691 assert(ptr >= this->parent->__getAddr(0) &&
1692 ptr < this->parent->__getAddr(this->parent->elements()));
1693 this->castset(ptr, v);
1755 if(parent != other.parent)
1758 for(
size_t dd=0; dd<this->
m_dim; dd++) {
1776 if(parent != other.parent)
1779 for(
size_t dd=0; dd<this->
m_dim; dd++) {
1797 if(parent != other.parent)
1803 return *
this < other;
1816 if(parent != other.parent)
1822 return *
this > other;
1826 template <
typename U>
1827 static T castgetStatic(
void* ptr)
1829 return (T)(*((U*)ptr));
1832 template <
typename U>
1833 static void castsetStatic(
void* ptr,
const T& val)
1835 (*((U*)ptr)) = (U)val;
1839 std::shared_ptr<NDArray> parent;
1841 T (*castget)(
void*
ptr);
1842 void (*castset)(
void*
ptr,
const T& val);
1870 template <
typename T =
double>
1888 setDim(in->ndim(), in->dim());
1890 switch(in->type()) {
1892 castget = castgetStatic<uint8_t>;
1895 castget = castgetStatic<int8_t>;
1898 castget = castgetStatic<uint16_t>;
1901 castget = castgetStatic<int16_t>;
1904 castget = castgetStatic<uint32_t>;
1907 castget = castgetStatic<int32_t>;
1910 castget = castgetStatic<uint64_t>;
1913 castget = castgetStatic<int64_t>;
1916 castget = castgetStatic<float>;
1919 castget = castgetStatic<double>;
1922 castget = castgetStatic<long double>;
1925 castget = castgetStatic<cfloat_t>;
1928 castget = castgetStatic<cdouble_t>;
1931 castget = castgetStatic<cquad_t>;
1934 castget = castgetStatic<rgb_t>;
1937 castget = castgetStatic<rgba_t>;
1941 castget = castgetStatic<uint8_t>;
1942 throw std::invalid_argument(
"Unknown type to NDConstIter");
1976 auto ptr = parent->__getAddr(KSlicer::operator*());
1977 assert(ptr >= this->parent->__getAddr(0) &&
1978 ptr < this->parent->__getAddr(this->parent->elements()));
1979 return castget(ptr);
1990 assert(ptr >= this->parent->__getAddr(0) &&
1991 ptr < this->parent->__getAddr(this->parent->elements()));
1992 return castget(ptr);
2004 assert(ptr >= this->parent->__getAddr(0) &&
2005 ptr < this->parent->__getAddr(this->parent->elements()));
2006 return castget(ptr);
2018 assert(ptr >= this->parent->__getAddr(0) &&
2019 ptr < this->parent->__getAddr(this->parent->elements()));
2020 return castget(ptr);
2057 if(parent != other.parent)
2060 for(
size_t dd=0; dd<this->m_dim; dd++) {
2078 if(parent != other.parent)
2081 for(
size_t dd=0; dd<this->m_dim; dd++) {
2099 if(parent != other.parent)
2105 return *
this < other;
2118 if(parent != other.parent)
2124 return *
this > other;
2128 template <
typename U>
2129 static T castgetStatic(
void* ptr)
2131 return (T)(*((U*)ptr));
2134 std::shared_ptr<const NDArray> parent;
2136 T (*castget)(
void*
ptr);
2148 template <
typename T =
double>
2166 setDim(in->ndim(), in->dim());
2170 std::vector<std::pair<int64_t,int64_t>> roi(in->ndim());
2171 for(
size_t ii=0; ii<3 && ii<in->ndim(); ii++) {
2173 roi[ii].second = in->dim(ii)-1;
2177 for(
size_t ii=3; ii<in->ndim(); ii++) {
2183 switch(in->type()) {
2185 castget = castgetStatic<uint8_t>;
2186 castset = castsetStatic<uint8_t>;
2189 castget = castgetStatic<int8_t>;
2190 castset = castsetStatic<int8_t>;
2193 castget = castgetStatic<uint16_t>;
2194 castset = castsetStatic<uint16_t>;
2197 castget = castgetStatic<int16_t>;
2198 castset = castsetStatic<int16_t>;
2201 castget = castgetStatic<uint32_t>;
2202 castset = castsetStatic<uint32_t>;
2205 castget = castgetStatic<int32_t>;
2206 castset = castsetStatic<int32_t>;
2209 castget = castgetStatic<uint64_t>;
2210 castset = castsetStatic<uint64_t>;
2213 castget = castgetStatic<int64_t>;
2214 castset = castsetStatic<int64_t>;
2217 castget = castgetStatic<float>;
2218 castset = castsetStatic<float>;
2221 castget = castgetStatic<double>;
2222 castset = castsetStatic<double>;
2225 castget = castgetStatic<long double>;
2226 castset = castsetStatic<long double>;
2229 castget = castgetStatic<cfloat_t>;
2230 castset = castsetStatic<cfloat_t>;
2233 castget = castgetStatic<cdouble_t>;
2234 castset = castsetStatic<cdouble_t>;
2237 castget = castgetStatic<cquad_t>;
2238 castset = castsetStatic<cquad_t>;
2241 castget = castgetStatic<rgb_t>;
2242 castset = castsetStatic<rgb_t>;
2245 castget = castgetStatic<rgba_t>;
2246 castset = castsetStatic<rgba_t>;
2250 castget = castgetStatic<uint8_t>;
2251 castset = castsetStatic<uint8_t>;
2252 throw std::invalid_argument(
"Unknown type to NDIter");
2286 auto ptr = parent->__getAddr(Slicer::operator*());
2287 assert(ptr >= this->parent->__getAddr(0) &&
2288 ptr < this->parent->__getAddr(this->parent->elements()));
2289 return castget(ptr);
2297 T
get(int64_t i = 0)
const
2299 auto ptr = parent->__getAddr(Slicer::operator*()+i);
2300 assert(ptr >= this->parent->__getAddr(0) &&
2301 ptr < this->parent->__getAddr(this->parent->elements()));
2302 return castget(ptr);
2312 auto ptr = parent->__getAddr(Slicer::operator*()+i);
2313 assert(ptr >= this->parent->__getAddr(0) &&
2314 ptr < this->parent->__getAddr(this->parent->elements()));
2315 return castget(ptr);
2324 auto ptr = parent->__getAddr(Slicer::operator*()+i);
2325 assert(ptr >= this->parent->__getAddr(0) &&
2326 ptr < this->parent->__getAddr(this->parent->elements()));
2327 this->castset(ptr, v);
2336 auto ptr = parent->__getAddr(Slicer::operator*());
2337 assert(ptr >= this->parent->__getAddr(0) &&
2338 ptr < this->parent->__getAddr(this->parent->elements()));
2339 this->castset(ptr, v);
2401 if(parent != other.parent)
2404 for(
size_t dd=0; dd<this->
m_dim; dd++) {
2422 if(parent != other.parent)
2425 for(
size_t dd=0; dd<this->
m_dim; dd++) {
2443 if(parent != other.parent)
2449 return *
this < other;
2462 if(parent != other.parent)
2468 return *
this > other;
2471 size_t tlen()
const {
return this->parent->tlen(); };
2474 template <
typename U>
2475 static T castgetStatic(
void* ptr)
2477 return (T)(*((U*)ptr));
2480 template <
typename U>
2481 static void castsetStatic(
void* ptr,
const T& val)
2483 (*((U*)ptr)) = (U)val;
2487 std::shared_ptr<NDArray> parent;
2489 T (*castget)(
void*
ptr);
2490 void (*castset)(
void*
ptr,
const T& val);
2502 template <
typename T =
double>
2520 setDim(in->ndim(), in->dim());
2524 std::vector<std::pair<int64_t,int64_t>> roi(in->ndim());
2525 for(
size_t ii=0; ii<3 && ii<in->ndim(); ii++) {
2527 roi[ii].second = in->dim(ii)-1;
2531 for(
size_t ii=3; ii<in->ndim(); ii++) {
2537 switch(in->type()) {
2539 castget = castgetStatic<uint8_t>;
2542 castget = castgetStatic<int8_t>;
2545 castget = castgetStatic<uint16_t>;
2548 castget = castgetStatic<int16_t>;
2551 castget = castgetStatic<uint32_t>;
2554 castget = castgetStatic<int32_t>;
2557 castget = castgetStatic<uint64_t>;
2560 castget = castgetStatic<int64_t>;
2563 castget = castgetStatic<float>;
2566 castget = castgetStatic<double>;
2569 castget = castgetStatic<long double>;
2572 castget = castgetStatic<cfloat_t>;
2575 castget = castgetStatic<cdouble_t>;
2578 castget = castgetStatic<cquad_t>;
2581 castget = castgetStatic<rgb_t>;
2584 castget = castgetStatic<rgba_t>;
2588 castget = castgetStatic<uint8_t>;
2589 throw std::invalid_argument(
"Unknown type to NDIter");
2623 auto ptr = parent->__getAddr(Slicer::operator*());
2624 assert(ptr >= this->parent->__getAddr(0) &&
2625 ptr < this->parent->__getAddr(this->parent->elements()));
2626 return castget(ptr);
2634 T
get(int64_t i = 0)
const
2636 auto ptr = parent->__getAddr(Slicer::operator*()+i);
2637 assert(ptr >= this->parent->__getAddr(0) &&
2638 ptr < this->parent->__getAddr(this->parent->elements()));
2639 return castget(ptr);
2649 auto ptr = parent->__getAddr(Slicer::operator*()+i);
2650 assert(ptr >= this->parent->__getAddr(0) &&
2651 ptr < this->parent->__getAddr(this->parent->elements()));
2652 return castget(ptr);
2714 if(parent != other.parent)
2717 for(
size_t dd=0; dd<this->
m_dim; dd++) {
2735 if(parent != other.parent)
2738 for(
size_t dd=0; dd<this->
m_dim; dd++) {
2756 if(parent != other.parent)
2762 return *
this < other;
2775 if(parent != other.parent)
2781 return *
this > other;
2784 size_t tlen()
const {
return this->parent->tlen(); };
2787 template <
typename U>
2788 static T castgetStatic(
void* ptr)
2790 return (T)(*((U*)ptr));
2793 std::shared_ptr<const NDArray> parent;
2795 T (*castget)(
void*
ptr);
KSlicer & operator--()
Prefix negative iterator. Iterates in the order dictatored by the dimension order passsed during cons...
FlatIter & operator--()
Prefix decrement operator.
void goBegin()
Go to beginning of iteration.
bool operator>=(const ChunkConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
void setArray(ptr< const NDArray > in)
ChunkSlicer & nextChunk()
Proceed to the next chunk (if there is one).
bool operator<=(const KernelIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
void goEnd()
Go to end of iteration.
bool operator>=(const ChunkIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
bool operator>=(const KernelIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
bool operator==(const ChunkConstIter &other) const
Whether the position and parent are the same as another.
Flat iterator iterator for NDArray. No information is kept about the current index. Just goes through all data. This casts the output to the type specified using T.
bool operator>=(const NDIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
bool operator<(const Vector3DIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
bool operator>=(const Vector3DConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
FlatIter & operator++()
Prefix increment operator.
void setROI(size_t len, const size_t *roisize, const int64_t *roistart=NULL)
Sets the region of interest, with lower bound of 0. During iteration or any motion the position will ...
void set(int64_t i, T v)
Set the value at the ith element of thevector.
void setArray(ptr< const NDArray > in)
void setDim(size_t ndim, const size_t *dim)
Updates dimensions of target nd array.
T operator*() const
Dereference operator.
bool isEnd() const
Are we one past the last element?
bool operator==(const FlatIter &other) const
Whether the position and parent are the same as another.
void goBegin()
Go to beginning of iteration.
bool operator!=(const KernelIter &other) const
Whether the position and parent are different from another.
bool isBegin() const
Are we at the first element.
ChunkSlicer & operator--()
Prefix negative iterator. Iterates in the order dictatored by the dimension order passsed during cons...
void set(T v)
Dereference operator.
std::vector< int64_t > m_pos
bool eof() const
Are we one past the last element?
FlatConstIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
bool isBegin() const
Are we at the begining of iteration?
bool isBegin() const
Are we at the first element.
bool operator>(const FlatIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
FlatConstIter & operator--()
Prefix decrement operator.
bool isEnd() const
Are we one past the last element?
KernelIter & operator--()
Prefix decrement operator.
Vector3DConstIter(std::shared_ptr< const NDArray > in)
bool operator>(const Vector3DConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
std::vector< int64_t > m_linpos
bool eof() const
Are we one past the last element?
Vector3DConstIter & operator--()
Prefix decrement operator.
NDConstIter & operator++()
Prefix increment operator.
std::vector< size_t > m_dim
bool operator>(const NDIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
NDIter & operator--()
Prefix decrement operator.
FlatConstIter & operator++()
Prefix increment operator.
This class is used to step through an ND array in order of dimensions, but unlike Slicer it breaks th...
KernelIter & operator++()
Prefix increment operator.
bool operator==(const NDIter &other) const
Whether the position and parent are the same as another.
bool isEnd() const
Are we one past the last element?
void goEnd()
Go to end of iteration.
bool isEnd() const
Are we one past the last element?
bool operator>(const ChunkConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
bool eof() const
Are we one past the last element?
NDIter & operator++()
Prefix increment operator.
bool operator<=(const NDConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
T operator*() const
Dereference operator.
Vector3DConstIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
ChunkConstIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
bool operator>(const FlatConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
bool operator==(const NDConstIter &other) const
Whether the position and parent are the same as another.
ChunkConstIter & operator--()
Prefix decrement operator.
Vector3DIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
void setArray(ptr< const NDArray > in)
bool operator>=(const Vector3DIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
This class is used to iterate through an 3D array, where each point then has has multiple higher dime...
ChunkConstIter & operator++()
Prefix increment operator.
bool operator!=(const ChunkConstIter &other) const
Whether the position and parent are different from another.
ChunkIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
T operator[](int64_t i) const
Get value at ith element of vector.
bool operator>=(const FlatIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
void setArray(ptr< NDArray > in)
bool operator==(const FlatConstIter &other) const
Whether the position and parent are the same as another.
bool operator<(const KernelIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
KernelIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
T operator*() const
Dereference operator, get center pixel value.
KSlicer & operator++()
Prefix iterator. Iterates in the order dictatored by the dimension order passsed during construction ...
void goEnd()
Go to end of iteration.
void goEnd()
Go to end of iteration.
This class is used to iterate through an N-Dimensional array.
void setArray(ptr< NDArray > in)
std::vector< int64_t > m_pos
bool operator>(const Vector3DIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
void set(T v) const
Dereference operator.
int64_t getC() const
Get image linear index of center.
NDConstIter(std::shared_ptr< const NDArray > in)
bool isBegin() const
Are we at the first element.
bool operator!=(const NDIter &other) const
Whether the position and parent are different from another.
bool operator<(const NDIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
FlatConstIter(std::shared_ptr< const NDArray > in)
Vector3DIter & operator++()
Prefix increment operator.
void goBegin()
Go to beginning of iteration.
NDIter(std::shared_ptr< NDArray > in)
void goBegin()
Go to beginning of iteration.
bool operator<(const FlatIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
ChunkIter(std::shared_ptr< NDArray > in)
bool operator!=(const NDConstIter &other) const
Whether the position and parent are different from another.
bool isEnd() const
Are we at the end of iteration? Note that this will be 1 past the end, as typically is done in c++...
void setDim(size_t ndim, const size_t *dim)
All around intializer. Sets all internal variables.
T getC() const
Same as dereference operator, get center pixel value.
This class is used to slice an image in along a dimension, and to step an arbitrary direction in an i...
bool isBegin() const
Are we at the first element.
bool isBegin() const
Are we at the first element.
void goEnd()
Go to end of iteration.
Iterator for an image, that allows for easy access to the neighbors of the current element/pixel...
bool isEnd() const
Are we one past the last element?
T operator*() const
Dereference operator.
ChunkSlicer & prevChunk()
Return to the previous chunk (if there is one).
ChunkSlicer & operator++()
Prefix iterator. Iterates in the order dictatored by the dimension order passsed during construction ...
bool operator==(const KernelIter &other) const
Whether the position and parent are the same as another.
bool operator!=(const ChunkIter &other) const
Whether the position and parent are different from another.
void setArray(ptr< NDArray > in)
bool operator<=(const ChunkIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
bool operator<(const ChunkConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
void goBegin()
Go to beginning of iteration.
T operator*() const
Dereference operator.
bool isBegin() const
Are we at the begining of iteration?
bool isEnd() const
Are we one past the last element?
void goEnd()
Jump to the end of iteration.
bool isBegin() const
Are we at the first element.
ChunkIter & prevChunk()
Prefix decrement operator.
T operator[](int64_t i) const
Get value at ith element of vector.
bool operator<=(const Vector3DConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
KernelIter(std::shared_ptr< const NDArray > in)
bool isBegin() const
Are we at the first element.
void goBegin()
Go to beginning of iteration.
void setArray(ptr< NDArray > in)
Slicer & operator--()
Prefix negative iterator. Iterates in the order dictatored by the dimension order passsed during cons...
T operator*() const
Dereference operator.
NDIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
ChunkIter & nextChunk()
NextChunk.
bool eof() const
Are we one past the last element?
bool isEnd() const
Are we at the end of iteration? Note that this will be 1 past the end, as typically is done in c++...
bool eof() const
Are we one past the last element?
std::shared_ptr< T > ptr
Make the shared_ptr name shorter...
bool operator>(const KernelIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
void goEnd()
Jump to the end of the last chunk.
void goBegin()
Are we at the begining of iteration?
bool operator==(const Vector3DConstIter &other) const
Whether the position and parent are the same as another.
bool operator<(const FlatConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
Vector3DConstIter & operator++()
Prefix increment operator.
bool operator<=(const NDIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
bool eof() const
Are we one past the last element?
FlatIter(std::shared_ptr< NDArray > in)
bool operator<(const NDConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
bool eof() const
Are we one past the last element?
bool operator!=(const FlatConstIter &other) const
Whether the position and parent are different from another.
bool isBegin() const
Are we at the first element.
NDConstIter & operator--()
Prefix decrement operator.
bool isEnd() const
Are we one past the last element?
Vector3DIter & operator--()
Prefix decrement operator.
void goBegin()
Go to beginning of iteration.
bool isEnd() const
Are we one past the last element?
bool operator>=(const NDConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
void goEnd()
Go to end of iteration.
bool operator>=(const FlatConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
void setArray(ptr< const NDArray > in)
ChunkConstIter & prevChunk()
Prefix decrement operator.
Constant iterator for NDArray. Typical usage calls for NDConstIter it(array); it++; *it...
bool operator<(const Vector3DConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
This class is used to step through an ND array in order of dimensions. Order may be any size from 0 t...
ChunkIter & operator--()
Prefix decrement operator.
bool operator==(const ChunkIter &other) const
Whether the position and parent are the same as another.
Constant iterator for NDArray. This is slightly different from order iterator in that the ROI may be ...
ChunkConstIter & nextChunk()
Prefix increment operator.
bool operator!=(const FlatIter &other) const
Whether the position and parent are different from another.
T operator*() const
Dereference operator.
bool operator<(const ChunkIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is befor...
Vector3DIter(std::shared_ptr< NDArray > in)
bool operator<=(const ChunkConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
void setDim(size_t ndim, const size_t *dim)
Sets the dimensionality of iteration, and the dimensions of the image.
T getK(int64_t k) const
Dereference (get) the pixel at the k'th offset position. To figure out WHERE this pixel is in relatio...
void goEnd()
Go to end of iteration.
This class is used to iterate through an 3D array, where each point then has has multiple higher dime...
void setArray(ptr< const NDArray > in)
bool operator<=(const Vector3DIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
bool operator>(const NDConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
std::vector< int64_t * > m_pos
void goEnd()
Go to end of iteration.
bool operator==(const Vector3DIter &other) const
Whether the position and parent are the same as another.
bool operator>(const ChunkIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is after...
void goBegin()
Go to the very beginning for the first chunk.
NDConstIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
T operator[](int64_t k) const
Dereference (get) the pixel at the k'th offset position. To figure out WHERE this pixel is in relatio...
Slicer & operator++()
Prefix iterator. Iterates in the order dictatored by the dimension order passsed during construction ...
void set(T v)
Dereference operator.
bool operator!=(const Vector3DConstIter &other) const
Whether the position and parent are different from another.
bool eof() const
Are we one past the last element?
FlatIter()
Default constructor. Note, this will segfault if you don't use setArray to set the target NDArray/Ima...
int64_t getK(int64_t kit) const
Get index of i'th kernel (center-offset) element. Note that values outside the image will not be retu...
std::vector< size_t > m_dim
ChunkIter & operator++()
Prefix increment operator.
T operator*() const
Dereference operator.
bool operator<=(const FlatIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...
ChunkConstIter(std::shared_ptr< const NDArray > in)
void set(T v)
Set the value at the 0th element of the vector.
Flat iterator for NDArray. No information is kept about the current ND index. Just goes through all d...
bool operator!=(const Vector3DIter &other) const
Whether the position and parent are different from another.
void goBegin()
Go to beginning of iteration.
T operator*() const
Dereference operator.
This class is used to iterate through an N-Dimensional array.
bool operator<=(const FlatConstIter &other) const
If the parents are different then false, if they are the same, returns whether this iterator is the s...