[][src]Enum libblackbody::thermogram::Thermogram

pub enum Thermogram {
    Flir(FlirThermogram),
    Tiff(TiffThermogram),
}

The wrapper enum through which most processing of thermograms is recommend to happen. Use Thermogram::from_file() to read files.

The enum itself, and all thermogram formats it wraps, implement ThermogramTrait. Below several of its methods are listed. Consult the documentation of ThermogramTrait for more details.

pub trait ThermogramTrait {
    fn thermal(&self) -> &Array<f32, Ix2>;  // Extract the thermal data
    fn optical(&self) -> &Array<u8, Ix3>>;  // Extract embedded photos, if present
    fn identifier(&self) -> &str;  // A uniquely identifying string for this thermogram
    fn render(&self min_temp: f32, max_temp: f32, palette: [[f32; 3]; 256]) -> Array<u8, Ix3>;  // Thermal data render using the given palette
    fn render_defaults(&self) -> Array<u8, Ix3>;  // Thermal data rendered using the minimum and maximum thermal value and the `palette::TURBO` palette.
    fn thermal_shape(&self) -> [usize; 2];  // The [height, width] of the thermal data
    fn normalized_minmax(&self) -> Array<f32, Ix2>;  // Thermal data normalized to lie in the range 0.0..=1.0
}

Variants

Implementations

impl Thermogram[src]

pub fn from_file(path: &Path) -> Option<Self>[src]

Tries to recognize the file type based on its magic number and return a Thermogram.

Arguments

  • path - A path to a thermogram file.

Returns

In case of success an Some<Thermogram>, otherwise None. A Thermogam implements ThermogramTrait, forwarding them to the wrapped struct.

Examples

let file_path = "/home/user/FLIR0123.jpg";
let r_thermogram = Thermogram::from_file(&file_path);
match r_thermogram {
    None => println!("Failed opening thermogram {:?}", file_path),
    Some(thermogram) => {
        println!("Successfully opened thermogram {:?}", file_path);
        // Do something with `thermogram`
        // ...
    },
}

Trait Implementations

impl Clone for Thermogram[src]

impl Debug for Thermogram[src]

impl ThermogramTrait for Thermogram[src]

The ThermogramTrait implemented for the Thermogram enum. Method calls are forwarded to the specific format wrapped by the enum. Consult the trait for documentation on the supported methods.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.