8000 Add physical Coordinate support to SpotFindingResults by shanaxel42 · Pull Request #1516 · spacetx/starfish · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add physical Coordinate support to SpotFindingResults #1516

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

Merged
merged 1 commit into from
Sep 23, 2019

Conversation

shanaxel42
Copy link
Collaborator
@shanaxel42 shanaxel42 commented Aug 29, 2019

This PR adds physical coordinate information to the SpotResultsClass. This is needed for when the coordinates get transferred during decoding.

Depends on #1489 #1515

See it in action in #1518

@shanaxel42 shanaxel42 mentioned this pull request Aug 29, 2019
10 tasks
@codecov-io
Copy link
codecov-io commented Aug 29, 2019

Codecov Report

Merging #1516 into master will increase coverage by 1.15%.
The diff coverage is 74.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1516      +/-   ##
==========================================
+ Coverage   87.27%   88.43%   +1.15%     
==========================================
  Files         142      213      +71     
  Lines        5031     7971    +2940     
==========================================
+ Hits         4391     7049    +2658     
- Misses        640  
8000
    922     +282
Impacted Files Coverage Δ
starfish/spots.py 100% <ø> (ø) ⬆️
starfish/core/intensity_table/intensity_table.py 96.26% <ø> (ø) ⬆️
starfish/core/spots/FindSpots/_base.py 0% <0%> (ø) ⬆️
starfish/core/spots/DecodeSpots/_base.py 0% <0%> (ø) ⬆️
...core/spots/DetectSpots/test/test_synthetic_data.py 50% <100%> (ø)
...ntensity_table/test/test_intensity_table_coords.py 98.41% <100%> (ø)
starfish/core/intensity_table/test/factories.py 100% <100%> (ø)
starfish/core/types/test/test_decoded_spots.py 100% <100%> (ø)
starfish/core/types/__init__.py 100% <100%> (ø) ⬆️
starfish/core/spots/DetectSpots/detect.py 98.36% <100%> (ø) ⬆️
... and 115 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 414ebc6...403b0bd. Read the comment docs.

@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from 87cd345 to a9f9535 Compare August 29, 2019 16:28
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from 18c85b6 to 29d66f5 Compare August 30, 2019 17:51

pairs = (
(Axes.X.value, Coordinates.X.value),
(Axes.Y.value, Coordinates.Y.value),
(Axes.ZPLANE.value, Coordinates.Z.value)
)

if image_stack is None and spots is None:
raise ValueError("Must provide either SpotFindingResults or ImageStack to"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ValueError("Must provide either SpotFindingResults or ImageStack to"
raise ValueError("Must provide either SpotFindingResults or ImageStack to "

"""
Transfers physical coordinates from an Imagestack's coordinates xarray to an intensity table
Transfers physical coordinates from either an Imagestack or SpotFindingResults to an
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long term, will there be any workflows that extract physical coordinates from an ImageStack? Or is that a stopgap measure until SpotFindingResults is produced everywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think we'll be able to remove the imagestack option once the full refactors done

8000
@@ -12,7 +15,7 @@ class SpotFindingResults:
SpotAttributes.
"""

def __init__(self, spot_attributes_list: Optional[List[Tuple]] = None):
def __init__(self, imagestack, spot_attributes_list: Optional[List[Tuple]] = None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it plausible that datasets get so big that we need to spread spot finding across multiple machines? If so, having the imagestack as part of spotfinding's results may make it challenging to persist.

It might make sense to store the coordinates from the imagestack, but not necessarily the actual imagestack (as that's really what you need anyway).

@ambrosejcarr, @dganguli

@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from 15c0db2 to f60e4e3 Compare September 17, 2019 21:49
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from 29d66f5 to 9bf4e8e Compare September 17, 2019 21:51
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from f60e4e3 to 87178b9 Compare September 17, 2019 23:42
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from 9bf4e8e to b5a67db Compare September 17, 2019 23:42
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from 87178b9 to b01a15a Compare September 18, 2019 18:49
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from b5a67db to 699ec22 Compare September 18, 2019 18:51
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from b01a15a to 87af7ad Compare September 18, 2019 19:30
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch 4 times, most recently from af7cd8a to c27f333 Compare September 18, 2019 21:04
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch 2 times, most recently from 741bb16 to afecd9c Compare September 18, 2019 21:09
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch 2 times, most recently from 2f92ce6 to 71e65d9 Compare September 19, 2019 17:58
@shanaxel42 shanaxel42 requested a review from ttung September 19, 2019 18:03
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from 71e65d9 to 5ae5c14 Compare September 19, 2019 21:09
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch 2 times, most recently from 1ddb24f to 6145462 Compare September 19, 2019 21:49
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from 5ae5c14 to 0d800d8 Compare September 19, 2019 21:49
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from 6145462 to 49d8713 Compare September 19, 2019 22:12
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch 2 times, most recently from 3664502 to e9a2178 Compare September 19, 2019 23:03
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from 7d1f343 to c033d9d Compare September 19, 2019 23:42
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from e9a2178 to 9147e3a Compare September 19, 2019 23:42
Copy link
Collaborator
@ttung ttung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly nits, pls see comments.

def transfer_physical_coords_from_imagestack_to_intensity_table(
image_stack: ImageStack, intensity_table: IntensityTable
) -> IntensityTable:
def transfer_physical_coords_to_intensity_table(*, intensity_table: IntensityTable,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be cleaner as:

def transfer_physical_coords_to_intensity_table(
        *,
        intensity_table: IntensityTable,
        image_stack: Optional[ImageStack] = None,
        spots: Optional[SpotFindingResults] = None,
) -> IntensityTable:
    """


pairs = (
(Axes.X.value, Coordinates.X.value),
(Axes.Y.value, Coordinates.Y.value),
(Axes.ZPLANE.value, Coordinates.Z.value)
)

if image_stack is None and spots is None:
raise ValueError("Must provide either SpotFindingResults or ImageStack to "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is plausibly more wrapped than necessary.

raise ValueError("Must provide either SpotFindingResults or ImageStack to "
"calculate coordinates from")

coord_ranges: Mapping[str, xr.DataArray]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I discovered last night, the newest version of xarray will probably want this as:

Suggested change
coord_ranges: Mapping[str, xr.DataArray]
coord_ranges: Mapping[Hashable, xr.DataArray]


pairs = (
(Axes.X.value, Coordinates.X.value),
(Axes.Y.value, Coordinates.Y.value),
(Axes.ZPLANE.value, Coordinates.Z.value)
)

if image_stack is None and spots is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider doing the xor. you really just want one specified. both is also bad.

@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from c033d9d to e495707 Compare September 20, 2019 15:13
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch 4 times, most recently from 5589427 to cbcdcb6 Compare September 23, 2019 18:06
@shanaxel42 shanaxel42 force-pushed the saxelrod-new-spot-finding-data-structures branch from 26f2f41 to 803d1a4 Compare September 23, 2019 18:06
@shanaxel42 shanaxel42 changed the base branch from saxelrod-new-spot-finding-data-structures to master September 23, 2019 19:44
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from cbcdcb6 to dae77b7 Compare September 23, 2019 20:00
@shanaxel42 shanaxel42 force-pushed the saxelrod-add_coordinates-to-spot-results branch from dae77b7 to 403b0bd Compare September 23, 2019 22:18
@shanaxel42 shanaxel42 merged commit 0871e3c into master Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0