1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
mod openslide;
mod tiff;
mod aperio;
use std::collections::HashMap;
use self::openslide::LevelProperties;
#[derive(Clone, Debug)]
pub struct Properties {
openslide_properties: openslide::OpenSlide,
tiff_properties: tiff::Tiff,
aperio_properties: aperio::Aperio,
}
impl Properties {
pub fn new(property_map: &HashMap<String, String>) -> Self {
let mut tiff_properties = tiff::Tiff::default();
let mut openslide_properties = openslide::OpenSlide::new(property_map);
let mut aperio_properties = aperio::Aperio::default();
for (key, value) in property_map {
let parent = key.split('.').nth(0);
match parent {
Some("openslide") => openslide_properties.parse_property_name(key, value),
Some("tiff") => tiff_properties.parse_property_name(key, value),
Some("aperio") => aperio_properties.parse_property_name(key, value),
_ => println!("Could not parse {}", key),
}
}
Properties {
tiff_properties: tiff_properties,
openslide_properties: openslide_properties,
aperio_properties: aperio_properties,
}
}
pub fn print_available(&self) {
self.openslide_properties.print_available();
self.tiff_properties.print_available();
self.aperio_properties.print_available();
}
pub fn vendor(&self) -> Option<String> {
self.openslide_properties.vendor.clone()
}
pub fn quickhash_1(&self) -> Option<String> {
self.openslide_properties.quickhash_1.clone()
}
pub fn mpp_x(&self) -> Option<f32> {
self.openslide_properties.mpp_x
}
pub fn mpp_y(&self) -> Option<f32> {
self.openslide_properties.mpp_y
}
pub fn objective_power(&self) -> Option<u32> {
self.openslide_properties.objective_power
}
pub fn comment(&self) -> Option<String> {
self.openslide_properties.comment.clone()
}
pub fn level_count(&self) -> Option<u32> {
self.openslide_properties.level_count
}
pub fn levels(&self) -> Option<Vec<LevelProperties>> {
self.openslide_properties.levels.clone()
}
pub fn image_description(&self) -> Option<String> {
self.tiff_properties.image_description.clone()
}
pub fn software(&self) -> Option<String> {
self.tiff_properties.software.clone()
}
pub fn model(&self) -> Option<String> {
self.tiff_properties.model.clone()
}
pub fn date_time(&self) -> Option<String> {
self.tiff_properties.date_time.clone()
}
pub fn make(&self) -> Option<String> {
self.tiff_properties.make.clone()
}
pub fn x_resolution(&self) -> Option<f32> {
self.tiff_properties.x_resolution
}
pub fn y_resolution(&self) -> Option<f32> {
self.tiff_properties.y_resolution
}
pub fn resolution_unit(&self) -> Option<String> {
self.tiff_properties.resolution_unit.clone()
}
pub fn filename(&self) -> Option<String> {
self.aperio_properties.filename.clone()
}
pub fn image_id(&self) -> Option<String> {
self.aperio_properties.image_id.clone()
}
pub fn scan_scope_id(&self) -> Option<String> {
self.aperio_properties.scan_scope_id.clone()
}
pub fn date(&self) -> Option<String> {
self.aperio_properties.date.clone()
}
pub fn time(&self) -> Option<String> {
self.aperio_properties.time.clone()
}
pub fn user(&self) -> Option<String> {
self.aperio_properties.user.clone()
}
pub fn icc_profile(&self) -> Option<String> {
self.aperio_properties.icc_profile.clone()
}
pub fn parmset(&self) -> Option<String> {
self.aperio_properties.parmset.clone()
}
pub fn original_height(&self) -> Option<u32> {
self.aperio_properties.original_height
}
pub fn original_width(&self) -> Option<u32> {
self.aperio_properties.original_height
}
pub fn top(&self) -> Option<f32> {
self.aperio_properties.top
}
pub fn left(&self) -> Option<f32> {
self.aperio_properties.left
}
pub fn mpp(&self) -> Option<f32> {
self.aperio_properties.mpp
}
pub fn line_camera_skew(&self) -> Option<f32> {
self.aperio_properties.line_camera_skew
}
pub fn line_area_x_offset(&self) -> Option<f32> {
self.aperio_properties.line_area_x_offset
}
pub fn line_area_y_offset(&self) -> Option<f32> {
self.aperio_properties.line_area_y_offset
}
pub fn focus_offset(&self) -> Option<f32> {
self.aperio_properties.focus_offset
}
pub fn app_mag(&self) -> Option<u32> {
self.aperio_properties.app_mag
}
pub fn stripe_width(&self) -> Option<u32> {
self.aperio_properties.stripe_width
}
pub fn filtered(&self) -> Option<u32> {
self.aperio_properties.filtered
}
}