DGtal  0.9.2
testCheckImageConcept.cpp
1 
30 #include "DGtal/helpers/StdDefs.h"
32 #include <iostream>
33 #include "DGtal/base/Common.h"
34 #include "DGtal/images/ImageContainerBySTLVector.h"
35 #include "DGtal/images/ImageContainerBySTLMap.h"
36 #ifdef WITH_ITK
37 #include "DGtal/images/ImageContainerByITKImage.h"
38 #endif
39 #include "DGtal/images/ImageContainerByHashTree.h"
40 #include "DGtal/images/CImage.h"
41 
43 
44 using namespace std;
45 using namespace DGtal;
46 using namespace Z2i;
47 
49 // Functions for testing class CheckImageConcept.
51 
55 bool testCheckImageConcept()
56 {
57  unsigned int nbok = 0;
58  unsigned int nb = 0;
59 
60  trace.beginBlock ( "Testing block ..." );
61 
62  typedef ImageContainerBySTLVector<Domain, int> ImageVector;
64 
65 #ifdef WITH_ITK
67 #endif
68 
69  //HashTree is not (yet) a model of CImage
71 
72  BOOST_CONCEPT_ASSERT(( concepts::CImage< ImageVector >));
73  BOOST_CONCEPT_ASSERT(( concepts::CImage< ImageMap >));
74 #ifdef WITH_ITK
75  BOOST_CONCEPT_ASSERT(( concepts::CImage< ImageITK >));
76 #endif
77 
78  BOOST_CONCEPT_ASSERT(( concepts::CImage< ImageHash >));
79 
80  nbok += true ? 1 : 0;
81  nb++;
82  trace.info() << "(" << nbok << "/" << nb << ") "
83  << "true == true" << std::endl;
84  trace.endBlock();
85 
86  return nbok == nb;
87 }
88 
90 // Standard services - public :
91 
92 int main( int argc, char** argv )
93 {
94  trace.beginBlock ( "Testing class CheckImageConcept" );
95  trace.info() << "Args:";
96  for ( int i = 0; i < argc; ++i )
97  trace.info() << " " << argv[ i ];
98  trace.info() << endl;
99 
100  bool res = testCheckImageConcept(); // && ... other tests
101  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
102  trace.endBlock();
103  return res ? 0 : 1;
104 }
105 // //
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:130
STL namespace.
double endBlock()
std::ostream & emphase()
Model of CImageContainer implementing the association key<->Value using a hash tree. This class provides a built-in iterator.
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & info()
Aim: Defines the concept describing a read/write image, having an output iterator.
Definition: CImage.h:102
Aim: implements a model of CImageContainer using a ITK Image.