Repository navigation
Expand file tree
/
Copy pathug06imageview.html
More file actions
executable file
·322 lines (287 loc) · 13.6 KB
/
Copy pathug06imageview.html
File metadata and controls
executable file
·322 lines (287 loc) · 13.6 KB
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php
$page_title = "HDFView User's Guide -- Image Viewer";
include ("../../../links.php");
include ("../../../includes/header.html");
?>
<link href="edit.css" rel="stylesheet" type="text/css" />
<p>
<a href="index.html">[Index]</a>
<a href="ug01introduction.html">[1]</a>
<a href="ug02start.html">[2]</a>
<a href="ug03objects.html">[3]</a>
<a href="ug04treeview.html">[4]</a>
<a href="ug05spreadsheet.html">[5]</a>
<a href="ug06imageview.html">[6]</a>
<a href="ug07textview.html">[7]</a></p>
<fieldset><h1>Chapter 6: Image Viewer</h1></fieldset>
<p>
Image Viewer is a graphical window that displays HDF images. HDFView is a simple image
viewer for HDF4/5 and has a limited function for processing an image.</p>
<p>
An HDF4 image is a raster image of 8-bit pixels with an indexed RGB color table,
or a 24-bit true color image. The HDF4 library provides image APIs to access image data
and color tables.</p>
<p>
An HDF5 image is a dataset that conforms to the
<a href="http://www.hdfgroup.org/HDF5/doc/ADGuide/ImageSpec.html">
HDF5 Image Specification</a>. HDFView supports two types of images: indexed
and true color. Both indexed image and true color image have predefined
attributes and data layout according to the HDF5 image specification.
For more details about HDF5 image, see the
<a href="http://www.hdfgroup.org/HDF5/doc/ADGuide/ImageSpec.html">
HDF5 Image Specification</a>.</p>
<ul class="ul">
<li class="li2"><a href="ug06imageview.html#ug06image">6.1 Display a 2-D or 3-D Image</a>
<ul class="ul">
<li><a href="ug06imageview.html#ug06image_indexed" >6.1.1 Indexed Image (8-Bit)</a></li>
<li><a href="ug06imageview.html#ug06image_true" >6.1.2 True Color Image</a></li>
</ul>
</li>
<li class="li2"><a href="ug06imageview.html#ug06zoom">6.2 Zoom/Flip/Contour Image</a></li>
<li class="li2"><a href="ug06imageview.html#ug06palette">6.3 View and Modify Image Palette/Values</a></li>
<li class="li2"><a href="ug06imageview.html#ug06histogram">6.4 Show Histogram of Pixel Values</a></li>
<li class="li2"><a href="ug06imageview.html#ug06import">6.5 Import JPEG, GIF, PNG, or BMP Image to HDF4/5</a></li>
<li class="li2"><a href="ug06imageview.html#ug06save">6.6 Save HDF Image to JPEG, GIF, PNG, or BMP File</a></li>
</ul>
<hr noshade size=1 />
<h2>
<a name="ug06image"></a>
6.1 Display a 2-D or 3-D Image</h2>
<p>
HDFView displays HDF4 raster images or HDF5 datasets that follow the HDF5
<a href="http://www.hdfgroup.org/HDF5/doc/ADGuide/ImageSpec.html">Image
and Palette Specification</a> for indexed images with an 8-bit standard
RGB color model palette or three-dimensional true color images.
Other image formats supported by the Image and Palette Specification are
not supported by this tool.</p>
<p>
If an image is larger than the visible area of the image viewer, users can grab and
move the image by mouse-drag. Users can also use the side scroller bar to move the
image to a desirable view area. Use Shift+Mouse-drag to select a subset of an
image in the image viewer.</p>
<p>
Fill values are displayed as the color black. Fill values are also excluded from
calculating the minimum, maximum and other statistics.</p>
<h3>
<a name="ug06image_indexed" id="ug06image_indexed"></a>6.1.1 Indexed Image (8-Bit) </h3>
<p>An indexed image is one of the following:</p>
<ul class="ul">
<li class="li2">An HDF4 RI8 image</li>
<li class="li2">An HDF5 dataset that conforms to the HDF5 Image specification, and is
an “IMAGE_SUBCLASS=IMAGE_INDEXED”</li>
<li class="li2">An SDS or HDF5 dataset with data that can be interpreted as an image </li>
</ul>
<p>The dataset is displayed as a Java image using IndexColorModel.
The dataset is converted to a raster image using
the first palette specified by the PALETTE attribute, or the default palette for
HDF4.
Multiple user-defined palettes (i.e., the PALETTE attribute may be a list) are
not supported in version 1.0.</p>
<p>The dataset of an indexed image holds the values of indices of the color look-up
table (palette). The dataset is converted into image pixels by looking up the index in the color
table. The following figure is an example of mapping dataset values into pixels.</p>
<center>
<p><img src="images/image_indexed_mapping.gif" />
<br /><b>Mapping of dataset values to image pixels</b></p></center>
<p>
For a two-dimensional indexed image, HDFView assumes that the width of the image is
the size of the second dimension and the height of the image is the size of the first dimension,
i.e. dim[0]=height and dim[1]=width.</p>
<p>Although HDFView displays the entire image by the order of (dim[0], dim[1],
dim[2])=(depth, height, width) by default, you can always change the order
and select a subset for the display as discussed in Chapter 5.</p>
<p>HDFView also displays a three-dimensional array as an array of 2-D images
arranged along the third dimension, i.e. dim[0]=depth, dim[1]=height and
dim[2]=width. You can flip back and forth to look at images at a different
position of the depth dimension. For instance, if the dataset is 20 x 400
x 600 (dim[0]=20, dim[1]=400, and dim[2]=600), HDFView will display it as
20 images each with the size of 600 x 400 (width is 600, height is 400).
However, a three-dimension image of [1][height][width] or [height][width][1]
is treated as a two-dimension indexed image of [height][width].</p>
<p>
A 2-D or 3-D SDS or HDF5 dataset with integer or float data can be displayed as
an indexed image using the “Open As” selection from the Object menu.
Since the dataset does not have a palette, a default palette is
used. The palette is chosen from the “Select Palette” menu in the
“Dataset Selection” window. The predefined palettes include:</p>
<ul class="ul">
<li class="li2">gray</li>
<li class="li2">rainbow</li>
<li class="li2">nature</li>
<li class="li2">wave</li>
</ul>
If no palette is selected, a gray scale will be used.
<p />
<strong>Converting non-byte data to byte data</strong>
<p />
Non-byte data will be converted to image byte data in one of the two algorithms:
simple linear conversion or auto gain conversion.
<p />
<dl>
<dt>Simple linear conversion</dt>
<dd> y = [(x - min)/(max-min)]*255.<br>
Where, <br>
x is the original value; <br>
y is the byte value.<br>
</dd>
<dt>Auto gain conversion</dt>
<dd> y = (x + bias) * gain. <br>
Where, <br>
x is the original value; <br>
y is the byte value;<br>
gain = MAX_VALUE / (max-min);<br>
bias = -min; <br>
MAX_VALUE is the max value of original data type, e.g. USHRT_MAX for unsigned short integers.<br>
</dd>
</dl>
<p />
Auto gain algorithm will be used only if Auto gain is selected from
“Tools” ==> “User Options”,
and the original dataset does not have any attached palette and you did not
selected any palette from “Open As” windows. Simple linear
conversion will be applied to all other cases. The image values will be
different and the image will look different if different algorithm is used.<p />
<h3>
<a name="ug06image_true" id="ug06image_true"></a>6.1.2 True Color Image </h3>
<p>
In the case of an image with more than one component per pixel (e.g., red,
green, and blue), the data may be arranged in one of two ways.
HDFView
only supports three color components: red, green and blue.</p>
<p>Following HDF4
terminology, the data may be interlaced by <i>pixel</i> or by <i>plane</i>.
For an HDF5 Image dataset the interlace should
be indicated by the INTERLACE_MODE attribute. In both cases, the dataset will
have a dataspace with three dimensions, <i>height</i>, <i>width</i>, and <i>components</i>.
For <i>pixel interlace</i>, the
data is arranged in the following order: [height][width][pixel components].
For <i>plane interlace</i>, the data is arranged in the following order: [pixel components][height][width].</p>
<p>
The translation from pixel values to color components for display or processing
purposes is a one-to-one correspondence of data values to components.
Data of RGB color components is converted into byte data, which is
packed into a single <i>int</i> pixel. The Java Image is created with a
DirectColorModel, with masks to define packed samples. This color model
is similar to an X11 TrueColor visual. The
default RGB ColorModel is specified with the following parameters:</p>
<pre>
Number of bits: 32
Red mask: 0x00ff0000
Green mask: 0x0000ff00
Blue mask: 0x000000ff
Alpha mask: 0xff000000
Color space: sRGB
isAlphaPremultiplied: False
Transparency: Transparency.TRANSLUCENT
transferType: DataBuffer.TYPE_INT
</pre>
<p>
The following figure shows examples of true color images. The image on the
left is pixel interleaving with dimensions of [149][227][3]. The image on the right
is plane interleaving with dimensions of [3][149][227].</p>
<center>
<p><img src="images/image_true_color.gif" />
<br /><b>True color image displayed in the Image View</b></p></center>
<h2>
<a name="ug06zoom"></a>6.2 Zoom/Flip/Contour Image</h2>
<p>
HDFView supports only limited image manipulation such as zooming, flipping, and
contour. You can zoom in and out of an image. The minimum zoom factor
is 1/8 (reduced to 1/8 the size) and the maximum is 8 (magnified to 8 times
the size). Reduction (zoom out) is done by sampling pixels, for example, a 1/2-size image is created by selecting every second pixel. Magnification (zoom
in) is done by replicating pixels.</p>
<p>
You can also flip an image horizontally or vertically. Flipping an image will
change the coordinates of the image.
This technique can be used to adjust images that may have been created with
different origins from the defaults.</p>
<p>
Manipulating the “contour” creates a contour plot of the pixel values.
The contour can have from three to nine contour levels. Level three
provides less details of contour and level nine provides more.
<b>Repeated contour operations show a <em>cumulative</em> effect of contouring.
For example, if you contour an image with level 3 and then contour that resulting image with
level 4, the final image shows the cumulative effect of applying a level 4
to the level 3–contoured image</b>.
<p>
The following figure shows a contour image of level 9.</p>
<center>
<p><img src="images/image_contour.gif" />
<br />
<b>Contour image (level 9)</b></p>
</center>
<h2>
<a name="ug06palette"></a>6.3 View and Modify Image Palette/Values</h2>
<p>
A palette (or color lookup table) is the means by which color is applied to an image.
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 the red, green,
and blue components that make up each color.</p>
<p>Although the HDF5 palette specification allows for variable color length,
different look-up methods, and color models beyond RGB, HDFView only supports
the indexed RGB color model of 256 colors. To view the image palette, click the palette icon on the
tool bar or select the palette command from the image menu.
The red, green, and blue components of the color table are plotted in a
line plot.</p>
<center>
<p><img src="images/image_palette.gif" />
<br /><b>Image palette (256 colors)</b></p></center>
<p>
To view the pixel values of each individual point, check the
“Show value” item in the “Image” menu. When
you move the mouse over the image, the pixel values
of the mouse point are shown at the bottom of the image.</p>
<p>
You can modify the values of the color table. Select the color (red, green, or blue)
in the palette view and drag the line of the selected color. The value of the selected color
changes as you move the color line. In the following figure, the image on the
left is the orginal image, and the image on the right is the image with a modified
color table.</p>
<center>
<p><img src="images/image_palette_modify.gif" />
<br /><b>Modified image palette (256 colors)</b></p></center>
<h2>
<a name="ug06histogram"></a>6.4 Show Histogram of Pixel Values</h2>
<p>
The frequency of pixel values of a selected area, or the whole image, can
be displayed in a histogram chart. The horizontal axis of the histogram
chart depicts the 256 pixel values. The vertical axis shows the frequency
of the pixel values.</p>
<center>
<p><img src="images/chart_histogram.gif" />
<br /><b>Histogram of pixel values</b></p></center>
<h2>
<a name="ug06import"></a>6.5 Import JPEG, GIF, PNG, or BMP Image to HDF4/5</h2>
<p>
Using HDFView, you can convert a JPEG, GIF, PNG, or BMP image into an
HDF4 or HDF5 image. Select the “Convert Image To” command in
the Tools menu, a popup window prompts you to choose the
image file that you want to convert. The image is converted into a 24-bit
HDF4 or HDF5 image. The current conversion does not support an image with
indexed color model or an image
with less than two color components. The image data is saved as an 8-bit unsigned
integer regardless of the data type of the original image.</p>
<h2>
<a name="ug06save"></a>6.6 Save HDF Image to JPEG, GIF, PNG, or BMP File</h2>
Using the “Save Image As” command in the “Image”
menu, you can save the current HDF image as a JPEG, GIF, PNG, or BMP file.
<!-- BEGIN OF FOOTER INFO -->
<hr noshade size=1 />
<p>
<a href="index.html">[Index]</a>
<a href="ug01introduction.html">[1]</a>
<a href="ug02start.html">[2]</a>
<a href="ug03objects.html">[3]</a>
<a href="ug04treeview.html">[4]</a>
<a href="ug05spreadsheet.html">[5]</a>
<a href="ug06imageview.html">[6]</a>
<a href="ug07textview.html">[7]</a></p>
<p>
<!-- END OF FOOTER INFO -->
<!--
<?php
include ("../../../includes/footer.html");
?>
-->