32 #include "DGtal/base/Common.h"
34 #include "DGtal/io/boards/Board2D.h"
35 #include "DGtal/io/colormaps/HueShadeColorMap.h"
36 #include "DGtal/io/colormaps/GrayscaleColorMap.h"
37 #include "DGtal/io/colormaps/GradientColorMap.h"
38 #include "DGtal/io/colormaps/ColorBrightnessColorMap.h"
40 #include "DGtal/kernel/SpaceND.h"
41 #include "DGtal/kernel/domains/HyperRectDomain.h"
42 #include "DGtal/images/ImageContainerByHashTree.h"
43 #include "DGtal/images/ImageContainerBySTLVector.h"
45 #include "DGtal/helpers/StdDefs.h"
49 using namespace DGtal;
71 const Integer t[ ] = { 1, 2, 3 ,4};
72 const Integer t2[ ] = { 5, 5, 3 ,4};
77 Image myImage ( 3, 3,0 );
114 unsigned int nbok = 0;
139 Image myImage ( 3, 8, 0 );
141 ImageVector myImageV(TDomain(l,u));
148 for( a[1] = 0; a[1] < 256; a[1]++)
149 for( a[0] = 0; a[0] < 256; a[0]++)
151 if ( pow((
double)(a[0]-128),3.0) - pow((
double)(a[1]-128),3.0) < pow(32.0,3.0))
154 myImageV.setValue(a,30);
158 if ( pow((
double)(a[0]-128),3.0) - pow((
double)(a[1]-128),3.0) < pow(64.0,3.0))
161 myImageV.setValue(a,10);
169 for( a[1] = 0; a[1] < 256; a[1]++)
170 for( a[0] = 0; a[0] < 256; a[0]++)
172 if ( pow((a[0]-128),3.0) - pow((a[1]-128),3.0) < pow(32,3.0))
173 result = result && (myImage(a) == 30);
175 if ( pow((a[0]-128),3.0) - pow((a[1]-128),3.0) < pow(64,3.0))
176 result = result && (myImage(a) == 10);
181 trace.
info() <<
"Get/Set test passed"<<std::endl;
183 trace.
error() <<
"Get/Set test error"<<std::endl;
184 nbok += result ? 1 : 0;
190 Display2DFactory::drawImageHashTree<HueTwice>(board, myImage, 0, 255);
191 board.
saveSVG(
"hashtree.svg" );
193 Display2DFactory::drawImage<HueTwice>(board, myImageV, 0, 255);
194 board.
saveSVG(
"hashtree-vector.svg" );
198 Image myImage2 ( 5, 8, 0 );
201 for( a[1] = 0; a[1] < 256; a[1]++)
202 for( a[0] = 0; a[0] < 256; a[0]++)
204 if ( pow((a[0]-128),3.0) - pow((a[1]-128),3.0) < pow(32,3.0))
207 if ( pow((a[0]-128),3.0) - pow((a[1]-128),3.0) < pow(64,3.0))
215 for( a[1] = 0; a[1] < 256; a[1]++)
216 for( a[0] = 0; a[0] < 256; a[0]++)
218 if ( pow((a[0]-128),3.0) - pow((a[1]-128),3.0) < pow(32,3.0))
219 result = result && (myImage2(a) == 30);
221 if ( pow((a[0]-128),3.0) - pow((a[1]-128),3.0) < pow(64,3.0))
222 result = result && (myImage2(a) == 10);
227 trace.
info() <<
"Get/Set test passed"<<std::endl;
229 trace.
error() <<
"Get/Set test error"<<std::endl;
230 nbok += result ? 1 : 0;
234 <<
"true == true" << std::endl;
254 trace.
beginBlock (
"Test maximal depth > number of bits of the HashKey type" );
255 Image myImage ( 3, 80, 0 );
259 trace.
beginBlock (
"Test morton hash size > number of bits of the HashKey type" );
268 Image2 myImage3( 3, 80, 0 );
279 int main(
int argc,
char** argv )
283 for (
int i = 0; i < argc; ++i )
288 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << std::endl;
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Aim: This class template may be used to (linearly) convert scalar values in a given range into a colo...
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: implements association bewteen points lying in a digital domain and values.
void setValue(const Point &aPoint, const Value &aValue)
void beginBlock(const std::string &keyword="")
Model of CImageContainer implementing the association key<->Value using a hash tree....
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Point::Coordinate Integer
DGtal is the top-level namespace which contains all DGtal functions and types.
int main(int argc, char **argv)
ImageContainerBySTLVector< Domain, Value > Image