35 #ifndef AIMS_PRIMALSKETCH_SCALELEVEL_H
36 #define AIMS_PRIMALSKETCH_SCALELEVEL_H
57 template<
typename Geom,
typename Text>
class ScaleLevel {
68 float Scale() {
return _scale; }
69 std::map<int, GreyLevelBlob<Site> *>
BlobList() {
return blobs; }
75 if (blobs.find(label) != blobs.end())
79 std::cerr <<
"looking for GLB that does not exist..." << std::endl;
90 {_scale=other._scale; blobs=other.blobs;
91 saddlePoints=other.saddlePoints; maximumPoints=other.maximumPoints;
return *
this;}
97 std::map<int, GreyLevelBlob<Site> *> blobs;
98 std::list<SaddlePoint<Site> *> saddlePoints;
99 std::list<MaximumPoint<Site> *> maximumPoints;
116 { _scale=scale; _level = level.
copy(); _originallevel=originallevel; }
128 std::map<int, GreyLevelBlob<Site> *>
BlobList() {
return blobs; }
135 {std::cerr <<
"looking for GLB " << label <<
" that does not exist at scale " << _scale << std::endl;
136 exit(EXIT_FAILURE);}}
142 {_scale=other._scale; _level=other._level; blobs=other.blobs;
143 saddlePoints=other.saddlePoints; maximumPoints=other.maximumPoints;
return *
this;}
145 void WriteBlobImage(std::string fileBlob);
152 std::map<int, GreyLevelBlob<Site> *> blobs;
153 std::list<SaddlePoint<Site> *> saddlePoints;
154 std::list<MaximumPoint<Site> *> maximumPoints;
168 _scale=scale; _level=level; _mesh=mesh; _coordinates=NULL; _originallevel=NULL;
172 _scale=scale; _level=level; _mesh=mesh; _coordinates=coords; _originallevel=NULL;
176 (*this)._scale=other._scale; (*this)._level=other._level; (*this)._mesh=other._mesh; (*this)._coordinates=_coordinates; _originallevel=NULL;
180 _scale=scale; _level=level; _mesh=mesh; _coordinates=NULL; _originallevel=originallevel;
184 _scale=scale; _level=level; _mesh=mesh; _coordinates=coords; _originallevel=originallevel;
188 (*this)._scale=other._scale; (*this)._level=other._level; (*this)._mesh=other._mesh; (*this)._coordinates=_coordinates; _originallevel=originallevel;
201 std::map<int, GreyLevelBlob<Site> *> &
BlobList() {
return blobs; }
203 {
return saddlePoints; }
205 {
return maximumPoints; }
208 if (blobs.find(label) != blobs.end())
212 std::cerr <<
"looking for GLB " << label <<
" that does not exist..." << std::endl;
226 (*this)._scale=other._scale;(*this)._level=other._level;(*this)._mesh=other._mesh; (*this).blobs=other.blobs;
227 (*this).saddlePoints=other.saddlePoints; (*this).maximumPoints=other.maximumPoints;
return *
this;
236 std::vector<Point3df> *_coordinates;
238 std::map<int, GreyLevelBlob<Site> *> blobs;
239 std::list<SaddlePoint<Site> *> saddlePoints;
240 std::list<MaximumPoint<Site> *> maximumPoints;
255 typename std::map<int, GreyLevelBlob<Site> *>
::iterator itBlob;
258 if (blobs.size() == 0)
266 itBlob=blobs.begin();
267 for ( ; itBlob != blobs.end(); ++itBlob)
268 ((*itBlob).second)->SetScale(_scale);
275 template<
int D,
typename T>
284 typename std::map<int, GreyLevelBlob<Site> *>
::iterator itBlob;
285 if (blobs.size() == 0){
290 itBlob=blobs.begin();
291 for ( ; itBlob != blobs.end(); ++itBlob)
292 ((*itBlob).second)->SetScale(_scale);
303 int sx=_level.
getSizeX(), sy=_level.getSizeY(), sz=_level.getSizeZ();
305 typename std::map<int, GreyLevelBlob<Site> *>
::iterator itBlob=blobs.begin();;
306 typename std::list<SaddlePoint<Site> *>
::iterator itSaddle=saddlePoints.begin();
307 typename std::list<MaximumPoint<Site> *>
::iterator itMax=maximumPoints.begin();
308 typename std::set<Site,ltstr_p3d<Site> >
::iterator itPoints;
318 for (; itBlob!=blobs.end(); ++itBlob)
320 blobby=(*itBlob).second;
324 x=int((*itPoints)[0]); y=int((*itPoints)[1]); z=int((*itPoints)[2]);
325 imaBlob(x,y,z)=255.0;
329 for (; itSaddle!=saddlePoints.end(); ++itSaddle)
331 x=int((*itSaddle)->_node[0]); y=int((*itSaddle)->_node[1]); z=int((*itSaddle)->_node[2]);
332 imaBlob(x,y,z)=128.0;
335 for (; itMax!=maximumPoints.end(); ++itMax)
337 x=int((*itMax)->_node[0]); y=int((*itMax)->_node[1]); z=int((*itMax)->_node[2]);
338 imaBlob(x,y,z)=128.0;
341 dataW.
write(imaBlob);
std::set< T, ltstr_p3d< T > > & GetListePoints()
ScaleLevel(float scale, Texture< T > level, AimsSurface< D, Void > *mesh, std::vector< Point3df > *coords, Texture< T > *originallevel)
ScaleLevel(float scale, Texture< T > level, AimsSurface< D, Void > *mesh, Texture< T > *originallevel)
SiteType< AimsSurface< D, Void > >::type Site
ScaleLevel(const ScaleLevel< AimsSurface< D, Void >, Texture< T > > &other, Texture< T > *originallevel)
GreyLevelBlob< Site > * Blob(int label)
TexturedData< AimsSurface< D, Void >, Texture< T > > OriginalData()
std::list< MaximumPoint< Site > * > & MaximumPointList()
std::map< int, GreyLevelBlob< Site > * > & BlobList()
AimsSurface< D, Void > * Mesh()
TexturedData< AimsSurface< D, Void >, Texture< T > > Data()
std::list< SaddlePoint< Site > * > & SaddlePointList()
ScaleLevel(float scale, Texture< T > level, AimsSurface< D, Void > *mesh, std::vector< Point3df > *coords)
void PutCoordinates(std::vector< Point3df > *coord)
ScaleLevel(const ScaleLevel< AimsSurface< D, Void >, Texture< T > > &other)
ScaleLevel(float scale, Texture< T > level, AimsSurface< D, Void > *mesh)
TexturedData< carto::VolumeRef< T >, carto::VolumeRef< T > > OriginalData()
carto::VolumeRef< T > & Level()
SiteType< carto::VolumeRef< T > >::type Site
std::list< SaddlePoint< Site > * > SaddlePointList()
std::list< MaximumPoint< Site > * > MaximumPointList()
GreyLevelBlob< Site > * Blob(int label)
ScaleLevel(float scale, carto::VolumeRef< T > level)
TexturedData< carto::VolumeRef< T >, carto::VolumeRef< T > > Data()
ScaleLevel(float scale, carto::VolumeRef< T > level, carto::VolumeRef< T > *originallevel)
std::map< int, GreyLevelBlob< Site > * > BlobList()
void DetectBlobs(TexturedData< Geom, Text > *mask, char *stats=0)
std::list< MaximumPoint< Site > * > MaximumPointList()
std::map< int, GreyLevelBlob< Site > * > BlobList()
TexturedData< Geom, Text > Data()
ScaleLevel< Geom, Text > & operator=(const ScaleLevel< Geom, Text > &other)
GreyLevelBlob< Site > * Blob(int label)
TexType< Text >::type Val
std::list< SaddlePoint< Site > * > SaddlePointList()
SiteType< Geom >::type Site
virtual bool write(const T &obj, bool ascii=false, const std::string *format=0)
void setVoxelSize(float vx, float vy=1., float vz=1., float vt=1.)
VolumeRef< T > copy() const
BucketMap< Void > * mask(const BucketMap< Void > &src, const BucketMap< Void > &m, bool intersect=true)