1 /************************************************************************/
2 /*                                                                      */
3 /*     Copyright 2006-2007 by F. Heinrich, B. Seppke, Ullrich Koethe    */
4 /*                                                                      */
5 /*    This file is part of the VIGRA computer vision library.           */
6 /*    The VIGRA Website is                                              */
7 /*        http://hci.iwr.uni-heidelberg.de/vigra/                       */
8 /*    Please direct questions, bug reports, and contributions to        */
9 /*        ullrich.koethe@iwr.uni-heidelberg.de    or                    */
10 /*        vigra@informatik.uni-hamburg.de                               */
11 /*                                                                      */
12 /*    Permission is hereby granted, free of charge, to any person       */
13 /*    obtaining a copy of this software and associated documentation    */
14 /*    files (the "Software"), to deal in the Software without           */
15 /*    restriction, including without limitation the rights to use,      */
16 /*    copy, modify, merge, publish, distribute, sublicense, and/or      */
17 /*    sell copies of the Software, and to permit persons to whom the    */
18 /*    Software is furnished to do so, subject to the following          */
19 /*    conditions:                                                       */
20 /*                                                                      */
21 /*    The above copyright notice and this permission notice shall be    */
22 /*    included in all copies or substantial portions of the             */
23 /*    Software.                                                         */
24 /*                                                                      */
25 /*    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND    */
26 /*    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES   */
27 /*    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND          */
28 /*    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT       */
29 /*    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,      */
30 /*    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      */
31 /*    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR     */
32 /*    OTHER DEALINGS IN THE SOFTWARE.                                   */
33 /*                                                                      */
34 /************************************************************************/
35 
36 #include <iostream>
37 #include <functional>
38 #include <cmath>
39 #include "vigra/unittest.hxx"
40 
41 #include "vigra/labelvolume.hxx"
42 #include "vigra/multi_labeling.hxx"
43 
44 using namespace vigra;
45 
46 struct VolumeLabelingTest
47 {
48     typedef vigra::MultiArray<3,int> IntVolume;
49     typedef vigra::MultiArray<3,double> DoubleVolume;
50 
VolumeLabelingTestVolumeLabelingTest51     VolumeLabelingTest()
52     : vol1(IntVolume::difference_type(4,4,4)),vol2(IntVolume::difference_type(4,4,4)),
53       vol3(IntVolume::difference_type(5,5,5)),vol4(DoubleVolume::difference_type(5,5,5)),
54       vol5(DoubleVolume::difference_type(5,5,5)),vol6(DoubleVolume::difference_type(5,5,5))
55     {
56         static const int in1[] = { 0, 0, 0, 0,    0, 0, 0, 0,    0, 0, 0, 0,    0, 0, 0, 0,
57                                    0, 0, 0, 0,    0, 1, 1, 0,    0, 1, 1, 0,    0, 0, 0, 0,
58                                    0, 0, 0, 0,    0, 1, 1, 0,    0, 1, 1, 0,    0, 0, 0, 0,
59                                    0, 0, 0, 0,    0, 0, 0, 0,    0, 0, 0, 0,    0, 0, 0, 0};
60 
61         IntVolume::iterator i = vol1.begin();
62         IntVolume::iterator end = vol1.end();
63         const int * p = in1;
64 
65         for(; i != end; ++i, ++p)
66         {
67             *i=*p;
68         }
69 
70         static const int in2[] = { 0, 1, 0, 1,    1, 0, 1, 0,    0, 1, 0, 1,    1, 0, 1, 0,
71                                    1, 0, 1, 0,    0, 1, 0, 1,    1, 0, 1, 0,    0, 1, 0, 1,
72                                    0, 1, 0, 1,    1, 0, 1, 0,    0, 1, 0, 1,    1, 0, 1, 0,
73                                    1, 0, 1, 0,    0, 1, 0, 1,    1, 0, 1, 0,    0, 1, 0, 1};
74 
75         i = vol2.begin();
76         end = vol2.end();
77         p = in2;
78 
79         for(; i != end; ++i, ++p)
80         {
81             *i=*p;
82         }
83 
84 
85         static const int in3[] = { 0, 1, 0, 0, 0,    1, 1, 0, 0, 0,    0, 0, 0, 0, 0,    0, 0, 0, 0, 0,    0, 0, 0, 0, 0,
86                                    1, 1, 1, 0, 0,    1, 1, 1, 0, 0,    1, 1, 1, 0, 0,    0, 0, 0, 0, 0,    0, 0, 0, 0, 0,
87                                    0, 0, 1, 0, 0,    0, 0, 1, 0, 0,    1, 1, 1, 0, 0,    0, 0, 0, 0, 0,    0, 0, 0, 0, 0,
88                                    1, 1, 1, 1, 0,    1, 1, 1, 1, 0,    1, 1, 1, 1, 0,    1, 1, 1, 1, 0,    0, 0, 0, 0, 0,
89                                    0, 0, 0, 1, 0,    0, 0, 0, 1, 0,    0, 0, 0, 1, 0,    1, 1, 1, 1, 0,    0, 0, 0, 0, 0};
90 
91         i = vol3.begin();
92         end = vol3.end();
93         p = in3;
94 
95         for(; i != end; ++i, ++p)
96         {
97             *i=*p;
98         }
99 
100         static const double in4[] = { 1.0, 0.0, 0.0, 0.0, 1.0,    0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 0.0, 1.0, 0.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0,    1.0, 0.0, 0.0, 0.0, 1.0,
101                                       0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 1.0, 0.0, 1.0, 0.0,    0.0, 0.0, 1.0, 0.0, 0.0,    0.0, 1.0, 0.0, 1.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0,
102                                       0.0, 0.0, 1.0, 0.0, 0.0,    0.0, 0.0, 1.0, 0.0, 0.0,    1.0, 1.0, 1.0, 1.0, 1.0,    0.0, 0.0, 1.0, 0.0, 0.0,    0.0, 0.0, 1.0, 0.0, 0.0,
103                                       0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 1.0, 0.0, 1.0, 0.0,    0.0, 0.0, 1.0, 0.0, 0.0,    0.0, 1.0, 0.0, 1.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0,
104                                       1.0, 0.0, 0.0, 0.0, 1.0,    0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 0.0, 1.0, 0.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0,    1.0, 0.0, 0.0, 0.0, 1.0};
105 
106         DoubleVolume::iterator id = vol4.begin();
107         DoubleVolume::iterator endd = vol4.end();
108         const double * pd = in4;
109 
110         for(; id != endd; ++id, ++pd)
111         {
112             *id=*pd;
113         }
114 
115         static const double in5[] = { 0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 1.0, 1.0, 1.0, 0.0,    0.0, 1.0, 1.0, 1.0, 0.0,    0.0, 1.0, 1.0, 1.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0,
116                                       2.0, 2.0, 0.0, 2.0, 2.0,    2.0, 1.0, 0.0, 1.0, 2.0,    2.0, 2.0, 0.0, 2.0, 2.0,    2.0, 1.0, 0.0, 1.0, 2.0,    2.0, 2.0, 0.0, 2.0, 2.0,
117                                       0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 2.0, 2.0, 2.0, 0.0,    0.0, 2.0, 1.0, 2.0, 0.0,    0.0, 2.0, 2.0, 2.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0,
118                                       2.0, 2.0, 0.0, 2.0, 2.0,    2.0, 1.0, 0.0, 1.0, 2.0,    2.0, 2.0, 0.0, 2.0, 2.0,    2.0, 1.0, 0.0, 1.0, 2.0,    2.0, 2.0, 0.0, 2.0, 2.0,
119                                       0.0, 0.0, 0.0, 0.0, 0.0,    0.0, 1.0, 1.0, 1.0, 0.0,    0.0, 1.0, 1.0, 1.0, 0.0,    0.0, 1.0, 1.0, 1.0, 0.0,    0.0, 0.0, 0.0, 0.0, 0.0};
120 
121         id = vol5.begin();
122         endd = vol5.end();
123         pd = in5;
124 
125         for(; id != endd; ++id, ++pd)
126         {
127             *id=*pd;
128         }
129 
130         static const double in6[] = {
131             0.0, 0.0, 0.0, 0.0, 0.0,
132             0.0, 0.0, 0.0, 0.0, 0.0,
133             0.0, 0.0, 0.0, 0.0, 0.0,
134             0.0, 0.0, 0.0, 0.0, 0.0,
135             0.0, 0.0, 0.0, 0.0, 0.0,
136 
137             0.0, 0.0, 0.0, 0.0, 0.0,
138             0.0, 0.0, 0.0, 0.0, 0.0,
139             0.0, 0.0, 0.0, 0.0, 0.0,
140             0.0, 0.0, 0.0, 0.0, 0.0,
141             0.0, 0.0, 0.0, 0.0, 0.0,
142 
143             0.0, 0.0, 0.0, 0.0, 0.0,
144             0.0, 0.0, 0.0, 0.0, 0.0,
145             1.0, 1.0, 0.0, 1.0, 1.0,
146             1.0, 1.0, 0.0, 1.0, 1.0,
147             0.0, 0.0, 0.0, 0.0, 0.0,
148 
149             0.0, 0.0, 0.0, 0.0, 0.0,
150             0.0, 0.0, 0.0, 0.0, 0.0,
151             1.0, 1.0, 0.0, 1.0, 1.0,
152             1.0, 1.0, 0.0, 1.0, 1.0,
153             0.0, 0.0, 0.0, 0.0, 0.0,
154 
155             0.0, 0.0, 0.0, 0.0, 0.0,
156             0.0, 0.0, 0.0, 0.0, 0.0,
157             0.0, 0.0, 0.0, 0.0, 0.0,
158             0.0, 0.0, 0.0, 0.0, 0.0,
159             0.0, 0.0, 0.0, 0.0, 0.0 };
160 
161         id = vol6.begin();
162         endd = vol6.end();
163         pd = in6;
164 
165         for(; id != endd; ++id, ++pd)
166         {
167             *id=*pd;
168         }
169 
170     }
171 
labelingSixTest1VolumeLabelingTest172     void labelingSixTest1()
173     {
174         IntVolume res(vol1.shape()), res2(vol1.shape());
175 
176         unsigned int maxLabel = labelVolumeSix(srcMultiArrayRange(vol1), destMultiArray(res));
177         should(2 == maxLabel);
178 
179         IntVolume::iterator i1 = vol1.begin();
180         IntVolume::iterator i1end = vol1.end();
181         IntVolume::iterator i2 = res.begin();
182 
183         for(; i1 != i1end; ++i1, ++i2)
184         {
185             should( *i1 == (*i2 - 1.0) );
186         }
187 
188         maxLabel = labelMultiArray(vol1, res2, DirectNeighborhood);
189         should(2 == maxLabel);
190         should(res == res2);
191 
192         res2 = 0;
193         maxLabel = labelVolumeSix(vol1, res2);
194         should(2 == maxLabel);
195         should(res == res2);
196 
197         res2 = 0;
198         maxLabel = labelVolume(vol1, res2, NeighborCode3DSix());
199         should(2 == maxLabel);
200         should(res == res2);
201     }
202 
labelingSixTest2VolumeLabelingTest203     void labelingSixTest2()
204     {
205         IntVolume res(vol2.shape()), res2(vol2.shape());
206 
207         should(64 == labelVolume(srcMultiArrayRange(vol2), destMultiArray(res), NeighborCode3DSix()));
208 
209         IntVolume::iterator i2 = res.begin();
210         IntVolume::iterator i2end = res.end();
211         int address = 0;
212 
213         for(; i2 != i2end; ++i2, ++address)
214         {
215             should( *i2 == address+1 );
216         }
217 
218         should(64 == labelMultiArray(vol2, res2, DirectNeighborhood));
219         should(res == res2);
220     }
221 
labelingSixTest3VolumeLabelingTest222     void labelingSixTest3()
223     {
224         IntVolume res(vol3.shape()), res2(vol3.shape());
225 
226         should(5 == labelVolume(srcMultiArrayRange(vol3), destMultiArray(res), NeighborCode3DSix()));
227 
228         static const int out3[] = { 1, 2, 3, 3, 3,    2, 2, 3, 3, 3,    3, 3, 3, 3, 3,    3, 3, 3, 3, 3,    3, 3, 3, 3, 3,
229                                     2, 2, 2, 3, 3,    2, 2, 2, 3, 3,    2, 2, 2, 3, 3,    3, 3, 3, 3, 3,    3, 3, 3, 3, 3,
230                                     4, 4, 2, 3, 3,    4, 4, 2, 3, 3,    2, 2, 2, 3, 3,    3, 3, 3, 3, 3,    3, 3, 3, 3, 3,
231                                     2, 2, 2, 2, 3,    2, 2, 2, 2, 3,    2, 2, 2, 2, 3,    2, 2, 2, 2, 3,    3, 3, 3, 3, 3,
232                                     5, 5, 5, 2, 3,    5, 5, 5, 2, 3,    5, 5, 5, 2, 3,    2, 2, 2, 2, 3,    3, 3, 3, 3, 3};
233 
234         IntVolume::iterator i2 = res.begin();
235         IntVolume::iterator i2end = res.end();
236         const int * p = out3;
237 
238         for(; i2 != i2end; ++i2, ++p)
239         {
240             should( *i2 == *p );
241         }
242 
243         should(5 == labelMultiArray(vol3, res2, DirectNeighborhood));
244         should(res == res2);
245     }
246 
labelingSixTest4VolumeLabelingTest247     void labelingSixTest4()
248     {
249         IntVolume res(vol4.shape()), res2(vol4.shape());
250 
251         should(18 == labelVolume(srcMultiArrayRange(vol4), destMultiArray(res), NeighborCode3DSix()));
252 
253         static const int out4[] = { 1, 2, 2, 2, 3,    2, 2, 2, 2, 2,    2, 2, 4, 2, 2,    2, 2, 2, 2, 2,    5, 2, 2, 2, 6,
254                                     2, 2, 2, 2, 2,    2, 7, 2, 8, 2,    2, 2, 4, 2, 2,    2, 9, 2,10, 2,    2, 2, 2, 2, 2,
255                                     2, 2, 4, 2, 2,    2, 2, 4, 2, 2,    4, 4, 4, 4, 4,    2, 2, 4, 2, 2,    2, 2, 4, 2, 2,
256                                     2, 2, 2, 2, 2,    2,11, 2,12, 2,    2, 2, 4, 2, 2,    2,13, 2,14, 2,    2, 2, 2, 2, 2,
257                                    15, 2, 2, 2,16,    2, 2, 2, 2, 2,    2, 2, 4, 2, 2,    2, 2, 2, 2, 2,   17, 2, 2, 2,18};
258 
259         IntVolume::iterator i2 = res.begin();
260         IntVolume::iterator i2end = res.end();
261         const int * p = out4;
262 
263         for(; i2 != i2end; ++i2, ++p)
264         {
265             should( *i2 == *p );
266         }
267 
268         should(18 == labelMultiArray(vol4, res2, DirectNeighborhood));
269         should(res == res2);
270 
271         res2 = 0;
272         should(18 == labelMultiArray(vol4, res2,
273                                      LabelOptions().neighborhood(DirectNeighborhood)));
274         should(res == res2);
275    }
276 
labelingSixWithBackgroundTest1VolumeLabelingTest277     void labelingSixWithBackgroundTest1()
278     {
279         IntVolume res(vol5.shape()), res2(vol5.shape());
280 
281         unsigned int maxLabel = labelVolumeWithBackground(srcMultiArrayRange(vol5), destMultiArray(res), NeighborCode3DSix(), 0);
282         should(4 == maxLabel);
283 
284         static const int out5[] = { 0, 0, 0, 0, 0,    0, 1, 1, 1, 0,    0, 1, 1, 1, 0,    0, 1, 1, 1, 0,    0, 0, 0, 0, 0,
285                                     2, 2, 0, 2, 2,    2, 1, 0, 1, 2,    2, 2, 0, 2, 2,    2, 1, 0, 1, 2,    2, 2, 0, 2, 2,
286                                     0, 0, 0, 0, 0,    0, 2, 2, 2, 0,    0, 2, 3, 2, 0,    0, 2, 2, 2, 0,    0, 0, 0, 0, 0,
287                                     2, 2, 0, 2, 2,    2, 4, 0, 4, 2,    2, 2, 0, 2, 2,    2, 4, 0, 4, 2,    2, 2, 0, 2, 2,
288                                     0, 0, 0, 0, 0,    0, 4, 4, 4, 0,    0, 4, 4, 4, 0,    0, 4, 4, 4, 0,    0, 0, 0, 0, 0};
289 
290         IntVolume::iterator i2 = res.begin();
291         IntVolume::iterator i2end = res.end();
292         const int * p = out5;
293 
294         for(; i2 != i2end; ++i2, ++p)
295         {
296             should( *i2 == *p );
297         }
298 
299         should(4 == labelMultiArrayWithBackground(vol5, res2, DirectNeighborhood));
300         should(res == res2);
301 
302         res2 = 0;
303         should(4 == labelMultiArray(vol5, res2,
304                                     LabelOptions().neighborhood(DirectNeighborhood).ignoreBackgroundValue(0)));
305         should(res == res2);
306 
307         res2 = 0;
308         should(4 == labelVolumeWithBackground(vol5, res2, NeighborCode3DSix(), 0));
309         should(res == res2);
310     }
311 
312 
labelingTwentySixTest1VolumeLabelingTest313     void labelingTwentySixTest1()
314     {
315         IntVolume res(vol1.shape()), res2(vol1.shape());
316 
317         should(2 == labelVolume(srcMultiArrayRange(vol1), destMultiArray(res), NeighborCode3DTwentySix()));
318 
319         IntVolume::iterator i1 = vol1.begin();
320         IntVolume::iterator i1end = vol1.end();
321         IntVolume::iterator i2 = res.begin();
322 
323         for(; i1 != i1end; ++i1, ++i2)
324         {
325             should( *i1 == (*i2 - 1.0) );
326         }
327 
328         should(2 == labelMultiArray(vol1, res2, IndirectNeighborhood));
329         should(res == res2);
330     }
331 
labelingTwentySixTest2VolumeLabelingTest332     void labelingTwentySixTest2()
333     {
334         IntVolume res(vol2.shape()), res2(vol2.shape());
335 
336         should(2 == labelVolume(srcMultiArrayRange(vol2), destMultiArray(res), NeighborCode3DTwentySix()));
337 
338         IntVolume::iterator i1 = vol2.begin();
339         IntVolume::iterator i1end = vol2.end();
340         IntVolume::iterator i2 = res.begin();
341 
342         for(; i1 != i1end; ++i1, ++i2)
343         {
344             should( *i1 == (*i2 - 1.0) );
345         }
346 
347         should(2 == labelMultiArray(vol2, res2, IndirectNeighborhood));
348         should(res == res2);
349     }
350 
labelingTwentySixTest3VolumeLabelingTest351     void labelingTwentySixTest3()
352     {
353         IntVolume res(vol4.shape()), res2(vol4.shape());
354 
355         should(2 == labelVolume(srcMultiArrayRange(vol4), destMultiArray(res), NeighborCode3DTwentySix()));
356 
357         DoubleVolume::iterator i1 = vol4.begin();
358         DoubleVolume::iterator i1end = vol4.end();
359         IntVolume::iterator i2 = res.begin();
360 
361         for(; i1 != i1end; ++i1, ++i2)
362         {
363             should( *i1 == 2-*i2 );
364         }
365 
366         should(2 == labelMultiArray(vol4, res2, IndirectNeighborhood));
367         should(res == res2);
368     }
369 
labelingTwentySixWithBackgroundTest1VolumeLabelingTest370     void labelingTwentySixWithBackgroundTest1()
371     {
372         IntVolume res(vol5.shape()), res2(vol5.shape());
373 
374         should(2 == labelVolumeWithBackground(srcMultiArrayRange(vol5), destMultiArray(res), NeighborCode3DTwentySix(), 0));
375 
376         DoubleVolume::iterator i1 = vol5.begin();
377         DoubleVolume::iterator i1end = vol5.end();
378         IntVolume::iterator i2 = res.begin();
379 
380         for(; i1 != i1end; ++i1, ++i2)
381         {
382             should( *i1 == *i2 );
383         }
384 
385         should(2 == labelMultiArrayWithBackground(vol5, res2, IndirectNeighborhood));
386         should(res == res2);
387     }
388 
labelingAllTestVolumeLabelingTest389     void labelingAllTest()
390     {
391         IntVolume res(vol6.shape());
392         static const int out6[] = {
393                 0, 0, 0, 0, 0,
394                 0, 0, 0, 0, 0,
395                 0, 0, 0, 0, 0,
396                 0, 0, 0, 0, 0,
397                 0, 0, 0, 0, 0,
398 
399                 0, 0, 0, 0, 0,
400                 0, 0, 0, 0, 0,
401                 0, 0, 0, 0, 0,
402                 0, 0, 0, 0, 0,
403                 0, 0, 0, 0, 0,
404 
405                 0, 0, 0, 0, 0,
406                 0, 0, 0, 0, 0,
407                 1, 1, 0, 2, 2,
408                 1, 1, 0, 2, 2,
409                 0, 0, 0, 0, 0,
410 
411                 0, 0, 0, 0, 0,
412                 0, 0, 0, 0, 0,
413                 1, 1, 0, 2, 2,
414                 1, 1, 0, 2, 2,
415                 0, 0, 0, 0, 0,
416 
417                 0, 0, 0, 0, 0,
418                 0, 0, 0, 0, 0,
419                 0, 0, 0, 0, 0,
420                 0, 0, 0, 0, 0,
421                 0, 0, 0, 0, 0 };
422 
423         res = 0;
424         should(2 == labelVolumeWithBackground(srcMultiArrayRange(vol6), destMultiArray(res), NeighborCode3DSix(), 0));
425         shouldEqualSequence(res.begin(), res.end(), out6);
426 
427         res = 0;
428         should(2 == labelVolumeWithBackground(srcMultiArrayRange(vol6), destMultiArray(res), NeighborCode3DTwentySix(), 0));
429         shouldEqualSequence(res.begin(), res.end(), out6);
430 
431         res = 0;
432         should(3 == labelVolume(srcMultiArrayRange(vol6), destMultiArray(res), NeighborCode3DSix()));
433         res -= 1;
434         shouldEqualSequence(res.begin(), res.end(), out6);
435 
436         res = 0;
437         should(3 == labelVolume(srcMultiArrayRange(vol6), destMultiArray(res), NeighborCode3DTwentySix()));
438         res -= 1;
439         shouldEqualSequence(res.begin(), res.end(), out6);
440 
441         res = 0;
442         should(2 == labelMultiArrayWithBackground(vol6, res, DirectNeighborhood));
443         shouldEqualSequence(res.begin(), res.end(), out6);
444 
445         res = 0;
446         should(2 == labelMultiArrayWithBackground(vol6, res, IndirectNeighborhood, 0.0));
447         shouldEqualSequence(res.begin(), res.end(), out6);
448 
449         res = 0;
450         should(3 == labelMultiArray(vol6, res, DirectNeighborhood));
451         res -= 1;
452         shouldEqualSequence(res.begin(), res.end(), out6);
453 
454         res = 0;
455         should(3 == labelMultiArray(vol6, res, IndirectNeighborhood));
456         res -= 1;
457         shouldEqualSequence(res.begin(), res.end(), out6);
458     }
459 
460     IntVolume vol1, vol2, vol3;
461     DoubleVolume vol4, vol5, vol6;
462 };
463 
464 
465 
466 struct VolumeLabelingTestSuite
467 : public vigra::test_suite
468 {
VolumeLabelingTestSuiteVolumeLabelingTestSuite469     VolumeLabelingTestSuite()
470     : vigra::test_suite("VolumeLabelingTestSuite")
471     {
472         add( testCase( &VolumeLabelingTest::labelingSixTest1));
473         add( testCase( &VolumeLabelingTest::labelingSixTest2));
474         add( testCase( &VolumeLabelingTest::labelingSixTest3));
475         add( testCase( &VolumeLabelingTest::labelingSixTest4));
476         add( testCase( &VolumeLabelingTest::labelingSixWithBackgroundTest1));
477         add( testCase( &VolumeLabelingTest::labelingTwentySixTest1));
478         add( testCase( &VolumeLabelingTest::labelingTwentySixTest2));
479         add( testCase( &VolumeLabelingTest::labelingTwentySixTest3));
480         add( testCase( &VolumeLabelingTest::labelingTwentySixWithBackgroundTest1));
481         add( testCase( &VolumeLabelingTest::labelingAllTest));
482     }
483 };
484 
main(int argc,char ** argv)485 int main(int argc, char ** argv)
486 {
487     VolumeLabelingTestSuite test;
488 
489     int failed = test.run(vigra::testsToBeExecuted(argc, argv));
490 
491     std::cout << test.report() << std::endl;
492     return (failed != 0);
493 }
494 
495