iRoCS Toolbox  1.1.0
BlitzImageWriter.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2008 Alexandra Teynor
4  *
5  * Image Analysis Lab, University of Freiburg, Germany
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  *
21  **************************************************************************/
22 
23 /**********************************************************
24  *
25  * BlitzImageWriter
26  * Class that writes blitz arrays into a desired image
27  * format
28  *
29  * author: Alex Teynor (teynor@informatik.uni-freiburg.de)
30  * Dec. 2008
31  *
32  * extended by: Thorsten Schmidt (tschmidt@cs.uni-freiburg.de)
33  * Mar. 2013
34  *
35  *********************************************************/
36 
37 #ifndef _BLITZIMAGEWRITER
38 #define _BLITZIMAGEWRITER
39 
40 #ifdef HAVE_CONFIG_H
41 #include <config.hh>
42 #endif
43 
44 #ifdef HAVE_LIBJPEG
45 namespace JPEGLIB {
46 // jpeg library
47 extern "C" {
48 #include <jpeglib.h>
49 }
50 };
51 #endif
52 
53 // Blitz arrays
54 #include <blitz/array.h>
55 
56 //PNG lib
57 #include <png.h>
58 
59 #include "ImageAccessWrapper.hh"
60 
61 
62 
65 
66 public:
67 
68  /*======================================================================*/
78  /*======================================================================*/
79  static void writePGM(const blitz::Array<unsigned char,2> &data,
80  const std::string& fileName, int format = 2);
81 
82  /*======================================================================*/
93  /*======================================================================*/
94  static void writePPM(const ImageAccessWrapper &data,
95  const std::string& fileName, int format = 3);
96 
97 #ifdef HAVE_LIBJPEG
98 
99  /*======================================================================*/
108  /*======================================================================*/
109  static int writeJPEG(const ImageAccessWrapper &data,
110  const std::string& fileName,
111  int quality = 100);
112 
113 #endif
114 
115  /*======================================================================*/
128  /*======================================================================*/
129  static int writePNG(const ImageAccessWrapper &data,
130  const std::string& fileName,
131  int compfac = 9);
132 
133 };
134 
135 
136 #endif
137 
138 
Write blitz arrays into a desired image format.
To allow for different blitz storage formats to be handeled equally.