DGtal  0.9.3
Functions
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 52 of file testCompressedVolWriter.cpp.

References DGtal::Image< TImageContainer >::domain(), DGtal::Trace::info(), and DGtal::trace.

Referenced by TEST_CASE().

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

◆ TEST_CASE() [1/2]

TEST_CASE ( "Testing CompressedVolWriter"  )

Definition at line 65 of file testCompressedVolWriter.cpp.

References checkImage(), domain(), image(), DGtal::Image< TImageContainer >::isValid(), REQUIRE(), SECTION(), and DGtal::Image< TImageContainer >::setValue().

66 {
67  Domain domain(Point(0,0,0), Point(10,10,10));
69  Image image(domain);
70  image.setValue(Point(5,5,5), 42);
71 
72  SECTION("Testing API of CompressedVol")
73  {
74  VolWriter< ImageContainerBySTLVector<Domain, unsigned char> >::exportVol("test.vol", image, false);
75  VolWriter< ImageContainerBySTLVector<Domain, unsigned char> >::exportVol("testz.vol", image);
76  REQUIRE( image.isValid() );
77  }
78 
79  SECTION("Testing write/read of CompressedVolWriter")
80  {
81  Image read = VolReader<Image>::importVol("test.vol");
82  REQUIRE( (checkImage(image,read) == true)) ;
83 
84  Image readz = VolReader<Image>::importVol("testz.vol");
85  REQUIRE( (checkImage(image,readz) == true)) ;
86  }
87 }
const Domain domain(Point(1, 2), Point(6, 5))
Aim: Export a 3D Image using the Vol formats.
Definition: VolWriter.h:68
bool checkImage(const Image &a, const Image &b)
REQUIRE(domain.isInside(aPoint))
Aim: implements methods to read a "Vol" file format.
Definition: VolReader.h:89
MyPointD Point
Definition: testClone2.cpp:383
ImageContainerBySTLVector< Domain, Value > Image
SECTION("Testing constant forward iterators")
Image image(domain)

◆ TEST_CASE() [2/2]

TEST_CASE ( "Testing CompressedLongvol"  )

Definition at line 89 of file testCompressedVolWriter.cpp.

References checkImage(), domain(), image(), DGtal::Trace::info(), DGtal::Image< TImageContainer >::isValid(), REQUIRE(), SECTION(), DGtal::Image< TImageContainer >::setValue(), and DGtal::trace.

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