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
- Bertrand Kerautret (
kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr
) LORIA (CNRS, UMR 7503), University of Nancy, France
- Date
- 2013/05/01
Functions for testing class GenericWriter.
This file is part of the DGtal library.
Definition in file testGenericWriter.cpp.
bool testGenericWriter |
( |
| ) |
|
Example of a test. To be completed.
Definition at line 51 of file testGenericWriter.cpp.
53 unsigned int nbok = 0;
63 for(
unsigned int i =0; i< 5; i++){
64 for(
unsigned int j =0; j< 5; j++){
65 for(
unsigned int k =0; k< 5; k++){
71 for(
unsigned int i =0; i< 5; i++){
72 for(
unsigned int j =0; j< 5; j++){
73 for(
unsigned int k =0; k< 5; k++){
79 for(
unsigned int i =0; i< 5; i++){
80 for(
unsigned int j =0; j< 5; j++){
88 for(
unsigned int i =0; i<= 255; i++){
89 for(
unsigned int j =0; j<= 255; j++){
96 std::string filenameImage1 = testPath +
"samples/cat10.pgm3d";
100 trace.
info() <<
"Testing writing PGM3D ... ";
101 bool ok1 = anImportedImage1>>
"testGenericWriter.pgm3d";
106 trace.
info() <<
"Testing writing HDF5 3D ... ";
107 okh5 = anImportedImage1 >>
"testGenericWriter.h5";
109 trace.
info() <<
"Testing writing HDF5 3D (bis) ... ";
114 trace.
info() <<
"Testing writing vol ... ";
115 bool ok2 = anImportedImage1 >>
"testGenericWriter.vol";
117 trace.
info() <<
"Testing writing longvol ... ";
118 bool ok2bis = an64bitsImage3D >>
"testGenericWriter.longvol";
120 trace.
info() <<
"Testing writing raw ... ";
121 bool ok3 = anImportedImage1 >>
"testGenericWriter.raw";
123 trace.
info() <<
"Testing writing raw (bis) ... ";
128 for (
auto ext: ITK_IO_IMAGE_EXT){
129 trace.
info() <<
"Testing writing ITK (" << ext <<
") ... ";
130 if( ext != std::string(
"gz") )
132 okITK &= anImportedImage1 >> (std::string(
"testGenericWriter.") + ext);
136 trace.
info() <<
"Testing writing ITK (.nii.gz) ... ";
137 okITK &= anImportedImage1 >>
"testGenericWriter.nii.gz";
141 std::string filenameImage2 = testPath +
"samples/contourS.pgm";
146 trace.
info() <<
"Testing writing pgm ... ";
147 bool ok4 = anImportedImage2 >>
"testGenericWriter.pgm";
149 trace.
info() <<
"Testing writing raw ... ";
150 bool ok5 = anImportedImage2 >>
"testGenericWriter.raw";
154 trace.
info() <<
"Testing writing color image writer ... ";
158 nbok += ((ok1 && okh5 && ok2 & ok2bis && ok3 && ok3bis && ok4 && ok5 && ok6 && ok7 && ok8 && okITK) ? 1 : 0);
160 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") "
161 <<
"true == true" << std::endl;
Structure representing an RGB triple with alpha component.
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())
References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::GenericWriter< TContainer, Tdim, TValue, TFunctor >::exportFile(), DGtal::GenericReader< TContainer, Tdim, TValue >::import(), DGtal::Trace::info(), DGtal::ITK_IO_IMAGE_EXT, and DGtal::trace.
Referenced by main().