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;
68 virtual void next() = 0;
69 virtual void restart() = 0;
70 virtual bool isValid()
const = 0;
72 virtual void writeSite() = 0;
99 virtual void restart();
100 virtual bool isValid()
const;
102 virtual void writeSite();
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;
205 #endif // ifndef CARTODATA_ROI_ROI_H virtual int size() const =0
bool operator!=(const Site &s1)
virtual double at(int index) const =0
virtual void writeSite()=0
Convenient handle for a Volume - this is normally the entry point for all volumes handling...
Site & operator=(const Site &other)
virtual bool isValid() const =0
bool operator==(const Site &s1)