DGtal  1.2.0
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.

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 }
std::ostream & info()
Trace trace
Definition: Common.h:154

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

Referenced by TEST_CASE().

◆ TEST_CASE() [1/2]

TEST_CASE ( "Testing CompressedLongvol"  )

Definition at line 89 of file testCompressedVolWriter.cpp.

90 {
91  Domain domain(Point(0,0,0), Point(2,2,2));
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 }
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 65 of file testCompressedVolWriter.cpp.

66 {
67  Domain domain(Point(0,0,0), Point(10,10,10));
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 }
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(), REQUIRE(), and SECTION().