34 #ifndef CARTODATA_ROI_SITEITERATOR_H
35 #define CARTODATA_ROI_SITEITERATOR_H
54 virtual int size()
const = 0;
55 virtual double at(
int index )
const = 0;
56 virtual void set(
int index,
double value ) = 0;
109 _data(data), _useLabel(false)
118 _data(data), _label(label), _useLabel(true)
125 SiteIteratorOf(
const std::string &filename ) :
126 _data( new
Volume<T> ), _useLabel(false)
129 Reader< Volume<T> > reader(filename);
137 SiteIteratorOf(
const std::string &filename,
const T &label ) :
138 _data( new
Volume<T> ), _label(label), _useLabel(true)
140 Reader< Volume<T> > reader(filename);
154 _current[ 0 ] = _current[ 1 ] = _current[ 2 ] = 0;
155 if ( isValid() && ( _useLabel ?
156 (*_data)( _current[0], _current[1], _current[2]) != (T) _label :
157 ! (*_data)( _current[0], _current[1], _current[2] ) ) ) next();
166 if ( _current[ 0 ] == _data->getSizeX() ) {
169 if ( _current[ 1 ] == _data->getSizeY() ) {
174 }
while( isValid() && ( _useLabel ?
175 (*_data)( _current[0], _current[1], _current[2]) != (T) _label :
176 ! (*_data)( _current[0], _current[1], _current[2] ) ) );
183 return _current[ 2 ] < _data->getSizeZ();
198 std::cout <<
""<< _current[0]<<
" "<<_current[1]<<
" "<<_current[2]<<std::endl;
virtual bool isValid() const =0
virtual void writeSite()=0
virtual rc_ptr< Site > getSite()=0
virtual double at(int index) const =0
virtual void set(int index, double value)=0
bool operator!=(const Site &s1)
virtual int size() const =0
bool operator==(const Site &s1)
Site & operator=(const Site &other)
Convenient handle for a Volume - this is normally the entry point for all volumes handling.