Skip to content
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

Improvements to SegmentationMaskCollection #1497

Closed
ambrosejcarr opened this issue Aug 17, 2019 · 2 comments
Closed

Improvements to SegmentationMaskCollection #1497

ambrosejcarr opened this issue Aug 17, 2019 · 2 comments
Labels

Comments

@ambrosejcarr
Copy link
Member

ambrosejcarr commented Aug 17, 2019

Objective

SegmentationMaskCollection should contain operations that manipulate regions and can be improved to be more usable by making it a dict-like object. We should be able to query for masks matching cell ids, obtain properties of stored cell regions, and filter on those properties.

@shanaxel42
Copy link
Collaborator

shanaxel42 commented Aug 26, 2019

Filters (ex. ImageStack max_proj) may make more sense as it's own pipeline component

@ambrosejcarr
Copy link
Member Author

ambrosejcarr commented Sep 12, 2019

  • add an issue relating to calculation of regionprops on segmentation masks within the collection.

See: https://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops

ttung pushed a commit that referenced this issue Oct 10, 2019
ttung pushed a commit that referenced this issue Oct 17, 2019
regionprops are useful to characterize and filter segmented cells.  This PR changes what we store for mask data to be a tuple of binary mask and regionprops.  If we construct a mask collection from a labeled image, we retain the region props that are automatically calculated as a part of this conversion process.  If we construct a mask collection from what's stored on disk, we will calculate the regionprops when requested.

Test plan: Save to disk a mask collection generated from a labeled image, and after loading it from disk, verify that the region props of the two mask collections match.

Part of #1497
ttung pushed a commit that referenced this issue Oct 18, 2019
Rather than passing around a naked 2D/3D array as a label image, create a type for holding that data.

Test plan: see tests!
Depends on #1617
Part of #1497
ttung pushed a commit that referenced this issue Oct 24, 2019
Rather than passing around a naked 2D/3D array as a label image, create a type for holding that data.

Test plan: see tests!
Depends on #1617
Part of #1497
ttung pushed a commit that referenced this issue Oct 28, 2019
Rather than passing around a naked 2D/3D array as a label image, create a type for holding that data.

Test plan: see tests!
Depends on #1617
Part of #1497
ttung pushed a commit that referenced this issue Nov 13, 2019
LabelImage requires all the pixel coordinate and physical coordinate values along each axis, so to facilitate the easy conversion to and from BinaryMaskCollection and LabelImage, we need to change the data model for BinaryMaskCollection.

Previously, BinaryMaskCollection stored a series of xarrays for each of the masks.  This does not guarantee that the pixel/physical coordinates for every position along each axis.  Furthermore, it duplicates a lot of data.

This new approach stores the coordinates as independent arrays, and then stores each mask as a naked np.ndarray with offsets.  Conversions to and from LabelImage is pretty straightforward.  Returning each mask as an xarray (to maintain compatibility with the existing API) requires generating an xarray on the fly, but is not terribly expensive.

Writing to disk is now through a versioned interface similar to what was done for slicedimage.

Test plan: Updated tests to reflect the API changes.
Part of #1497
Depends on #1619, #1622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants