Example of a test. To be completed.
52{
53 unsigned int nbok = 0;
54 unsigned int nb = 0;
55
57
60
61#ifdef WITH_ITK
63 Image3D16bits;
64#endif
65
69
70
71 std::string filenameImage1 = testPath + "samples/cat10.vol";
73 DGtal::Z3i::Domain domain1 = anImportedImage1.domain();
74 unsigned int size0Img1= domain1.upperBound()[0]-domain1.lowerBound()[0]+1;
75 unsigned int size1Img1= domain1.upperBound()[1]-domain1.lowerBound()[1]+1;
76 unsigned int size2Img1= domain1.upperBound()[2]-domain1.lowerBound()[2]+1;
80 nbok += (size0Img1==40 && size1Img1==40 && size2Img1==40) ? 1 : 0;
81 nb++;
82 std::string filenameImage0 = testPath + "samples/test.longvol";
84 DGtal::Z3i::Domain domain0 = anImportedImage0.domain();
85 unsigned int size0Img0= domain0.upperBound()[0]-domain0.lowerBound()[0]+1;
86 unsigned int size1Img0= domain0.upperBound()[1]-domain0.lowerBound()[1]+1;
87 unsigned int size2Img0= domain0.upperBound()[2]-domain0.lowerBound()[2]+1;
91 nbok += (size0Img0==16 && size1Img0==16 && size2Img0==16) ? 1 : 0;
92 nb++;
93 std::string filenameImage2 = testPath + "samples/cat10.pgm3d";
95 DGtal::Z3i::Domain domain2 = anImportedImage2.domain();
96 unsigned int size0Img2= domain2.upperBound()[0]-domain2.lowerBound()[0]+1;
97 unsigned int size1Img2= domain2.upperBound()[1]-domain2.lowerBound()[1]+1;
98 unsigned int size2Img2= domain2.upperBound()[2]-domain2.lowerBound()[2]+1;
102 nbok += (size0Img2==40 && size1Img2==40 && size2Img2==40) ? 1 : 0;
103 nb++;
104
107 0, 255) );
108 domain2 = anImportedImage2.domain();
109 size0Img2= domain2.upperBound()[0]-domain2.lowerBound()[0]+1;
110 size1Img2= domain2.upperBound()[1]-domain2.lowerBound()[1]+1;
111 size2Img2= domain2.upperBound()[2]-domain2.lowerBound()[2]+1;
112 DGtal::trace.
info()<<
"Pgm3D image read (with scale functor) : size[0]:" << size0Img2 ;
115 nbok += (size0Img2==40 && size1Img2==40 && size2Img2==40) ? 1 : 0;
116 nb++;
117
118
119#ifdef WITH_HDF5
120 std::string filenameImageh5 = testPath + "samples/cat10.h5";
122 DGtal::Z3i::Domain domainh5 = anImportedImageh5.domain();
123 unsigned int size0Imgh5= domainh5.upperBound()[0]-domainh5.lowerBound()[0]+1;
124 unsigned int size1Imgh5= domainh5.upperBound()[1]-domainh5.lowerBound()[1]+1;
125 unsigned int size2Imgh5= domainh5.upperBound()[2]-domainh5.lowerBound()[2]+1;
129 nbok += (size0Imgh5==40 && size1Imgh5==40 && size2Imgh5==40) ? 1 : 0;
130 nb++;
131#endif
132 std::string filenameImage3 = testPath + "samples/contourS.pgm";
137
140 nbok += (size0Img3==185 && size1Img3==85 ) ? 1 : 0;
141 nb++;
142
143 std::string filenameImage4 = testPath + "samples/raw32bits5x5x5.raw";
145 DGtal::Z3i::Domain domain4 = anImportedImage4.domain();
146 unsigned int size0Img4= domain4.upperBound()[0]-domain4.lowerBound()[0]+1;
147 unsigned int size1Img4= domain4.upperBound()[1]-domain4.lowerBound()[1]+1;
148 unsigned int size2Img4= domain4.upperBound()[2]-domain4.lowerBound()[2]+1;
152 DGtal::trace.
info()<<
"Image value of Point (2,3,4): " << anImportedImage4(DGtal::Z3i::Point(2,3,4)) <<
" (should be 250000*2*3*4) "<<std::endl;
153 nbok += (size0Img4==5 && size1Img4==5 && size2Img4==5 && anImportedImage4(DGtal::Z3i::Point(2,3,4))==250000*2*3*4) ? 1 : 0;
154 nb++;
155
156 std::string filenameImage5 = testPath + "samples/raw32bits5x5.raw";
164 nbok += (size0Img5==5 && size1Img5==5 && anImportedImage5(
DGtal::Z2i::Point(2,3))==250000*2*3*4) ? 1 : 0;
165 nb++;
166
167#ifdef WITH_ITK
168 std::string filenameImage6 = testPath + "samples/lobsterCroped16b.mhd";
170 RescalFCT2 resc2 = RescalFCT2( 0, 65535, 0, 255 );
171 Image3D anImportedImage6 =
173 resc2 );
174 DGtal::Z3i::Domain domain6 = anImportedImage6.domain();
175 unsigned int size0Img6 =
176 domain6.upperBound()[ 0 ] - domain6.lowerBound()[ 0 ] + 1;
177 unsigned int size1Img6 =
178 domain6.upperBound()[ 1 ] - domain6.lowerBound()[ 1 ] + 1;
179 unsigned int size2Img6 =
180 domain6.upperBound()[ 2 ] - domain6.lowerBound()[ 2 ] + 1;
181
185 << anImportedImage6( DGtal::Z3i::Point( 35, 29, 3 ) )
186 << " (should be" << resc2( 60400 ) << std::endl;
187 nbok +=
188 ( size0Img6 == 51 && size1Img6 == 91 && size2Img6 == 31 &&
189 anImportedImage6( DGtal::Z3i::Point( 35, 29, 3 ) ) == resc2( 60400 ) )
190 ? 1
191 : 0;
192 nb++;
193
194 Image3D16bits anImportedImage7 =
197 << anImportedImage7( DGtal::Z3i::Point( 35, 29, 3 ) )
198 << " (should be" << 60400 << " )" << std::endl;
199 nbok +=
200 ( anImportedImage7( DGtal::Z3i::Point( 35, 29, 3 ) ) == 60400 ) ? 1 : 0;
201 nb++;
202#endif
203
206
207 return nbok == nb;
208}
const Point & lowerBound() const
const Point & upperBound() const
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
static TContainer importWithValueFunctor(const std::string &filename, const TFunctor &aFunctor, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
Aim: Functor allowing to rescale a value. Values of the initial scale [initMin,initMax] are rescaled ...