1 #ifndef TIL_CONSTIMAGECVOLUMETRICITERATOR_H 2 #define TIL_CONSTIMAGECVOLUMETRICITERATOR_H 16 template <
typename T >
class ImageC;
21 template <
typename T >
82 return *(m_index + offsetx + m_im.dim()[0]*(offsety + m_im.dim()[1]*offsetz));
91 template <
int offsetx,
int offsety,
int offsetz >
94 return *(m_index + offsetx + m_im.dim()[0]*(offsety + m_im.dim()[1]*offsetz));
103 return *(m_index + offset[0] + m_im.dim()[0]*(offset[1] + m_im.dim()[1]*offset[2]));
107 template <
class Extrapolator,
int offsetx,
int offsety,
int offsetz >
110 if (containsNeighbor<offsetx, offsety, offsetz>(*
this))
112 return this->getUnsafeValue<offsetx, offsety, offsetz>();
153 template <
class Extrapolator >
161 return this->getUnsafeValue(offset);
165 return Extrapolator::getExtrapolatedValue(m_im, m_pos + offset);
187 return m_im.getValue(m_pos + offset);
240 template <
typename T >
254 throw std::domain_error(
"ROI lies outside image range");
260 m_index = m_im.getUnsafePointerOf(m_pos);
264 m_offset[1] = m_im.dim()[0];
265 m_offset[2] = m_im.dim()[0]*m_im.dim()[1];
269 template <
typename T >
283 template <
typename T >
286 m_pos[0] = m_roi.min_bounds()[0];
288 if (++(m_pos[1]) > m_roi.max_bounds()[1])
290 m_pos[1] = m_roi.min_bounds()[1];
292 if (++(m_pos[2]) > m_roi.max_bounds()[2])
301 m_index = m_im.getUnsafePointerOf(m_pos);
304 template <
typename T >
311 if (++(m_pos[0]) > m_roi.max_bounds()[0])
327 template <
typename T >
331 throw std::out_of_range(
"Point does not lie within iterator range");
332 this->setUnsafePos(pos);
348 template <
typename T >
352 m_index = m_im.getUnsafePointerOf(m_pos);
367 template <
typename T >
371 if (++(m_pos[0]) > m_roi.max_bounds()[0])
373 m_pos[0] = m_roi.min_bounds()[0];
374 if (++(m_pos[1]) > m_roi.max_bounds()[1])
376 m_pos[1] = m_roi.min_bounds()[1];
377 if (++(m_pos[2]) > m_roi.max_bounds()[2])
384 m_index = m_im.getUnsafePointerOf(m_pos);
393 template <
typename T >
397 if (++m_pos[axis] > m_roi.max_bounds()[axis])
405 m_index += m_offset[axis];
410 template <
typename T >
413 std::cout <<
"Pointer: " << it.m_index << std::endl;
414 std::cout <<
"Position: " << it.m_pos << std::endl;
415 std::cout <<
"Offset: " << it.m_offset << std::endl;
416 std::cout <<
"Range: " << it.m_roi.min_bounds() <<
" "<< it.m_roi.max_bounds() << std::endl;
reference operator*() const
Return the value of the current element.
Belongs to package Box Do not include directly, include til/Box.h instead.
void printInfo(ConstVolumetricIterator< ImageNC< T > > &it)
INLINE T getUnsafeValue() const
Get value of a neighbor WITHOUT RANGE CHECKING.
Defines empty classes that serves as labels.
INLINE T getUnsafeValue(int offsetx, int offsety, int offsetz) const
Get value of a neighbor WITHOUT RANGE CHECKING.
const numeric_array< T, D > & min_bounds() const
Get min bounds.
const numeric_array< T, D > & max_bounds() const
Get max bounds.
const numeric_array< int, 3 > & pos() const
boost::enable_if< is_numeric_container< TStorage >, bool >::type contains(const Box< T, D > &box, const TStorage &v)
Check whether a point lies within box.
Range< int, 3 > getRange(const TImage &im)
Get image range.
const ImageC< T > & image() const
INLINE T getValue() const
INLINE bool isAtEnd() const
Test whether the iterator has reached the end of the image or not.
Image class using contiguous memory.
INLINE T getUnsafeValue(const numeric_array< int, 3 > &offset) const
Get value of a neighbor WITHOUT RANGE CHECKING.
const Range< int, 3 > & roi() const
T getValue(const numeric_array< int, 3 > &offset) const
Get value of a neighbor.
INLINE T operator()(const numeric_array< int, 3 > &offset) const
TIL_API ImageAxis operator++(ImageAxis &axis)