1#ifndef AIMSDATA_BORDER_BORDERITERATOR_H
2#define AIMSDATA_BORDER_BORDERITERATOR_H
6#include <cartodata/volume/volume.h>
58 std::vector<int> borders =
_volume.getBorders();
91 std::vector<int> borders =
_volume.getBorders();
262 template <
typename T>
268 template <
typename T>
275 const Point4dl & start = _border._sizeinf;
276 _current = Point4dl( -start[0], -start[1], -start[2], -start[3] );
277 if( !isBorder(_current) )
278 _current = computeNext( _current );
282 template <
typename T>
289 template <
typename T>
292 _border(other._border),
293 _current(other._current)
296 template <
typename T>
299 _border(other._border),
300 _current(other._current)
303 template <
typename T>
308 _current = other._current;
312 template <
typename T>
317 _current = other._current;
321 template <
typename T>
327 template <
typename T>
333 template <
typename T>
339 template <
typename T>
345 template <
typename T>
348 return !(*
this == other);
351 template <
typename T>
354 return !(*
this == other);
357 template <
typename T>
366 template <
typename T>
372 return _border._volume.getSizeX();
375 template <
typename T>
381 if( ( p[0] < 0 ) || ( p[0] >=
_border._volume.getSizeX() ) ||
382 ( p[1] < 0 ) || ( p[1] >=
_border._volume.getSizeY() ) ||
383 ( p[2] < 0 ) || ( p[2] >=
_border._volume.getSizeZ() ) ||
384 ( p[3] < 0 ) || ( p[3] >=
_border._volume.getSizeT() ) )
387 else if( ( p[0] <
_border._sizeinf[0] ) ||
388 ( p[0] >=
_border._volume.getSizeX() -
_border._sizesup[0] + 1 ) ||
389 ( p[1] <
_border._sizeinf[1] ) ||
390 ( p[1] >=
_border._volume.getSizeY() -
_border._sizesup[1] + 1 ) ||
391 ( p[2] <
_border._sizeinf[2] ) ||
392 ( p[2] >=
_border._volume.getSizeZ() -
_border._sizesup[2] + 1 ) ||
393 ( p[3] <
_border._sizeinf[3] ) ||
394 ( p[3] >=
_border._volume.getSizeT() -
_border._sizesup[3] + 1 ) )
403 if( ( p[0] < -
_border._sizeinf[0] ) ||
405 ( p[1] < -
_border._sizeinf[1] ) ||
407 ( p[2] < -
_border._sizeinf[2] ) ||
409 ( p[3] < -
_border._sizeinf[3] ) ||
413 else if( ( p[0] < 0 ) || ( p[0] >=
_border._volume.getSizeX() ) ||
414 ( p[1] < 0 ) || ( p[1] >=
_border._volume.getSizeY() ) ||
415 ( p[2] < 0 ) || ( p[2] >=
_border._volume.getSizeZ() ) ||
416 ( p[3] < 0 ) || ( p[3] >=
_border._volume.getSizeT() ) )
424 template <
typename T>
436 return( 0 <= p[0] && p[0] <
_border._volume.getSizeX() &&
437 0 <= p[1] && p[1] <
_border._volume.getSizeY() &&
438 0 <= p[2] && p[2] <
_border._volume.getSizeZ() &&
439 0 <= p[3] && p[3] <
_border._volume.getSizeT() );
443 template <
typename T>
453 else if( move[1] > 0 )
455 else if( move[2] > 0 )
457 else if( move[3] > 0 )
463 newp[0] = -
_border._sizeinf[0];
464 else if( move[1] > 0 )
465 newp[1] = -
_border._sizeinf[1];
466 else if( move[2] > 0 )
467 newp[2] = -
_border._sizeinf[2];
468 else if( move[3] > 0 )
469 newp[3] = -
_border._sizeinf[3];
475 template <
typename T>
481 else if( move[1] > 0 )
483 else if( move[2] > 0 )
485 else if( move[3] > 0 )
492 template <
typename T>
508 next =
reset( next, move );
520 template <
typename T>
527 template <
typename T>
536 template <
typename T>
541 template <
typename T>
546 template <
typename T>
551 template <
typename T>
557 template <
typename T>
565 template <
typename T>
575 template <
typename T>
585 template <
typename T>
593 template <
typename T>
bool isBorder(const Point4dl &p) const
returns true if the p is in the border described by _border
const_iterator(const const_iterator &other)
Copy constructor from a const_iterator.
Point4dl coordinate() const
Returns the coordinates of the current point in the linked volume.
const_iterator & operator=(const iterator &other)
assignment from iterator
bool isNonBorderImage(const Point4dl &p) const
returns true if p is in the image but not in the border.
bool operator!=(const const_iterator &other) const
Point4dl reset(const Point4dl &p, const Point4dl &move) const
Sets the coordinate (in the dimension described by move) at its most inferior (i.e.
BorderIterator< T > _border
bool operator==(const const_iterator &other) const
const_iterator()
Default constructor Create a non initialized iterator than cannot be incremented or accessed.
const_iterator(const iterator &other)
Copy constructor from an iterator.
const T * operator->() const
long jumpX() const
Gives the size of the non-border volume in the X dimension.
const T & operator*() const
Point4dl nextMove(const Point4dl &move) const
Computes the next move.
const_iterator & operator++()
increment (prefix)
Point4dl computeNext(const Point4dl &p) const
computeNext(p) returns the next point in the border.
const_iterator & operator=(const const_iterator &other)
assignment from const_iterator
carto::VolumeRef< T > volume()
Returns a reference to the linked volume.
Point4dl end() const
Point value for the "end" iterator (which points to no voxel).
iterator(const iterator &other)
Copy constructor from an iterator.
iterator()
Default constructor Create a non initialized iterator than cannot be incremented or accessed.
iterator & operator++()
increment (prefix)
iterator & operator=(const iterator &other)
assignment from iterator
bool operator==(const BorderIterator< T > &other) const
const_iterator end() const
carto::VolumeRef< T > _volume
BorderIterator(carto::VolumeRef< T > in, bool inside, const Point4dl &sizeinf, const Point4dl &sizesup)
friend class const_iterator
const_iterator begin() const
BorderIterator(carto::VolumeRef< T > in, bool inside=false, const Point4dl &size=Point4dl(-1, -1, -1, -1))
Border constructor.
The class for EcatSino data write operation.
AimsVector< int64_t, 4 > Point4dl