|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfilecontroller.ReadImageFile
public class ReadImageFile
The ReadImageFile -class reads Portable GreyMap (PGM) images from Finnish Meteorological Institute's (FMI) radar, and converts them to form this program uses. The actual data is in polar coordinates, which is converted into PGM-images. In other words, one line represent here measurements from a specific direction. Measurements are calculated at intervals of 500 meters, and the furthest measure is as far as 250km. This means 500 measurement on one line. The single measurement is represented as a value between 0-254. Value 255 is a special case, it means that there is no measurement at this certain point. We convert the value x from PGM image to dBZ scale by formula: Z[dBZ] = 0.5 * x - 32 PGM files contains also a header part in the beginning of file, which is read and pulled apart before the actual data. Header could look like this: ---- P5 # SITE=VAN # DATA=Z # TASK=1 # SUBTASKS=6 # SWEEPS=3 # AZIMUTS=360 # TASKNAME=PPI1_F # VOLUMETIME=200802181130 # TASKTIME=20080218113035 # SWEEPTIMES=20080218113335 20080218113352 20080218113414 # RUNNINGTIMES=2 9 10 # ELEVATIONS=15.0 25.0 45.1 # BINS=108 66 40 # BINARYELEVATIONS=2731 4551 8192 # STARTAZIMUTS=360.2 360.2 360.2 # CALIPREFLS=-41.06 240 1080 ---- Most important values are ELEVATIONS and BINS, and the last line where is defined the width and height values of raw image. Note that we may have to render up to six PGM-images from different elevations into one weather -image.
Field Summary | |
---|---|
private java.awt.Color |
colorOfCornerArea
Background color of corner area in weather -image. |
private java.awt.Color |
colorOfRadarArea
Background color of radar area in weather -image. |
private int[] |
colorPalette
Array of integer RGB colors. |
private int |
currentRadarPic
Latest composed image. |
private java.lang.String |
dataDir
Directory for PGM-images. |
private double[] |
elevations
Elevations counter. |
private java.lang.String |
errorMessage
Latest error message. |
private int |
filterWhiteNoise
This value is used when removing noise from radar-image. |
private java.awt.image.BufferedImage |
mapImage
Current Weather image. |
private int[][] |
mapMatrix
Weather information in numeric array. |
private java.awt.image.BufferedImage |
offScreenImage
Working area for Java 2D. |
private int |
originX
X -coordinate of origin. |
private int |
originY
Y -coordinate of origin. |
private Parameters |
parameters
Current instance of Parameter class. |
private int |
pictureHeight
Weather image height. |
private int |
pictureWidth
Weather image width. |
private int[] |
radarBins
Measurements in current image. |
private int[] |
radarImageSize
Size of current PGM -image. |
private int |
radarPics
Latest composed image. |
private double[] |
radarStartAzimuts
Start direction between 0-360. |
private int |
renderMapHeight
Render height. |
private int |
renderMapWidth
Render width. |
private java.lang.Boolean |
status
Status reveal if constructor or rendering fails. |
private int |
stormSensitivity
Boundary of storm on dBZ-scale. |
private java.util.ArrayList<java.lang.String> |
weatherFiles
List of images. |
private int |
weatherFilesPointer
Pointer to current row. |
Constructor Summary | |
---|---|
ReadImageFile(Parameters parameters)
Constructor of this class. |
Method Summary | |
---|---|
java.lang.String |
getErrorMessage()
Returns latest error message. |
java.awt.image.BufferedImage |
getMap()
Returns rendered weather data in bufferedImage -format. |
int[][] |
getMapMatrix()
Returns rendered weather data in integer matrix. |
private java.lang.String |
getPictureName()
This method returns path and name of the next PGM-image in order. |
private int[] |
getPrintColorPalette()
This method initialize a color palette, which is used when rendering storms from weather data into BufferedImage-object. |
boolean |
getStatus()
Returns a current status of this instance. |
private boolean |
loadList(java.lang.String filename)
Load user's weather data-list from file. |
private boolean |
loadPicture()
Method renders a set of PGM-images to one weather scenario. |
private int[][] |
noiseFilter(int[][] temporaryMap)
This method filters extra noise off from weather map. |
private boolean |
recognizeHeaderLine(java.lang.String headerLine,
int headerNumber)
Method tries to recognize PGM picture's current header line, and set the value of the header into program's data structure. |
private boolean |
renderWeathermapToBufferedImage()
This method converts the weather data from integer matrix into bufferedImage. |
boolean |
update()
Method renders next PGM -images from user's list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.awt.Color colorOfCornerArea
private java.awt.Color colorOfRadarArea
private int[] colorPalette
private int currentRadarPic
private java.lang.String dataDir
private double[] elevations
private java.lang.String errorMessage
private int filterWhiteNoise
private java.awt.image.BufferedImage mapImage
private int[][] mapMatrix
private java.awt.image.BufferedImage offScreenImage
private int originX
private int originY
private Parameters parameters
private int pictureHeight
private int pictureWidth
private int[] radarBins
private int[] radarImageSize
private int radarPics
private double[] radarStartAzimuts
private int renderMapHeight
private int renderMapWidth
private java.lang.Boolean status
private int stormSensitivity
private java.util.ArrayList<java.lang.String> weatherFiles
private int weatherFilesPointer
Constructor Detail |
---|
public ReadImageFile(Parameters parameters)
parameters
- Current parameter -class.Method Detail |
---|
public java.lang.String getErrorMessage()
public java.awt.image.BufferedImage getMap()
public int[][] getMapMatrix()
private java.lang.String getPictureName()
private int[] getPrintColorPalette()
public boolean getStatus()
private boolean loadList(java.lang.String filename)
filename
- Name of user list, this comes from Parameter -class.
private boolean loadPicture()
private int[][] noiseFilter(int[][] temporaryMap)
temporaryMap
- matrix
private boolean recognizeHeaderLine(java.lang.String headerLine, int headerNumber)
headerLine
- Current line.headerNumber
- Number of line.
private boolean renderWeathermapToBufferedImage()
public boolean update()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |