(Byte) Data - Virginia View

advertisement
Lab 1 – Create the Imagine Data (file) from Binary (Byte) Data
Introduction
Image data are in binary format, and are stored as continuous 1-D array in a computer. You just can not
open the files using the WordPad. If you did, you would get weird items on your screen; first you may have to wait
for a while and then you may see some weird symbols. To the extreme, your compute may become “Not
Responding”, and you may have to re-boot the computer. The bottom line, you need to import into a particular
format that will be understood by your s/w. To use them by an image processing and GIS s/w such as the Imagine,
one needs to convert the continuous 1-D array data into a 2-D image. Depending on how and where you get/order
the data, and what format your data is and whether your s/w can read the data directly. In general, the s/w you have
may include the known formats. However, if you only have an old version of a s/w that does not understand or
support the formats of the data you want to analyze. Then, you may have to go back to the basis by figuring out the
data type (one byte, two bytes, floating, etc), and image dimensions (# of lines or rows, and # of columns or
samples). For data of a single band, once we know the image size (# of rows by # of columns), we can easily
transfer the 1-D array data into a 2-D image. For a multi-band data, we need to know the # of bands and images size.
Each band may be stored in a separate file. In this lab, we will import binary data of three Landsat 7 bands into the
Imagine by using the # of rows, # of columns, and # of bands, as well as other metadata as an example. (Doing the
hard way.) Also, if we were importing all 8 bands of the Landsat 7 data, we would spend a lot time to wait for the
processes to finish. The data to be imported were acquired on the 28 th of July 1999 and covered part of eastern North
Carolina. Since data of each band is in separate file, they can be considered as a band sequential (BSQ) format. After
we import the three-band data correctly into the Image s/w, we need to add accessory information or metadata such
as pixel resolution, project, coordinates, etc. to the imported image so that one can analyze them easily. Then, we
will import a dataset with a format that is accepted or understood by the s/w.
Part 1, Importing three-band Landsat TM data (bands 1, 2, and 3)
i)
Start the program.
Click on the "Manage Data/Import Data" to open "Import" dialog box (Fig. 1) and navigate to where the
binary data are stored. You need to decide where to store/write/output the imported image. (Navigating yourself to
your flush drive would be an option for saving the imported file.) Make the selections as indicated (Fig. 1), and
Click on the “OK” to proceed, which opens the "Import Generic Binary Data" dialog box (Fig. 2). Set the “Data
Format” as the BSQ, “Data Type” as the Unsigned 8 Bit, “# Rows" as 6991, "# Columns" as 7821, and "# Bands as
3".
The
data
type,
#
of
rows
and
#
of
columns
come
from
the
data’s
metadata
file,
“l71015036_03619990728_mtl.l1g”. Answer question 1.
1
Fig. 1.
Fig. 2.
ii) Then, click on the “Bands in Multiple Files” to open the “BSQ Band Files” dialog box (Fig. 3); now we will
add the rest two bands:
i)
Click
on
the
up
arrow
to
change
the
“Band
#”
into
“2”,
select
the
2 nd
band
file
“l71015036_03619990728_b20.l1g”, and then click on the “Set”; band 2 has been added for importing
(Fig. 3). (You may need to navigate to the folder where the data are stored.)
ii) Click
on
the
up
arrow
to
change
the
“Band
#”
into
“3”,
select
the
3 rd
band
file
“l71015036_03619990728_b30.l1g”, and then click on the “Set”; band 3 has been added for importing
(Fig. 3).
iii) The filename, 1st two letters l7 – Landsat 7, skip next number, “1” (I am not sure what stands for), next
three digits 015 – path number identifier, next three digits 036 – row number identifier, next three digits
036 – row number identifier again, next 8 digits 19990728 – year, month, and day, next letter b – band,
next digit – band number. Make sure the order of your imported image is b10, b20, and b30 as shown
(Fig. 3).
iv) Click on the “OK” to close the “BSQ Band Files” dialog box to finish (Fig. 3).
iii) Click on the “OK” to close the “Import Generic Binary Data” dialog box (Fig. 2), and to start the import.
2
Fig. 3, three pairs of black arrows on the right point to order of bands 1, 2, and 3.
View the imported image
In an opened a viewer window, right-click/Open Raster Layer … to open the dialog box of “Select Layer
To Add”, and navigate to the folder where the imported file stored. Then double-click; the file should be loaded
inside the viewer window. The image imported is of 6991 rows and 7821 columns. Thus, depending on the size of
your viewer window, you may have a black viewer-window when you display the imported image. Zoom-out if you
want to view the entire image. If you have imported the data correctly, you should see the zoom-out Landsat-7 TM
image of eastern North Carolina. Otherwise, you need to re-import the data until it is the right image.
Add the accessory information to the imported image
Once the image has been successfully imported, you need to add the accessory information for future use
and analysis of the image. Let’s add the information. In a viewer window where your imported image is displayed,
click on the “i, Layer Info/View/Edit Image Metadata” to open the “ImageInfo” dialog box (Fig. 4).
Click on the “Edit/Change Map Model…” to open its dialog box. The information needed to make the
changes is stored in the text file, “l71015036_03619990728_mtl.l1g”. Use the Wordpad program to open the file.
Scroll
down
to
find
the
information
(number)
to
fill
in
fields
of
“Upper
Left
X”
or
PRODUCT_UL_CORNER_MAPX in the metadata file, “Upper Left Y” or PRODUCT_UL_CORNER_MAPY in
the metadata file, “Pixel Size X” or GRID_CELL_SIZE_REF, and “Pixel Size Y” or GRID_CELL_SIZE_REF.
(Here the pixel size X and pixel size Y are the same.) After updating them, click on the “Projection” and select the
“UTM” from the list, and also set the “Units” as “Meters”, and finally click on the “OK” to finish.
Next, you need to add the project information. Click on the “Edit/Add/Change Projection…” to open its
dialog box. Again, find the information to fill in fields of “Spheroid Name” or REFERENCE_ELLIPSOID, “Datum
Name” or REFERENCE_DATUM, “UTM Zone” or ZONE_NUMBER, “NORTH”, and click on the “OK” to
finish. Right now, the “ImageInfo” dialog box should have all needed accessory information (Fig. 4).
Since you have named the output file, l71015036_03619990728_b10.img in the folder you have been
working on, and you have finished all the steps up to this point, the required output file, i.e.,
l71015036_03619990728_b10.img has been created. Thus, you can exit the Imagine s/w and under the
MS/Windows environment copy and paste the file onto your flush drive.
3
Fig. 4.
Part 2, Importing the ALOS PRISM data
The format of the PRISM data is understood by the current version of s/w. (s/w version earlier than 9.2
DOES not understand this format. That is why as data users, we need to learn how to “reinvent the wheel” by handle
the data using the Generic Binary format, as we have gone through in the first part of this lab in case when the data
format is not understood by the s/w.) Under folder part2, there are four files, IMG-*, the image data file, LED-*, the
leader file of this volume, TRL-*, the trailer file of this volume, and Vol-*, the volume file of this volume. (* stands
for all characters of the file names after the “-”.) All four files consist of this data format; you need generally all files
in order for the s/w to read the data correctly. Fig. 5 shows
how to import the PRISM data into Image s/w. Because the
format is understood by the s/w, the s/w can not only import
the data, but also import the metadata directly. The PRISM
were acquired on 10/31/2007 and cover eastern North
Carolina. Open a viewer window and view the imported
Fig., 5. The dialog box to import the PRISM data.
image. To view the imported metadata, you can click on the
“i/View/Edit Image Metadata” to open the image info
dialog box.
Questions
1.
(1 point) There are 6991 rows (lines) and 7821 columns (samples) of one band image. Each pixel of a band is
one byte. How many bytes is the one band image? (Hint: Under MS/Window environment or folder where you
can see the files, right-click on the icon of a file to open the pop-up list, select the “Properties”. On the right side
of “Size”, the file size in bytes is shown within the parenthesis.) There are three individual bands of original
data. What is the total number of bytes of three bands together?
2.
(4 points) Correctly imported Landsat 7 and PRISM images. Each image will be 2 points.
4
Acknowledgment
This lab handout was supported by an AmericaView grant to the East Carolina University at Greenville,
North Carolina, 27858, USA. The LED-ALPSMN094172885-O1B2G_UN© was granted by the Japan Aerospace
Exploration Agency (JAXA) to the East Carolina University.
5
Download