summaryrefslogtreecommitdiffstats
path: root/doc/html/Palettes.html
blob: 106db61ff5ab0dc911ff5731e0361923a024d5d9 (plain)
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
48
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<html>
  <head>
    <title>Palettes</title>
  </head>

  <body bgcolor="#FFFFFF">


<hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
   <a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br>
   <a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;<br>
   <a href="index.html">Other HDF5 documents and links</a>&nbsp;<br>
   <!--
   <a href="Glossary.html">Glossary</a><br>
   -->
</td>
<td valign=top align=right>
   And in this document, the 
   <a href="H5.user.html"><strong>HDF5 User's Guide:</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;
      <br>
      <a href="Files.html">Files</a>&nbsp;&nbsp;
      <a href="Datasets.html">Datasets</a>&nbsp;&nbsp;
      <a href="Datatypes.html">Data Types</a>&nbsp;&nbsp;
      <a href="Dataspaces.html">Dataspaces</a>&nbsp;&nbsp;
      <a href="Groups.html">Groups</a>&nbsp;&nbsp;
      <br>
      <a href="References.html">References</a>&nbsp;&nbsp;
      <a href="Attributes.html">Attributes</a>&nbsp;&nbsp;
      <a href="Properties.html">Property Lists</a>&nbsp;&nbsp;
      <a href="Errors.html">Error Handling</a>&nbsp;&nbsp;
      <br>
      <a href="Filters.html">Filters</a>&nbsp;&nbsp;
      Palettes&nbsp;&nbsp;
      <a href="Caching.html">Caching</a>&nbsp;&nbsp;
      <a href="Chunking.html">Chunking</a>&nbsp;&nbsp;
      <a href="MountingFiles.html">Mounting Files</a>&nbsp;&nbsp;
      <br>
      <a href="Debugging.html">Debugging</a>&nbsp;&nbsp;
      <a href="Environment.html">Environment</a>&nbsp;&nbsp;
      <a href="ddl.html">DDL</a>&nbsp;&nbsp;
      <a href="Ragged.html">Ragged Arrays</a>&nbsp;&nbsp;
</td></tr>
</table>
</center>
<hr>




<H1>HDF5 Palette Specification </H1>

<P>This section is a work in progress page. Please send comments to <A 
href="mailto:davet@ncsa.uiuc.edu">davet@ncsa.uiuc.edu</A>. Anything and 
everything on this page may be changed. 

<P><B>Questions regarding this specification:</B> 
<UL>
  <LI>Currently, the range index is referred to as an attribute of the palette. 
  I'm wondering if it makes more sense for this to be an attribute of the 
  dataset... If a palette is to be shared by multiple data sets and each dataset 
  has it's own range index mapping, then maybe one would want the index range to 
  be an attribute of the palette. 
  <LI>Should the range index be separate from the palette, or it be incorporated 
  into a 4 column array? 
  <LI>Is this method of specifying attributes satisfactory (string name 
  identifier with corresponding value), or should they be specified as a struct 
  that is read in and written out? The number of attributes is currently at 5. 
  </LI></UL>
<HR>
<B>Changes made since last revision</B> 
<UL>
  <LI>What was previously called the FLOATRANGE index array has been changed to 
  the RANGEINDEX array, and can be of any type, <I>preferably</I> matching that 
  of the data set type. 
  <LI>A range value min/max attribute for the color numeric may be specified. 
  i.e. the red component value of an RGB will be between 0 and 1. 
  <LI>A dataset may specify an array of palettes that it may be used with now. 
  previously it was just one. 
  <LI>CMYK and YCbCr color models have been added. </LI></UL>
<HR>

<HR>

<HR>

<H2>HDF 5.0 Palette Overview: </H2>
<P>HDF 5.0 adds the following new features to what existed in earlier HDF 
versions: 
<P>
<UL>
  <LI>palettes of varying length. 
  <LI>definable arbitrary index range 
  <LI>definable color model type (RGB, YUV, HSV, CMY, etc.) 
  <LI>definable color numeric type </LI></UL>
<HR>

<P>A palette is the means by which color is applied to an image and is also 
referred to as a color lookup table. It is a table in which every row contains 
the numerical representation of a particular color. In the example of an 8-bit 
standard RGB color model palette, this numerical representation of a color is 
presented as a triplet specifying the intensity of red, green, and blue 
components that make up each color. 
<P>
<CENTER><IMG src="Palettes.fm.anc.gif"> </CENTER>
<P>In this example, the color component numeric type is an 8-bit unsigned 
integer. While this is most common and recommended for general use, other 
component color numeric data types, such as a 16-bit unsigned integer , may be 
used. This type is specified as the type attribute of the palette dataset. (see 
H5Tget_type(), H5Tset_type()) 
<P>The minimum and maximum values of the component color numeric are specified 
as attribute of the palette dataset. See below (attributes PAL_MINNUMERIC, 
PAL_MAXNUMERIC). If these attributes do not exist, it is assumed that the range 
of values will fill the space of the color numeric type. i.e. with an 8-bit 
unsigned integer, the valid range would be 0 to 255 for each color component. 
<P>The HDF 5.0 palette specification additionally allows for color models beyond 
RGB. YUV, HSV, CMY, CMYK, YCbCr color models are supported, and may be specified 
as a color model attribute of the palette dataset. <I>(see "Palette Attributes" 
for details)</I>. 
<P>In HDF 4 and earlier, palettes were limited to 256 colors. The HDF 5.0 
palette specification allows for palettes of varying length. The length is 
specified as the number of rows of the palette dataset. 
<P>In a standard palette, the color entries are indexed directly. HDF 5.0 
supports the notion of a range index table. Such a table defines an ascending 
ordered of ranges that map dataset values to the palette. If a range index table 
exists for the palette, the PAL_TYPE attribute will be set to "RANGEINDEX", and 
the PAL_RANGEINDEX attribute will contain an object reference to a range index 
table array. If not, the PAL_TYPE attribute either does not exist, or will be 
set to "STANDARD". 
<P>The range index table array consists of a one dimensional array with the same 
length as the palette dataset - 1. Ideally, the range index would be of the same 
type as the dataset it refers to, however this is not a requirement. 
<P><B>Example 2: A range index array of type floating point</B> 
<P>
<CENTER><IMG src="PaletteExample1.gif"> </CENTER>
<P>The range index array attribute defines the "<I>to</I>" of the range. Notice 
that the range index array attribute is one less entry in size than the palette. 
The first entry of 0.1259, specifies that all values below and up to 0.1259 
inclusive, will map to the first palette entry. The second entry signifies that 
all values greater than 0.1259 up to 0.3278 inclusive, will map to the second 
palette entry, etc. All value greater than the last range index array attribute 
(100000) map to the last entry in the palette. 
<P>
<HR>

<H2>Palette Attributes </H2>
<P>A palette exists in an HDF file as an independent data set with accompanying 
attributes. 
<P>These attributes are defined as follows: 
<DL>
  <DT>Attribute name="<B>CLASS</B>" 
  <DD>This attribute is of type H5T_STR_NULLTERM. 
  <DD>For all palettes, the value of this attribute is "PALETTE". This attribute 
  identifies this palette data set as a palette that conforms to the 
  specifications on this page. 
  <P></P>
  <DT>Attribute name="<B>PAL_COLORMODEL</B>" 
  <DD>This attribute is of type H5T_STR_NULLTERM. 
  <DD>Possible values for this are "RGB", "YUV", "CMY", "HSV". 
  <DD>This defines the color model that the entries in the palette data set 
  represent. 
  <DL>
    <DT>"RGB" 
    <DD>Each color index contains a triplet where the the first value defines 
    the red component, second defines the green component, and the third the 
    blue component. 
    <P></P>
    <DT>"CMY" 
    <DD>Each color index contains a triplet where the the first value defines 
    the cyan component, second defines the magenta component, and the third the 
    yellow component. 
    <P></P>
    <DT>"CMYK" 
    <DD>Each color index contains a quadruplet where the the first value defines 
    the cyan component, second defines the magenta component, the third the 
    yellow component, and the forth the black component. 
    <P></P>
    <DT>"YCbCr" 
    <DD>Class Y encoding model. Each color index contains a triplet where the 
    the first value defines the luminance, second defines the Cb Chromonance, 
    and the third the Cr Chromonance. 
    <P></P>
    <DT>"YUV" 
    <DD>Composite encoding color model. Each color index contains a triplet 
    where the the first value defines the luminance component, second defines 
    the chromonance component, and the third the value component. 
    <P></P>
    <DT>"HSV" 
    <DD>Each color index contains a triplet where the the first value defines 
    the hue component, second defines the saturation component, and the third 
    the value component. The hue component defines the hue spectrum with a low 
    value representing magenta/red progressing to a high value which would 
    represent blue/magenta, passing through yellow, green, cyan. A low value for 
    the saturation component means less color saturation than a high value. A 
    low value for <I>value</I> will be darker than a high value. </DD></DL>
  <P></P>
  <DT>Attribute name="<B>PAL_TYPE</B>" 
  <DD>This attribute is of type H5T_STR_NULLTERM <BR>The current supported 
  values for this attribute are : "STANDARD8" or "RANGEINDEX" 
  <P>A PAL_TYPE of "STANDARD8" defines a palette dataset such that the first 
  entry defines index 0, the second entry defines index 1, etc. up until the 
  length of the palette - 1. This assumes an image dataset with direct indexes 
  into the palette. 
  <P>If the PAL_TYPE is set to "RANGEINDEX", there will be an additional 
  attribute with a name of "<B>PAL_RANGEINDEX</B>", The <B>PAL_RANGEINDEX</B> 
  attribute contains an HDF object reference pointer which specifies a range 
  index array in the file to be used for color lookups for the palette. (See 
  example 2 for more details) 
  <P></P>
  <DT>Attribute name="<B>PAL_MINNUMERIC</B>" 
  <DT>Attribute name="<B>PAL_MAXNUMERIC</B>" 
  <DD>These two attributes are of the same type as the palette elements or color 
  numerics. <BR>They specify the minimum and maximum values of the color numeric 
  components. For example, if the palette was an RGB of type Float, the color 
  numeric range for Red, Green, and Blue could be set to be between 0.0 and 1.0. 
  The intensity of the color guns would then be scaled accordingly to be between 
  this minimum and maximum attribute. </DD></DL>
<P>
<HR>

<HR>

<H2>Specifying a Palette for a Dataset </H2>

A dataset within an HDF5 file may 
specify an array of palettes to be viewed with. The dataset will have an 
attribute field called "<B>PALETTE</B>" which contains an array of object 
reference pointers which refer to palettes in the file. The first palette in 
this array will be the default palette that the data may be viewed with. 



<hr>
<center>
<table border=0 width=98%>
<tr><td valign=top align=left>
   <a href="H5.intro.html">Introduction to HDF5</a>&nbsp;<br>
   <a href="RM_H5Front.html">HDF5 Reference Manual</a>&nbsp;<br>
   <a href="index.html">Other HDF5 documents and links</a>&nbsp;<br>
   <!--
   <a href="Glossary.html">Glossary</a><br>
   -->
</td>
<td valign=top align=right>
   And in this document, the 
   <a href="H5.user.html"><strong>HDF5 User's Guide:</strong></a>&nbsp;&nbsp;&nbsp;&nbsp;
      <br>
      <a href="Files.html">Files</a>&nbsp;&nbsp;
      <a href="Datasets.html">Datasets</a>&nbsp;&nbsp;
      <a href="Datatypes.html">Data Types</a>&nbsp;&nbsp;
      <a href="Dataspaces.html">Dataspaces</a>&nbsp;&nbsp;
      <a href="Groups.html">Groups</a>&nbsp;&nbsp;
      <br>
      <a href="References.html">References</a>&nbsp;&nbsp;
      <a href="Attributes.html">Attributes</a>&nbsp;&nbsp;
      <a href="Properties.html">Property Lists</a>&nbsp;&nbsp;
      <a href="Errors.html">Error Handling</a>&nbsp;&nbsp;
      <br>
      <a href="Filters.html">Filters</a>&nbsp;&nbsp;
      Palettes&nbsp;&nbsp;
      <a href="Caching.html">Caching</a>&nbsp;&nbsp;
      <a href="Chunking.html">Chunking</a>&nbsp;&nbsp;
      <a href="MountingFiles.html">Mounting Files</a>&nbsp;&nbsp;
      <br>
      <a href="Debugging.html">Debugging</a>&nbsp;&nbsp;
      <a href="Environment.html">Environment</a>&nbsp;&nbsp;
      <a href="ddl.html">DDL</a>&nbsp;&nbsp;
      <a href="Ragged.html">Ragged Arrays</a>&nbsp;&nbsp;
</td></tr>
</table>
</center>



<hr>
<address>
<a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a>
</address>

<!-- Created: Spring 1999 -->
<!-- hhmts start -->
Last modified:  23 July 1999
<!-- hhmts end -->

  </body>
</html>