Skip to content

Commit

Permalink
Merge pull request #601 from dougyau/voi-lut-single-frame
Browse files Browse the repository at this point in the history
Use the voi function, window and rescale of the decoded frame
  • Loading branch information
Enet4 authored Dec 7, 2024
2 parents c4f57c7 + 89b798f commit e7b2ac3
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions pixeldata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2155,12 +2155,37 @@ where
.fail()?;
}

let rescale = zip(&rescale_intercept, &rescale_slope)
let rescale_data = zip(&rescale_intercept, &rescale_slope)
.map(|(intercept, slope)| Rescale {
intercept: *intercept,
slope: *slope,
})
.collect();
.collect::<Vec<Rescale>>();

let rescale = rescale_data
.get(frame as usize)
.or(rescale_data.first())
.copied()
.map(|inner| vec![inner])
.unwrap_or_default();

let window = window
.and_then(|inner| {
inner
.get(frame as usize)
.or(inner.first())
.copied()
.map(|el| vec![el])
});

let voi_lut_function = voi_lut_function
.and_then(|inner| {
inner
.get(frame as usize)
.or(inner.first())
.copied()
.map(|el| vec![el])
});

// Try decoding it using a registered pixel data decoder
if let Codec::EncapsulatedPixelData(Some(decoder), _) = ts.codec() {
Expand Down

0 comments on commit e7b2ac3

Please sign in to comment.