53 Slicer(
size_t ndim,
const size_t* dim);
62 void setDim(
size_t ndim,
const size_t* dim);
75 bool isBegin()
const {
return !isEnd() && m_linpos==m_linfirst; };
83 bool isEnd()
const {
return m_end; };
91 bool eof()
const {
return m_end; };
133 void goIndex(
size_t len, int64_t* newpos);
140 void goIndex(std::vector<int64_t> newpos);
166 void index(
size_t len, int64_t* index)
const;
178 void index(
size_t len,
int* index)
const;
190 void index(
size_t len,
double* index)
const;
201 inline void index(std::vector<int64_t>& ind)
const
203 index(ind.size(), ind.data());
215 inline void index(std::vector<int>& ind)
const
217 index(ind.size(), ind.data());
230 inline void index(std::vector<double>& ind)
const
232 index(ind.size(), ind.data());
240 inline int64_t
index(
size_t dd)
const
263 assert(dd < m_ndim);
return m_strides[dd];
285 void setROI(
size_t len,
const size_t* roisize,
const int64_t* roistart = NULL);
294 void setROI(
const std::vector<std::pair<int64_t, int64_t>>& roi);
306 void setOrder(
const std::vector<size_t>& order,
bool revorder =
false);
318 void setOrder(std::initializer_list<size_t> order,
bool revorder =
false);
334 const std::vector<size_t>& getOrder()
const {
return m_order; } ;
351 std::vector<std::pair<int64_t,int64_t>>
m_roi;
410 void setDim(
size_t ndim,
const size_t* dim);
423 bool isBegin()
const {
return !isEnd() && m_linpos==m_linfirst; };
431 bool isEnd()
const {
return m_end; };
439 bool eof()
const {
return m_end; };
460 bool eoc()
const {
return m_chunkend; };
528 void goIndex(
size_t len, int64_t* newpos);
535 void goIndex(std::vector<int64_t> newpos);
561 void index(
size_t len, int64_t* index)
const;
573 void index(
size_t len,
int* index)
const;
585 void index(
size_t len,
double* index)
const;
596 inline void index(std::vector<int64_t>& ind)
const
598 index(ind.size(), ind.data());
610 inline void index(std::vector<int>& ind)
const
612 index(ind.size(), ind.data());
624 inline void index(std::vector<double>& ind)
const
626 index(ind.size(), ind.data());
634 inline int64_t
index(
size_t dd)
const
658 return m_strides[dd];
679 void setROI(
size_t len,
const size_t* roisize,
const int64_t* roistart = NULL);
688 void setROI(
const std::vector<std::pair<int64_t, int64_t>>& roi);
710 void setChunkSize(
size_t len,
const int64_t* sizes,
bool defunity =
false);
732 void setChunkSize(
size_t len,
const size_t* sizes,
bool defunity =
false);
750 void setLineChunk(
size_t dir);
762 void setOrder(
const std::vector<size_t>& order,
bool revorder =
false);
774 void setOrder(std::initializer_list<size_t> order,
bool revorder =
false);
784 const std::vector<size_t>& getOrder()
const {
return m_order; } ;
803 std::vector<std::pair<int64_t,int64_t>>
m_chunk;
807 std::vector<std::pair<int64_t,int64_t>>
m_roi;
857 KSlicer(
size_t ndim,
const size_t* dim);
871 void setROI(
const std::vector<std::pair<int64_t, int64_t>> roi = {});
885 void setROI(
size_t len,
const size_t* roisize,
const int64_t* roistart = NULL);
899 void setOrder(
const std::vector<size_t> order = {},
bool revorder =
false);
909 const std::vector<size_t>&
getOrder()
const {
return m_order; } ;
923 void setRadius(std::vector<size_t> kradius = {});
936 void setRadius(
size_t kradius);
952 void setWindow(
const std::vector<std::pair<int64_t, int64_t>>& krange);
965 bool isBegin()
const {
return m_linpos[m_center] == m_begin; };
973 bool isEnd()
const {
return m_end; };
981 bool eof()
const {
return m_end; };
990 return m_linpos[m_center];
1000 assert(dd < m_ndim);
1001 return m_strides[dd];
1041 void goIndex(
const std::vector<int64_t>& newpos);
1057 return m_linpos[m_center];
1069 return m_linpos[m_center];
1084 void indexC(
size_t len, int64_t* index)
const;
1093 inline int64_t
getK(int64_t kit)
const
1096 assert(kit < m_numoffs);
1097 assert(m_linpos[kit] >= 0);
1098 return m_linpos[kit];
1111 assert(kit < m_numoffs);
1112 assert(m_linpos[kit] >= 0);
1113 return m_linpos[kit];
1130 void indexK(
size_t kit,
size_t len, int64_t* index,
bool bound =
true)
const;
1143 int64_t offsetK(
size_t kit,
size_t dim);
1154 bool insideK(
size_t k);
1167 void offsetK(
size_t kit,
size_t len, int64_t* dindex)
const;
1185 void setDim(
size_t ndim,
const size_t* dim);
1209 std::vector<std::pair<int64_t,int64_t>>
m_roi;
std::vector< size_t > m_strides
const std::vector< size_t > & getOrder() const
Returns the array giving the order of dimension being traversed. So 3,2,1,0 would mean that the next ...
void index(std::vector< int64_t > &ind) const
Places the first len dimension in the given array. If the number of dimensions exceed the len then th...
int64_t operator*() const
Get image linear index of center. Identitcal to center() just more confusing.
std::vector< int64_t > m_pos
bool isBegin() const
Are we at the begining of iteration?
std::vector< std::pair< int64_t, int64_t > > m_chunk
std::vector< int64_t * > m_offs
std::vector< int64_t > m_linpos
std::vector< size_t > m_dim
std::vector< std::pair< int64_t, int64_t > > m_roi
bool isBegin() const
Are we at the begining of iteration?
void index(std::vector< double > &ind) const
Places the first len dimension in the given array. If the number of dimensions exceed the len then th...
This class is used to step through an ND array in order of dimensions, but unlike Slicer it breaks th...
void index(std::vector< int64_t > &ind) const
Places the first len dimension in the given array. If the number of dimensions exceed the len then th...
std::vector< int64_t > m_pos_raw
int64_t linIndex() const
get linear position of current point
void index(std::vector< double > &ind) const
Places the first len dimension in the given array. If the number of dimensions exceed the len then th...
std::vector< int64_t > m_chunksizes
int64_t index(size_t dd) const
Returns the index in the specified dimension.
std::vector< int64_t > m_pos
int64_t getC() const
Get image linear index of center.
int64_t operator*() const
dereference operator. Returns the linear position in the array given the n-dimensional position...
std::vector< int64_t > m_offs_raw
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++...
size_t linIndex() const
get linear position of current point
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++...
This class is used to slice an image in along a dimension, and to step an arbitrary direction in an i...
bool eof() const
Are we at the end of iteration? Note that this will be 1 past the end, as typically is done in c++...
int64_t getStride(size_t dd)
get stride in specified dimension
std::vector< std::pair< int64_t, int64_t > > m_roi
bool isChunkBegin() const
Returns true when we have reached the end of the chunk.
std::vector< size_t > m_strides
bool isBegin() const
Are we at the begining of iteration?
bool eof() const
Are we at the end of iteration? Note that this will be 1 past the end, as typically is done in c++...
std::vector< std::pair< int64_t, int64_t > > m_roi
bool isChunkEnd() const
Returns true when we have reached the end of the chunk.
int64_t index(size_t dd) const
Returns the index in the specified dimension.
bool eof() const
Are we at the end of iteration? Note that this will be 1 past the end, as typically is done in c++...
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 index(std::vector< int > &ind) const
Places the first len dimension in the given array. If the number of dimensions exceed the len then th...
void index(std::vector< int > &ind) const
Places the first len dimension in the given array. If the number of dimensions exceed the len then th...
std::vector< size_t > m_order
int64_t getStride(size_t dd)
get stride in specified dimension
size_t ksize() const
Get linear position.
std::vector< size_t > m_order
bool eoc() const
Returns true when we have reached the end of the chunk.
size_t linIndex() const
get linear position of current point
This class is used to step through an ND array in order of dimensions. Order may be any size from 0 t...
std::vector< size_t > m_size
std::vector< size_t > m_strides
std::vector< int64_t * > m_pos
std::vector< size_t > m_order
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...
int64_t operator[](int64_t kit) const
Same as offset(int64_t kit). Note that values outside the image will not be returned, the nearest inside position will be.
std::vector< size_t > m_dim
int64_t operator*() const
dereference operator. Returns the linear position in the array given the n-dimensional position...
int64_t getStride(size_t dd)
get stride in specified dimension