img3D_IO.h 8.3 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg                *
*                                                                              *
* This library 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 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library 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 Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* aint with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
* Web site: https://iggservis.u-strasbg.fr/CGoGN/                              *
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __IMG3D_IO__
#define __IMG3D_IO__

#include "Utils/os_spec.h"
#include <IL/ilu.h>

namespace CGoGN
{

namespace Utils
{

namespace Img3D_IO
{
	/**
	* Image type
	*/
	enum TYPEIMG {BOOL8=1, VAL8, RGB8, VAL16, VALFLOAT};

	/**
	* Initialization of IO
	* Necessary before any other call
	*/
thery's avatar
thery committed
48
	void initIO();
Pierre Kraemer's avatar
Pierre Kraemer committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

	/**
	* Load bool image (0/255) 
	* Warning: the allocated data image contain w supplemntary bytes which store information
	* @param filename evident
	* @param w width of image (reference out)
	* @param h height of image (reference out)
	* @param d depth of image (reference out)
	* @param vx voxel size x stored in image (reference out)
	* @param vy voxel size y stored in image (reference out)
	* @param vz voxel size z stored in image (reference out)
	* @param tag image tag (reference out)
	* @return a pointer on the image data (that have been allocated by function)
	*/
//	unsigned char* loadBool(char* filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag);

	/**
	* Save bool image (0/255) 
	* generated image is grey level, each set of 8 plane is compressed to one 8bpp plane
	* Warning: the saved image contain w supplemntary bytes which store informations
	* Warning: origin of image is lower left
	* @param filename evident
	* @param data a pointer on the image data 
	* @param w width of image 
	* @param h height of image 
	* @param d depth of image 
	* @param vx voxel size x 
	* @param vy voxel size y 
	* @param vz voxel size z 
	* @param tag image tag  
	*/
thery's avatar
thery committed
80
	void saveBool(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
81
82
83
84
85
86
87
88
89
90
91
92
93
94

	/**
	* Load 8 bits image, if image is boolean compressed, it uncompress it !
	* Warning: the allocated data image contain w supplemntary bytes which store information
	* @param filename evident
	* @param w width of image (reference out)
	* @param h height of image (reference out)
	* @param d depth of image (reference out)
	* @param vx voxel size x stored in image (reference out)
	* @param vy voxel size y stored in image (reference out)
	* @param vz voxel size z stored in image (reference out)
	* @param tag image tag (reference out)
	* @return a pointer on the image data (that have been allocated by function)
	*/
thery's avatar
thery committed
95
	unsigned char* loadVal_8(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

	/**
	* Save 8bits val image 
	* Warning: the saved image contain w supplemntary bytes which store informations
	* Warning: origin of image is lower left
	* @param filename evident
	* @param data a pointer on the image data 
	* @param w width of image 
	* @param h height of image 
	* @param d depth of image 
	* @param vx voxel size x 
	* @param vy voxel size y 
	* @param vz voxel size z 
	* @param tag image tag  
	*/
thery's avatar
thery committed
111
	void saveVal(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126


	/**
	* Load 16 bits value image 
	* Warning: the allocated data image contain w supplemntary bytes which store information
	* @param filename evident
	* @param w width of image (reference out)
	* @param h height of image (reference out)
	* @param d depth of image (reference out)
	* @param vx voxel size x stored in image (reference out)
	* @param vy voxel size y stored in image (reference out)
	* @param vz voxel size z stored in image (reference out)
	* @param tag image tag (reference out)
	* @return a pointer on the image data (that have been allocated by function)
	*/
thery's avatar
thery committed
127
	unsigned short* loadVal_16(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

	/**
	* Save 16bits val image 
	* Warning: the saved image contain w supplemntary bytes which store informations
	* Warning: origin of image is lower left
	* @param filename evident
	* @param data a pointer on the image data 
	* @param w width of image 
	* @param h height of image 
	* @param d depth of image 
	* @param vx voxel size x 
	* @param vy voxel size y 
	* @param vz voxel size z 
	* @param tag image tag  
	*/
thery's avatar
thery committed
143
	void saveVal_16(ILstring filename, unsigned short* data, int w, int h, int d, float vx, float vy, float vz, int tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
144
145
146
147
148
149
150
151
152
153
154
155
156
157

	/**
	* Load float value image 
	* Warning: the allocated data image contain w supplemntary bytes which store information
	* @param filename evident
	* @param w width of image (reference out)
	* @param h height of image (reference out)
	* @param d depth of image (reference out)
	* @param vx voxel size x stored in image (reference out)
	* @param vy voxel size y stored in image (reference out)
	* @param vz voxel size z stored in image (reference out)
	* @param tag image tag (reference out)
	* @return a pointer on the image data (that have been allocated by function)
	*/
thery's avatar
thery committed
158
	float* loadVal_float(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& id);
Pierre Kraemer's avatar
Pierre Kraemer committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173

	/**
	* Save float val image 
	* Warning: the saved image contain w supplemntary bytes which store informations
	* Warning: origin of image is lower left
	* @param filename evident
	* @param data a pointer on the image data 
	* @param w width of image 
	* @param h height of image 
	* @param d depth of image 
	* @param vx voxel size x 
	* @param vy voxel size y 
	* @param vz voxel size z 
	* @param tag image tag  
	*/
thery's avatar
thery committed
174
	void saveVal_float(ILstring filename, float* data, int w, int h, int d, float vx, float vy, float vz, int tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189


	/**
	* Load RGB 8 bits image 
	* Warning: the allocated data image contain w supplemntary bytes which store information
	* @param filename evident
	* @param w width of image (reference out)
	* @param h height of image (reference out)
	* @param d depth of image (reference out)
	* @param vx voxel size x stored in image (reference out)
	* @param vy voxel size y stored in image (reference out)
	* @param vz voxel size z stored in image (reference out)
	* @param tag image tag (reference out)
	* @return a pointer on the image data (that have been allocated by function)
	*/
thery's avatar
thery committed
190
	unsigned char* loadRGB(ILstring filename, int& w, int& h, int &d, float& vx, float& vy, float& vz, int& id);
Pierre Kraemer's avatar
Pierre Kraemer committed
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

	/**
	* Save RGB 8 bits image 
	* Warning: the saved image contain 3w supplemntary bytes which store informations
	* Warning: origin of image is lower left
	* @param filename evident
	* @param data a pointer on the image data 
	* @param w width of image 
	* @param h height of image 
	* @param d depth of image 
	* @param vx voxel size x 
	* @param vy voxel size y 
	* @param vz voxel size z 
	* @param tag image tag  
	*/
thery's avatar
thery committed
206
	void saveRGB(ILstring filename, unsigned char* data, int w, int h, int d, float vx, float vy, float vz, int tag);
Pierre Kraemer's avatar
Pierre Kraemer committed
207
208
209
210
211
212
213
214

} //namespace
} //namespace
} //namespace

#endif