Skip to content

Commit 7ad853c

Browse files
committed
Small cleanup
1 parent e38023b commit 7ad853c

1 file changed

Lines changed: 0 additions & 82 deletions

File tree

src/utils/slice_cache.rs

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5,88 +5,6 @@ use noisy_float::prelude::*;
55

66
use super::brain_volume;
77

8-
/*
9-
10-
/// Scale x and y relative so that the bigger one will be max_val.
11-
fn _scale_relative(x: u32, y: u32, max_val: u32) -> (u32, u32) {
12-
let (fx, fy, fmax_val) = (x as f32, y as f32, max_val as f32);
13-
14-
let fxy_max = std::cmp::max(x, y) as f32;
15-
16-
let out_x = std::cmp::min(((fx / fxy_max) * fmax_val) as u32, max_val);
17-
let out_y = std::cmp::min(((fy / fxy_max) * fmax_val) as u32, max_val);
18-
19-
return (out_x, out_y);
20-
}
21-
22-
fn fit_relative(src_x: u32, src_y: u32, dest_x: u32, dest_y: u32) -> (u32, u32) {
23-
let src_aspect = src_x as f32 / src_y as f32;
24-
let dest_aspect = dest_x as f32 / dest_y as f32;
25-
26-
let resize_factor = if src_aspect >= dest_aspect {
27-
dest_x as f32 / src_x as f32
28-
} else {
29-
dest_y as f32 / src_y as f32
30-
};
31-
32-
return (
33-
(src_x as f32 * resize_factor) as u32,
34-
(src_y as f32 * resize_factor) as u32,
35-
);
36-
}
37-
38-
fn _normalize_u8<D>(
39-
data: &ndarray::Array<f32, D>,
40-
intensity_range: (f32, f32),
41-
) -> ndarray::Array<u8, D>
42-
where
43-
D: ndarray::Dimension,
44-
{
45-
let (imin, imax) = intensity_range;
46-
return (((data - imin) / (imax - imin)) * (u8::MAX as f32))
47-
.mapv(|v| num::clamp(v, u8::MIN as f32, u8::MAX as f32) as u8);
48-
}
49-
50-
fn normalize_u16<D>(
51-
data: &ndarray::Array<f32, D>,
52-
intensity_range: (f32, f32),
53-
) -> ndarray::Array<u16, D>
54-
where
55-
D: ndarray::Dimension,
56-
{
57-
let (imin, imax) = intensity_range;
58-
return (((data - imin) / (imax - imin)) * (u16::MAX as f32))
59-
.mapv(|v| num::clamp(v, u16::MIN as f32, u16::MAX as f32) as u16);
60-
}
61-
62-
fn normalize_u16_f64<D>(
63-
data: &ndarray::Array<f64, D>,
64-
intensity_range: (f64, f64),
65-
) -> ndarray::Array<u16, D>
66-
where
67-
D: ndarray::Dimension,
68-
{
69-
let (imin, imax) = intensity_range;
70-
return (((data - imin) / (imax - imin)) * (u16::MAX as f64))
71-
.mapv(|v| num::clamp(v, u16::MIN as f64, u16::MAX as f64) as u16);
72-
}
73-
74-
fn make_image_gray<D>(data: ndarray::Array2<D>) -> image::ImageBuffer<Luma<D>, Vec<D>>
75-
where
76-
D: image::Primitive,
77-
{
78-
let width = data.shape()[0] as u32;
79-
let height = data.shape()[1] as u32;
80-
return image::ImageBuffer::<Luma<D>, Vec<D>>::from_raw(
81-
height,
82-
width,
83-
data.reversed_axes().into_raw_vec(),
84-
)
85-
.unwrap();
86-
}
87-
88-
*/
89-
908
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
919
pub struct CachableSlicerParams {
9210
pub axis: sampling::SliceAxis,

0 commit comments

Comments
 (0)