-
Notifications
You must be signed in to change notification settings - Fork 70
Add map/reduce methods to ImageStack #1539
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1539 +/- ##
=========================================
- Coverage 88.04% 88% -0.04%
=========================================
Files 150 150
Lines 5143 5151 +8
=========================================
+ Hits 4528 4533 +5
- Misses 615 618 +3
Continue to review full report at Codecov.
|
58ea189
to
43938cd
Compare
7220df8
to
6d54cfe
Compare
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.
Generally I want to follow the principles that starfish should be "simple and intuitive" I think this improves on the package, and follows patterns our users would expect to see from numpy, xarray, and pandas, where common methods are accessible from the main objects.
@@ -50,6 +51,7 @@ | |||
Clip, | |||
Coordinates, | |||
CoordinateValue, | |||
FunctionSource, |
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.
Meta-comment: I think logging and reproducibility is very important, but wonder if we're shooting ourselves in the foot re: usability by not accepting functions directly. I know last time we discussed we waffled a bit and then decided on the side of logging.
How would you feel if @neuromusic or I did some research on this question to get some signal on user expectations and whether this approach is intuitive enough for our users to understand?
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.
Meta-comment: I think logging and reproducibility is very important, but wonder if we're shooting ourselves in the foot re: usability by not accepting functions directly. I know last time we discussed we waffled a bit and then decided on the side of logging.
I still think that is the right choice. Otherwise, starfish doesn't have much of value-add.
@@ -1215,3 +1217,33 @@ def max_proj(self, *dims: Axes) -> "ImageStack": | |||
def _squeezed_numpy(self, *dims: Axes): | |||
"""return this ImageStack's data as a squeezed numpy array""" | |||
return self.xarray.squeeze(tuple(dim.value for dim in dims)).values | |||
|
|||
def reduce( |
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.
definitely will need docs. :-)
reducer = Filter.Reduce(dims, func, module, clip_method, **kwargs) | ||
return reducer.run(self, *args) | ||
|
||
def map( |
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.
definitely will need docs. :-)
7ef87a6
to
47d990f
Compare
This is ready for review again. |
47d990f
to
d201816
Compare
d201816
to
181fdd3
Compare
5fbdb1d
to
a485f7a
Compare
181fdd3
to
18ebbc3
Compare
18ebbc3
to
cf4f2ec
Compare
beaad60
to
95bd2d1
Compare
df5f44a
to
5534128
Compare
079358f
to
f50b31c
Compare
5534128
to
e5ba35e
Compare
f50b31c
to
9e280f3
Compare
e5ba35e
to
1436e1e
Compare
9e280f3
to
f79d217
Compare
0bfbd65
to
64d5322
Compare
ed418fe
to
eb15634
Compare
4bd8dfe
to
511867e
Compare
1a919c9
to
ffce74c
Compare
df2ba19
to
de1c6fe
Compare
17c1650
to
a6179ea
Compare
9e47685
to
e82ef53
Compare
bdb0129
to
c647b6d
Compare
f08a569
to
2210ee2
Compare
1cd0b80
to
bc1c1ec
Compare
b7d9351
to
da9a140
Compare
bc1c1ec
to
c193ef5
Compare
da9a140
to
5f3aa70
Compare
c193ef5
to
b042e2d
Compare
5f3aa70
to
3c39f9f
Compare
5862e96
to
637236b
Compare
This is syntactic sugar to simplify single map / reduce operations. Right now, we would need to instantiate the filter and then run it against the stack, e.g., ``` max_projector = Filter.Reduce((Axes.CH, Axes.ROUND, Axes.ZPLANE)) max_projected = max_projector.run(stack) ``` With this, it simplifies to: ``` max_projected = stack.reduce((Axes.CH, Axes.ROUND, Axes.ZPLANE), "max") ``` Test plan: Converted imagestack/test/test_max_proj.py to use this idiom. Depends on #1540
637236b
to
5be3a3e
Compare
This is syntactic sugar to simplify single map / reduce operations. Right now, we would need to instantiate the filter and then run it against the stack, e.g.,
With this, it simplifies to:
Test plan: Converted imagestack/test/test_max_proj.py to use this idiom.
Depends on #1540