Package tritechgemini.imagedata
Interface SonarImageRecordI
- All Superinterfaces:
Cloneable,Serializable,SonarRecordI
- All Known Implementing Classes:
ARISImageRecord,ECDImageRecord,GeminiImageRecord,GLFImageRecord
Base interface for sonar image records from all manufacturers.
All manufacturers so far have the same basic data in each image which consists of a bearing table, and a big array of amplitudes vs bearing and range.
Tritech and ARIS both use one byte unsigned data. To keep memory usage low, this is read in as a Java byte array. Note that Java does not do unsigned bytes, so large amplitude values come out negative. Users should therefore use the getShortImageData() function to access the image as int16 data.
The byte[] getImageData() function remains public, but if future support for other manufactures, which perhaps have >1 byte data requires it, this will have to go private, or even disappear, leaving only the generic short[] function.
All manufacturers so far have the same basic data in each image which consists of a bearing table, and a big array of amplitudes vs bearing and range.
Tritech and ARIS both use one byte unsigned data. To keep memory usage low, this is read in as a Java byte array. Note that Java does not do unsigned bytes, so large amplitude values come out negative. Users should therefore use the getShortImageData() function to access the image as int16 data.
The byte[] getImageData() function remains public, but if future support for other manufactures, which perhaps have >1 byte data requires it, this will have to go private, or even disappear, leaving only the generic short[] function.
-
Method Summary
Modifier and TypeMethodDescriptionclone()Clone in interface which is properly overridden in inherited classesvoidFree the data to save memory.intgetBearingIndex(double bearing) Get the index from the bearing table of the bearing closest to the given bearing.double[]intgetChirp()Get if chirp was on 0 off, 1 on, -1 unknownGet storage for echogram lines.Path to the image fileintgetGain()byte[]Get image data array.longGet the record load time in nanoseconds.doubleintgetnBeam()intintgetRangeIndex(double range) Get the index of the range bin closest to the given rangeintshort[]Get the decompressed image data in an array of shorts this allows correction of problems caused by Java not understanding unsigned values, so what should be large values (>=128) are negative.intGeneric type of sonar
Imager = 0
Profiler = 1doublegetSoS()Get the speed of sound in m/sbooleanIs record fully loaded ?voidsetImageData(byte[] imageData) Set the image data.voidsetLoadTime(long nanos) Record how long it took to load the record in nanoseconds.voidsetRecordNumber(int recordNumber) Set the record numberMethods inherited from interface tritechgemini.imagedata.SonarRecordI
getDeviceId, getRecordTime, getSonarIndex, getSonarPlatform
-
Method Details
-
getImageData
byte[] getImageData()Get image data array. This is a one dimensional array of all data, that goes across bearings, then range. Needs reshaping to create a 2D array.
Be very careful if you use the output of this function since data will be unsigned byte, so you need to use the Byte.toUnsignedInt(byte x) function to get an unsigned value. For most purposes, you're better off getting the short[] array, which will have already been converted.- Returns:
- image data in a single array
-
setImageData
void setImageData(byte[] imageData) Set the image data.- Parameters:
imageDataMust- be an array of getnBeam() x getnRange()
-
getShortImageData
short[] getShortImageData()Get the decompressed image data in an array of shorts this allows correction of problems caused by Java not understanding unsigned values, so what should be large values (>=128) are negative.
This will return an array of values between 0 and 255- Returns:
- Decompressed raw data in short format.
-
getBearingTable
double[] getBearingTable()- Returns:
- List of beam angles in radians.
-
getnRange
int getnRange()- Returns:
- The number of range bins
-
getMaxRange
double getMaxRange()- Returns:
- The maximum range for this frame in metres.
-
getnBeam
int getnBeam()- Returns:
- the total number of beams
-
getFilePath
String getFilePath()Path to the image file- Returns:
- path name of file
-
getRecordNumber
int getRecordNumber()- Returns:
- Record number in file (zero indexed)
-
setRecordNumber
void setRecordNumber(int recordNumber) Set the record number- Parameters:
recordNumber-
-
getSonarType
int getSonarType()Generic type of sonar
Imager = 0
Profiler = 1- Returns:
- The type of sonar
-
getSoS
double getSoS()Get the speed of sound in m/s- Returns:
- speed of sound
-
getChirp
int getChirp()Get if chirp was on 0 off, 1 on, -1 unknown- Returns:
- true if chirp mode
-
getGain
int getGain()- Returns:
- the gain for that frame
-
isFullyLoaded
boolean isFullyLoaded()Is record fully loaded ?- Returns:
- true if record is fully loaded.
-
freeImageData
void freeImageData()Free the data to save memory. -
setLoadTime
void setLoadTime(long nanos) Record how long it took to load the record in nanoseconds.- Parameters:
load- time in nanoseconds.
-
getLoadTime
long getLoadTime()Get the record load time in nanoseconds.- Returns:
-
clone
SonarImageRecordI clone()Clone in interface which is properly overridden in inherited classes- Returns:
- cloned record.
-
getBearingIndex
int getBearingIndex(double bearing) Get the index from the bearing table of the bearing closest to the given bearing.- Parameters:
bearing- in radians- Returns:
- index of closest bearing.
-
getRangeIndex
int getRangeIndex(double range) Get the index of the range bin closest to the given range- Parameters:
range- range in metres- Returns:
- index of closest range bin.
-
getEchoLineStore
EchoLineStore getEchoLineStore()Get storage for echogram lines.- Returns:
-