bioformats  5.1.8
TexelProperties.h
1 /*
2  * #%L
3  * OME-QTWIDGETS C++ library for display of Bio-Formats pixel data and metadata.
4  * Copyright © 2014 - 2016 Open Microscopy Environment:
5  * - Massachusetts Institute of Technology
6  * - National Institutes of Health
7  * - University of Dundee
8  * - Board of Regents of the University of Wisconsin-Madison
9  * - Glencoe Software, Inc.
10  * %%
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  * The views and conclusions contained in the software and documentation are
33  * those of the authors and should not be interpreted as representing official
34  * policies, either expressed or implied, of any organization.
35  * #L%
36  */
37 
38 #ifndef OME_QTWIDGETS_TEXELPROPERTIES_H
39 #define OME_QTWIDGETS_TEXELPROPERTIES_H
40 
41 #include <ome/bioformats/PixelProperties.h>
42 
43 #include <ome/xml/model/enums/PixelType.h>
44 
45 #include <QtGui/qopengl.h>
46 
47 namespace ome
48 {
49  namespace qtwidgets
50  {
51 
84  template<int>
86 
88  template<>
90  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::INT8>
91  {
93  static const GLenum internal_format = GL_R8;
95  static const GLenum external_format = GL_RED;
97  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::INT8;
99  static const GLint external_type = GL_BYTE;
101  static const bool conversion_required = false;
103  static const bool normalization_required = false;
105  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
107  static const GLint magnification_filter = GL_LINEAR;
108  };
109 
111  template<>
113  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::INT16>
114  {
116  static const GLenum internal_format = GL_R16;
118  static const GLenum external_format = GL_RED;
120  static const GLint external_type = GL_SHORT;
122  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::INT8;
124  static const bool conversion_required = false;
126  static const bool normalization_required = false;
128  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
130  static const GLint magnification_filter = GL_LINEAR;
131  };
132 
134  template<>
136  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::INT32>
137  {
139  static const GLenum internal_format = GL_R16;
141  static const GLenum external_format = GL_RED;
143  static const GLint external_type = GL_INT;
145  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::INT16;
147  static const bool conversion_required = false;
149  static const bool normalization_required = false;
151  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
153  static const GLint magnification_filter = GL_LINEAR;
154  };
155 
157  template<>
159  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::UINT8>
160  {
162  static const GLenum internal_format = GL_R8;
164  static const GLenum external_format = GL_RED;
166  static const GLint external_type = GL_UNSIGNED_BYTE;
168  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::UINT8;
170  static const bool conversion_required = false;
172  static const bool normalization_required = false;
174  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
176  static const GLint magnification_filter = GL_LINEAR;
177  };
178 
180  template<>
182  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::UINT16>
183  {
185  static const GLenum internal_format = GL_R16;
187  static const GLenum external_format = GL_RED;
189  static const GLint external_type = GL_UNSIGNED_SHORT;
191  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::UINT8;
193  static const bool conversion_required = false;
195  static const bool normalization_required = false;
197  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
199  static const GLint magnification_filter = GL_LINEAR;
200  };
201 
203  template<>
205  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::UINT32>
206  {
208  static const GLenum internal_format = GL_R16;
210  static const GLenum external_format = GL_RED;
212  static const GLint external_type = GL_UNSIGNED_INT;
214  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::UINT16;
216  static const bool conversion_required = false;
218  static const bool normalization_required = false;
220  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
222  static const GLint magnification_filter = GL_LINEAR;
223  };
224 
226  template<>
228  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::FLOAT>
229  {
231  static const GLenum internal_format = GL_R32F;
233  static const GLenum external_format = GL_RED;
235  static const GLint external_type = GL_FLOAT;
237  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::INT32;
239  static const bool conversion_required = false;
241  static const bool normalization_required = true;
243  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
245  static const GLint magnification_filter = GL_LINEAR;
246  };
247 
249  template<>
251  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLE>
252  {
254  static const GLenum internal_format = GL_R32F;
256  static const GLenum external_format = GL_RED;
258  static const GLint external_type = GL_DOUBLE;
260  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::FLOAT;
262  static const bool conversion_required = false;
264  static const bool normalization_required = true;
266  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
268  static const GLint magnification_filter = GL_LINEAR;
269  };
270 
272  template<>
274  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::BIT>
275  {
277  static const GLenum internal_format = GL_R8;
279  static const GLenum external_format = GL_RED;
281  static const GLint external_type = GL_UNSIGNED_BYTE;
283  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::BIT;
285  static const bool conversion_required = true;
287  static const bool normalization_required = false;
289  static const GLint minification_filter = GL_NEAREST_MIPMAP_LINEAR;
291  static const GLint magnification_filter = GL_NEAREST;
292  };
293 
295  template<>
297  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::COMPLEX>
298  {
300  static const GLenum internal_format = GL_RG32F;
302  static const GLenum external_format = GL_RG;
304  static const GLint external_type = GL_FLOAT;
306  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::COMPLEX;
308  static const bool conversion_required = false;
310  static const bool normalization_required = true;
312  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
314  static const GLint magnification_filter = GL_LINEAR;
315  };
316 
318  template<>
320  public ome::bioformats::PixelProperties< ::ome::xml::model::enums::PixelType::DOUBLECOMPLEX>
321  {
323  static const GLenum internal_format = GL_RG32F;
325  static const GLenum external_format = GL_RG;
327  static const GLint external_type = GL_DOUBLE;
329  static const ::ome::xml::model::enums::PixelType::enum_value fallback_pixeltype = ome::xml::model::enums::PixelType::COMPLEX;
331  static const bool conversion_required = false;
333  static const bool normalization_required = true;
335  static const GLint minification_filter = GL_LINEAR_MIPMAP_LINEAR;
337  static const GLint magnification_filter = GL_LINEAR;
338  };
339 
347  GLenum
349 
360  GLenum
361  textureInternalFormatFallback(GLenum format);
362 
370  GLenum
372 
380  GLint
382 
395 
405  bool
407 
421  bool
423 
430  GLint
432 
439  GLint
441 
442  }
443 }
444 
445 #endif // OME_QTWIDGETS_TEXELPROPERTIES_H
446 
447 /*
448  * Local Variables:
449  * mode:C++
450  * End:
451  */
uint32
Definition: PixelType.h:86
uint8
Definition: PixelType.h:82
bit
Definition: PixelType.h:90
GLint textureMagnificationFilter(::ome::xml::model::enums::PixelType pixeltype)
Get the default magnification filter.
Definition: TexelProperties.cpp:370
Map a given PixelPropertiesType enum to the corresponding language types.
Definition: PixelProperties.h:61
int8
Definition: PixelType.h:76
bool textureConversionRequired(::ome::xml::model::enums::PixelType pixeltype)
Check if type conversion is required.
Definition: TexelProperties.cpp:236
int16
Definition: PixelType.h:78
uint16
Definition: PixelType.h:84
GLint textureExternalType(::ome::xml::model::enums::PixelType pixeltype)
Get the default external (GL) type of a PixelType.
Definition: TexelProperties.cpp:146
float
Definition: PixelType.h:88
bool textureNormalizationRequired(::ome::xml::model::enums::PixelType pixeltype)
Check if normalization is required.
Definition: TexelProperties.cpp:281
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
GLenum textureInternalFormatFallback(GLenum format)
Get a fallback internal (GL) pixel format.
Definition: TexelProperties.cpp:418
complex
Definition: PixelType.h:94
double
Definition: PixelType.h:92
PixelType enumeration.
Definition: PixelType.h:69
GLint textureMinificationFilter(::ome::xml::model::enums::PixelType pixeltype)
Get the default minification filter.
Definition: TexelProperties.cpp:326
GLenum textureExternalFormat(::ome::xml::model::enums::PixelType pixeltype)
Get the default external (GL) pixel format of a PixelType.
Definition: TexelProperties.cpp:101
GLenum textureInternalFormat(::ome::xml::model::enums::PixelType pixeltype)
Get the default internal (GL) pixel format of a PixelType.
Definition: TexelProperties.cpp:56
int32
Definition: PixelType.h:80
Map a given PixelType enum to the corresponding GL texel definitions.
Definition: TexelProperties.h:85
double-complex
Definition: PixelType.h:96
::ome::xml::model::enums::PixelType texturePixelTypeFallback(::ome::xml::model::enums::PixelType pixeltype)
Get a fallback pixel type.
Definition: TexelProperties.cpp:191