#image #sonar #science #tritech

glf

A Rust Library to read the GLF files produced by the Tritech Sonar

2 releases

0.2.1 Jun 10, 2024
0.2.0 Jun 10, 2024

#515 in Images

MIT/Apache

31KB
494 lines

glf

A rust crate for reading GLF Files from Tritech Sonar.

Documentation

Documentation is available at https://docs.rs/glf/0.2.0/glf/.

Building

To build this crate, run:

cargo build

Usage

use std::path::Path;
use glf::GLF;

let glf = GLF::new(Path::new("./pytritech_testdata/test_tritech.glf")).unwrap();
println!("GLF Image 0: {}", glf.images[0].header.time);
let img = glf.extract_image(1).unwrap();
img.save("test.png").unwrap();

Testing

To test the crate, you'll need to download a submodule that contains the test data. It's a little large and so isn't included in the basic install. To perform a full checkout of this repository you can run:

git clone --recurse-submodules https://github.com/onidaito/glf

Or, if you've already checked out

git submodule update --init --recursive

From then on, one can run the usual cargo command:

cargo test

lib.rs:

Overview

This crate provides a native rust implementation of the code required to read the Tritech GLF files.

This crate makes extensive use of the Rust Image crate, using the ImageBuffer<Luma<u8>, Vec<u8>> as it's main type for holding the image data.

Example usage

use std::path::Path;
use glf::GLF;

let glf = GLF::new(Path::new("./pytritech_testdata/test_tritech.glf")).unwrap();
println!("GLF Image 0: {}", glf.images[0].header.time);
let img = glf.extract_image(1).unwrap();
img.save("test.png").unwrap();

Dependencies

~12MB
~169K SLoC