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
Aggregate data #11
base: main
Are you sure you want to change the base?
Aggregate data #11
Conversation
Hi Johannes @jo-mueller , awesome, thanks for working on this! I presume the function you're proposing here does the tecnically same as this one: napari-time-slicer/src/napari_time_slicer/_function.py Lines 31 to 74 in 90797a7
Do you think it would be possible to merge both functions?
I've started working on this here: Feel free to try it out and see if this in compatible wit points and surfaces. Feedback is very welcome. Best, |
@haesleinhuepf thanks for looking into it.
I could simply merge my code into that function, jup. They are pretty identical, that's true ^^ I'll update the PR. |
@haesleinhuepf I merged the two functions with identical scope into a single function (the one that already existed). |
Hi @haesleinhuepf , thanks for taking the time to look at this. Just a side note on how I did the interactive testing: I created some 2D+t sample data like this:
and added it to a napari viewer. I then created a small workflow (connected components, label erosion) and used the Otherwise, I think it's also functional as it is. |
Fixes #4
Hi @haesleinhuepf ,
this PR attempts to start on expanding the functionality of the time-slicer to more Layer types and hopefully allow other functions that use the time-slicer to be a bit more agnostic to whether something is 4D or 3D or 2D +t or whatever.
Summary
In short, I brought the
TimelapseConverter
class from napari-stress (originally here) to the time-slicer and re-factored it a bit to be cleaner and better readable.The class has two major methods:
convert_4d_data_to_list
andconvert_list_to_4d_data
which convert 4D to a list of 3D data or vice versa. The methods only require the to-be-converted data and the type of the input layer. The correct conversion function is then looked up from a dictionary that holds the respective conversion function for each kind of layer.In the time-slicer, I created a new function
aggregate
, which basically drags the slider and aggregates all the data in memory. The aggregation only requires theconvert_list_to_4d_data
from the TimelapseConverter, but maybe the other step may also be helpful somewhere in the future if the first step in a workflow is a 4D surface or whatever.Tests
I wrote unit tests and tested the aggregation from the napari viewer, which worked well. The only use case I didn't get to work was to get some measurements with regionprops aggregate those for all timeframes, which is probably because regionprops is currently not decorated (compatible?) with the time slicer.
This is probably not complete but maybe a step in the right direction :)
Future talk
measurement
vsmeansurement_of_all_frames
) redundant.