DGtal  1.3.beta
Functions
testLongvol.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/images/ImageSelector.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/io/writers/LongvolWriter.h"
#include "DGtal/io/readers/LongvolReader.h"
Include dependency graph for testLongvol.cpp:

Go to the source code of this file.

Functions

bool testLongvol ()
 
int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
David Coeurjolly (david.nosp@m..coe.nosp@m.urjol.nosp@m.ly@l.nosp@m.iris..nosp@m.cnrs.nosp@m..fr ) Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2011/06/11

Functions for testing class Longvol.

This file is part of the DGtal library.

Definition in file testLongvol.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 88 of file testLongvol.cpp.

89 {
90  trace.beginBlock ( "Testing class Longvol" );
91  trace.info() << "Args:";
92  for ( int i = 0; i < argc; ++i )
93  trace.info() << " " << argv[ i ];
94  trace.info() << endl;
95 
96  bool res = testLongvol(); // && ... other tests
97  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
98  trace.endBlock();
99  return res ? 0 : 1;
100 }

References DGtal::Trace::beginBlock(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Trace::info(), testLongvol(), and DGtal::trace.

◆ testLongvol()

bool testLongvol ( )

Example of a test. To be completed.

Definition at line 50 of file testLongvol.cpp.

51 {
52  unsigned int nbok = 0;
53  unsigned int nb = 0;
54 
55  trace.beginBlock ( "Testing Longvol writer ..." );
56 
57  Z3i::Point a(0,0,0);
58  Z3i::Point b(15,15,15);
59  Z3i::Point c(7,7,7);
60 
62  Image image(Z3i::Domain(a,b));
63 
64  image.setValue(c,0X8899AABBCCDDEEFFull);
65 
66  LongvolWriter<Image>::exportLongvol("export-longvol.longvol",image);
67 
68  Image image2 = LongvolReader<Image>::importLongvol("export-longvol.longvol");
69 
70  bool allFine= true;
71  Image::ConstIterator ito = image.begin();
72  for(Image::ConstIterator it = image2.begin(), itend=image2.end();
73  it != itend; ++it, ++ito)
74  allFine &= (*it) == (*ito);
75 
76  nbok += allFine ? 1 : 0;
77  nb++;
78  trace.info() << "(" << nbok << "/" << nb << ") "
79  << "true == true" << std::endl;
80  trace.endBlock();
81 
82  return nbok == nb;
83 }

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), image(), DGtal::Trace::info(), and DGtal::trace.

Referenced by main().

testLongvol
bool testLongvol()
Definition: testLongvol.cpp:50
image
Image image(domain)
DGtal::HyperRectDomain< Space >
DGtal::Trace::endBlock
double endBlock()
DGtal::ImageContainerBySTLVector
Definition: ImageContainerBySTLVector.h:126
DGtal::LongvolReader
Aim: implements methods to read a "Longvol" file format (with DGtal::uint64_t value type).
Definition: LongvolReader.h:91
DGtal::Trace::emphase
std::ostream & emphase()
DGtal::trace
Trace trace
Definition: Common.h:154
DGtal::ImageContainerBySTLVector< Domain, Value >::ConstIterator
std::vector< Value >::const_iterator ConstIterator
Definition: ImageContainerBySTLVector.h:265
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::info
std::ostream & info()
DGtal::LongvolWriter
Aim: Export a 3D Image using the Longvol formats (volumetric image with DGtal::uint64_t value type).
Definition: LongvolWriter.h:69
Image
ImageContainerBySTLVector< Domain, Value > Image
Definition: testSimpleRandomAccessRangeFromPoint.cpp:45
DGtal::Image
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:69
DGtal::PointVector< dim, Integer >