-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add read_thumbnail #154
Conversation
03f13b8
to
2dd794e
Compare
63e7f3c
to
dbbe483
Compare
25c6ece
to
6b48ce4
Compare
6b48ce4
to
5392b84
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #154 +/- ##
===========================================
- Coverage 93.84% 91.02% -2.83%
===========================================
Files 7 8 +1
Lines 406 568 +162
===========================================
+ Hits 381 517 +136
- Misses 25 51 +26 ☔ View full report in Codecov by Sentry. |
src/bindings.rs
Outdated
pub fn new(w: u32, h: u32) -> Self { | ||
Self { w, h } | ||
} | ||
pub fn from_dimensions_range(range: &ffi::DimensionsRange) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to bother you with this but this function may fail if end < start.
You can impl TryFrom for Size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, If you have suggestions on how to better handle the Err do not hesitate 🙂
src/utils.rs
Outdated
f64::from(dimension_level_0.w) / f64::from(dimension.w), | ||
f64::from(dimension_level_0.h) / f64::from(dimension.h), | ||
); | ||
let level_dowsamples: Vec<f64> = (0..level_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a more Rustish way to achieve that https://github.com/AzHicham/bioformats-rs/blob/714882e1b14a9fb2f4d1c2b5a6a3a6c4f59e7e3d/src/extra/wsi/slide.rs#L98
(0..).map().take_while().enumerate().rfind().unwrap_or()
I’m not sure but it should works ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In biofirmats i think the code is broken we need to check against the first value (max slide dimension ie downsample of 1) then unwraps with the last value :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your implementation looks correct to me !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used the one from bioformats
For the benchmark I’ll merge the PR and fix the workflow later :) |
src/bindings.rs
Outdated
} | ||
} | ||
impl TryFrom<&ffi::DimensionsRange> for ffi::Size { | ||
type Error = PhilipsSlideError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you can create a new type error
#[derive(Error)]
DimensionsRangeToSizeError{
StepXNull,
StepXNull,
EndXGreaterthanStartX,
EndYGreaterthanStartY,
}
Then add this error into PhilipsSlideError
#[transparent]
DimensionsRangeToSize(#[from] DimensionsRangeToSizeError)
Naming is bad but you get the idea haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice GG !!
🎉 This PR is included in version 1.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Add a thumbnail method similar to openslide's one