DGtal  1.5.beta
testCompressedVolWriter.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "ConfigTest.h"
#include "DGtalCatch.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/writers/LongvolWriter.h"
#include "DGtal/io/readers/LongvolReader.h"
#include "DGtal/io/writers/VolWriter.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
Include dependency graph for testCompressedVolWriter.cpp:

Go to the source code of this file.

Functions

template<typename Image >
bool checkImage (const Image &a, const Image &b)
 
 TEST_CASE ("Testing CompressedVolWriter")
 
 TEST_CASE ("Testing CompressedLongvol")
 

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 Systemes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
Date
2016/12/26

Functions for testing class CompressedVolWriter.

This file is part of the DGtal library.

Definition in file testCompressedVolWriter.cpp.

Function Documentation

◆ checkImage()

template<typename Image >
bool checkImage ( const Image a,
const Image b 
)

Definition at line 51 of file testCompressedVolWriter.cpp.

52 {
53  for(auto p: a.domain())
54  {
55  if (a(p) != b(p))
56  {
57  trace.info()<< p <<" "<< a(p) <<" "<<b(p)<<std::endl;
58  return false;
59  }
60  }
61  return true;
62 }
std::ostream & info()
Trace trace
Definition: Common.h:153

References DGtal::Trace::info(), and DGtal::trace.

Referenced by TEST_CASE().

◆ TEST_CASE() [1/2]

TEST_CASE ( "Testing CompressedLongvol"  )

Definition at line 90 of file testCompressedVolWriter.cpp.

91 {
92  Domain domain(Point(0,0,0), Point(2,2,2));
95  image.setValue(Point(1,1,1), 0X8899AABBCCDDEEFFull);
96 
97  SECTION("Testing API of CompressedVolWriter")
98  {
99  LongvolWriter< ImageContainerBySTLVector<Domain, DGtal::uint64_t> >::exportLongvol("test.lvol", image, false);
100  trace.info()<<std::endl;
101  LongvolWriter< ImageContainerBySTLVector<Domain, DGtal::uint64_t> >::exportLongvol("testz.lvol", image);
102  REQUIRE( image.isValid() );
103  }
104 
105  SECTION("Testing write/read of CompressedVolWriter")
106  {
107  Image read = LongvolReader<Image>::importLongvol("test.lvol");
108  REQUIRE( (checkImage(image,read) == true)) ;
109 
110  Image readz = LongvolReader<Image>::importLongvol("testz.lvol");
111  REQUIRE( (checkImage(image,readz) == true)) ;
112  }
113 }
Aim: implements association bewteen points lying in a digital domain and values.
Definition: Image.h:70
Aim: implements methods to read a "Longvol" file format (with DGtal::uint64_t value type).
Definition: LongvolReader.h:92
Aim: Export a 3D Image using the Longvol formats (volumetric image with DGtal::uint64_t value type).
Definition: LongvolWriter.h:70
MyPointD Point
Definition: testClone2.cpp:383
bool checkImage(const Image &a, const Image &b)
Domain domain
Image image(domain)
ImageContainerBySTLVector< Domain, Value > Image
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))

References checkImage(), domain, image(), DGtal::Trace::info(), REQUIRE(), SECTION(), and DGtal::trace.

◆ TEST_CASE() [2/2]

TEST_CASE ( "Testing CompressedVolWriter"  )

Definition at line 64 of file testCompressedVolWriter.cpp.

65 {
66  Domain domain(Point(0,0,0), Point(10,10,10));
69  image.setValue(Point(5,5,5), 42);
70 
71  SECTION("Testing API of CompressedVol")
72  {
73  VolWriter< ImageContainerBySTLVector<Domain, unsigned char> >::exportVol("test.vol", image, false);
74  VolWriter< ImageContainerBySTLVector<Domain, unsigned char> >::exportVol("testz.vol", image);
75  REQUIRE( image.isValid() );
76  }
77 
78  SECTION("Testing write/read of CompressedVolWriter")
79  {
80  Image read = VolReader<Image>::importVol("test.vol");
81  trace.info()<<read<<std::endl;
82  REQUIRE( (checkImage(image,read) == true)) ;
83 
84  Image readz = VolReader<Image>::importVol("testz.vol");
85  trace.info()<<readz<<std::endl;
86  REQUIRE( (checkImage(image,readz) == true)) ;
87  }
88 }
Aim: implements methods to read a "Vol" file format.
Definition: VolReader.h:90
Aim: Export a 3D Image using the Vol formats.
Definition: VolWriter.h:69

References checkImage(), domain, image(), DGtal::Trace::info(), REQUIRE(), SECTION(), and DGtal::trace.