openslide_rs/properties/
mod.rs1pub mod aperio;
5pub mod dicom;
6pub mod hamamatsu;
7pub mod leica;
8pub mod mirax;
9pub mod openslide;
10pub mod philips;
11pub mod sakura;
12pub mod tiff;
13pub mod trestle;
14pub mod ventana;
15
16use crate::properties::{
17 aperio::Aperio, dicom::Dicom, hamamatsu::Hamamatsu, leica::Leica, mirax::Mirax,
18 openslide::OpenSlide, philips::Philips, sakura::Sakura, tiff::Tiff, trestle::Trestle,
19 ventana::Ventana,
20};
21
22#[derive(Clone, Debug)]
23pub enum VendorProperties {
24 GenericTiff,
25 Aperio(Aperio),
26 Hamamatsu(Hamamatsu),
27 Leica(Leica),
28 Mirax(Mirax),
29 Trestle(Trestle),
30 Ventana(Ventana),
31 Sakura(Sakura),
32 Philips(Philips),
33 Dicom(Dicom),
34 None,
35}
36
37#[derive(Clone, Debug)]
39pub struct Properties {
40 pub openslide_properties: OpenSlide,
41 pub tiff_properties: Tiff,
42 pub vendor_properties: VendorProperties,
43}
44
45impl Properties {
46 pub fn new(property_iter: impl Iterator<Item = (String, String)> + Clone) -> Self {
47 let openslide_properties = OpenSlide::new(property_iter.clone());
48 let tiff_properties = Tiff::new(property_iter.clone());
49
50 let vendor = &openslide_properties.vendor.clone().unwrap_or_default();
51
52 let vendor_properties = match vendor.to_lowercase().as_str() {
53 "generic-tiff" => VendorProperties::GenericTiff,
54 "aperio" => VendorProperties::Aperio(Aperio::new(property_iter)),
55 "hamamatsu" => VendorProperties::Hamamatsu(Hamamatsu::new(property_iter)),
56 "leica" => VendorProperties::Leica(Leica::new(property_iter)),
57 "mirax" => VendorProperties::Mirax(Mirax::new(property_iter)),
58 "trestle" => VendorProperties::Trestle(Trestle::new(property_iter)),
59 "ventana" => VendorProperties::Ventana(Ventana::new(property_iter)),
60 "sakura" => VendorProperties::Sakura(Sakura::new(property_iter)),
61 "philips" => VendorProperties::Philips(Philips::new(property_iter)),
62 "dicom" => VendorProperties::Dicom(Dicom::new(property_iter)),
63 _ => VendorProperties::None,
64 };
65 Properties {
66 openslide_properties,
67 tiff_properties,
68 vendor_properties,
69 }
70 }
71}