-
Notifications
You must be signed in to change notification settings - Fork 6
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
working on general model refactor #33
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33 +/- ##
==========================================
- Coverage 81.95% 74.27% -7.69%
==========================================
Files 13 13
Lines 1236 1236
==========================================
- Hits 1013 918 -95
- Misses 223 318 +95 ☔ View full report in Codecov by Sentry. |
gamma: float = 1.0 | ||
"""Gamma correction for this channel.""" | ||
|
||
autoscale: bool | tuple[float, float] = (0, 1) |
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 think autoscale
should be an instance of something like AutoscalePolicy
class because There are many possible ways to autoscale an image (maybe even more complicated in the future).
class AutoscalePolicy(ABC):
@abstractmethod
def get_limits(self, image: np.ndarray) -> tuple[float | None, float | None]:
pass
class NoAutoscale(AutoscalePolicy):
def get_limits(self, image: np.ndarray) -> tuple[float | None, float | None]:
return None, None
class MinMaxAutoscale(AutoscalePolicy):
def get_limits(self, image: np.ndarray) -> tuple[float | None, float | None]:
return image.min(), image.max()
class QuantileAutoscale(AutoscalePolicy):
lower: float
upper: float
def get_limits(self, image: np.ndarray) -> tuple[float | None, float | None]:
return np.quantile(image, [self.lower, self.upper])
# etc.
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 like it 👍
Hi @tlambert03, thanks for tagging me. I think it's a nice idea to reconsider the class designs at this point. I'll look into this PR in detail little by little, and leave some comments if I found something might be relevant. |
I love what I'm seeing at first pass, feels very nice but I need some time to integrate the whole model - need to think a little more on the index/bounds and how this might work/not work with oblique planes... interesting to think about! |
this PR is not necessarily for merging, but rather for discussing high level model and control flow. I want to step back and reconsider the model carefully.
ndv
is "doing a thing" somewhat nicely, and it's a good time to step back and clarify exactly what that thing is, with an eye towards building a better foundation to fix some issues (i.e. channel-specific lut persistence) and prepare for some nice features (i.e. chunked loading #22)cc @alisterburt
@hanjinliu, inasmuch as you're looking at this repo these days, would love your feedback!
Main players here are:
ArrayDisplayModel
: the model representing instructions for visualizing some data sourceLUT
: instructions for displaying a specific channelArrayViewer
: the view; stubbing out what should be done in response to various eventsDataWrapper
: a place to put all of the things we need from the data (we wrap provided data in a DataWrapper based on the type of data).I'll keep tweaking and updating this flow here, and then actually implement it later