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

Various Small Fixes/Improvements #1985

Merged
merged 44 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e3c70bf
Initial commit
nickeener Oct 11, 2021
9386a03
Updated comments
nickeener Oct 12, 2021
5d3e8d0
Changed filter_tally to rounds_used in decoded_intensity_table
nickeener Oct 12, 2021
b21b57f
Fixed validation errors
nickeener Oct 13, 2021
548e4e5
added tests for checkAll decoder
nickeener Oct 17, 2021
54f6fb6
Merge branch 'spacetx:master' into master
nickeener Oct 18, 2021
c04f503
Fixed imports order
nickeener Oct 18, 2021
15f5fa0
include test updates
nickeener Oct 19, 2021
bfd0715
annotation fixes and speed improvements
nickeener Oct 19, 2021
102d554
added ray to requirements
nickeener Oct 19, 2021
900c6e2
More speed and memory improvements
nickeener Oct 28, 2021
fe9733e
Replaced ray w/ multiprocessing
nickeener Oct 28, 2021
002d25d
Fix import order
nickeener Oct 28, 2021
ef5cf5e
few more fixes
nickeener Oct 28, 2021
68a3c5f
Changed test to account for randomness
nickeener Oct 28, 2021
3a10c18
fix test
nickeener Oct 28, 2021
7f74fb9
Added new filter step
nickeener Nov 7, 2021
be39052
Added input error checking and condition for empty results
nickeener Jan 11, 2022
0a8ced9
Fixed channel bug
nickeener Jan 25, 2022
ea8a2e9
March 30 2022 big update
nickeener Mar 30, 2022
1d19407
Updated comments
nickeener Apr 2, 2022
ec859a1
Updated comments and fixed mypy errors
nickeener May 5, 2022
475a8f8
Merge branch 'spacetx:master' into ray_2022
nickeener May 5, 2022
027b7cf
Swapped ray multiprocessing w/ standard Python
nickeener May 9, 2022
9c383d3
fixed function arg bug
nickeener May 17, 2022
fe841db
mypy fix
nickeener May 17, 2022
290c62e
bug fixes
nickeener May 27, 2022
1a6b9a6
fix
nickeener Jun 13, 2022
f2987a1
Added sphinx update to reqs
nickeener Jun 22, 2022
8752555
fixed error correction bug
nickeener Jun 22, 2022
cde796b
reqs fix
nickeener Jul 20, 2022
30e919f
Added better error catching
nickeener Jul 22, 2022
e7a4691
Added error catch for no decoded targets
nickeener Jul 26, 2022
69baff7
fix
nickeener Jul 27, 2022
7eff90a
Added spot saving/loading
nickeener Jul 27, 2022
acb0e64
Replaced old seqfish notebook
nickeener Jul 27, 2022
e84493c
Added ability to read in 3d external label image as mask
nickeener Jul 28, 2022
944fd88
Modified BlobDetector to work when is_volume=False
nickeener Jul 28, 2022
20dfff0
Merge branch 'master' into ucsc_fixes
nickeener Jul 28, 2022
f0dc0a1
Speed improvements
nickeener Aug 2, 2022
1925af1
Merge branch 'ucsc_fixes' of https://github.com/nickeener/starfish in…
nickeener Aug 2, 2022
4ad5d23
fix for windows test
nickeener Aug 2, 2022
75f65db
retrigger checks
nickeener Aug 2, 2022
7b667f3
retrigger checks
nickeener Aug 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
389 changes: 160 additions & 229 deletions notebooks/SeqFISH.ipynb

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions starfish/core/morphology/binary_mask/binary_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,28 @@ def from_external_labeled_image(cls, path_to_labeled_image: Union[str, Path],
# Load the label image generated from another program
label_image = io.imread(path_to_labeled_image)

# Get the physical ticks from the original dapi image
physical_ticks = {Coordinates.Y: original_image.xarray.yc.values,
Coordinates.X: original_image.xarray.xc.values}
# Fixes dimension order. Tiff files saved with skimage.io.imsave and tifffile.imsave will
# have different dimension order when read in.
if len(label_image.shape) == 3 and label_image.shape[0] > label_image.shape[-1]:
label_image = np.transpose(label_image, [2, 0, 1])

if len(label_image.shape) == 3:
# Get the physical ticks from the original dapi image
physical_ticks = {Coordinates.Y: original_image.xarray.yc.values,
Coordinates.X: original_image.xarray.xc.values,
Coordinates.Z: original_image.xarray.zc.values}

# Get the pixel values from the original dapi image
pixel_coords = {Axes.Y: original_image.xarray.y.values,
Axes.X: original_image.xarray.x.values,
Axes.ZPLANE: original_image.xarray.z.values}
else:
physical_ticks = {Coordinates.Y: original_image.xarray.yc.values,
Coordinates.X: original_image.xarray.xc.values}

# Get the pixel values from the original dapi image
pixel_coords = {Axes.Y: original_image.xarray.y.values,
Axes.X: original_image.xarray.x.values}
# Get the pixel values from the original dapi image
pixel_coords = {Axes.Y: original_image.xarray.y.values,
Axes.X: original_image.xarray.x.values}

# Create the label image
label_im = LabelImage.from_label_array_and_ticks(
Expand Down
66 changes: 40 additions & 26 deletions starfish/core/spots/DecodeSpots/check_all_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ def run(self,
# Adds spot_codes column to roundData

roundData = buildBarcodes(roundData, neighborDict,
currentRoundOmitNum, channelDict,
strictness, r, numJobs)
currentRoundOmitNum, strictness, r,
numJobs)

# When strictness is positive the filter-first methods is used
# and distanceFilter is run first on all the potential barcodes
Expand Down Expand Up @@ -400,7 +400,12 @@ def run(self,
# create empty IntensityTable filled with np.nan
data = np.full((len(allCodes), len(channels), len(rounds)), fill_value=np.nan)
dims = (Features.AXIS, Axes.CH.value, Axes.ROUND.value)
centers = allCodes['center']

if len(allCodes) == 0:
centers = []
else:
centers = allCodes['center']

coords: Mapping[Hashable, Tuple[str, Any]] = {
Features.SPOT_RADIUS: (Features.AXIS, np.full(len(allCodes), 1)),
Axes.ZPLANE.value: (Features.AXIS, np.asarray([round(c[0]) for c in centers])),
Expand All @@ -413,28 +418,37 @@ def run(self,
}
int_table = IntensityTable(data=data, dims=dims, coords=coords)

# Fill in data values
table_codes = []
for i in range(len(allCodes)):
code = []
# ints = allCodes.loc[i, 'intensities']
for j, ch in enumerate(allCodes.loc[i, 'best_barcodes']):
# If a round is not used, row will be all zeros
code.append(np.asarray([0 if k != ch - 1 else 1 for k in range(len(channels))]))
table_codes.append(np.asarray(code).T)
int_table.values = np.asarray(table_codes)
int_table = transfer_physical_coords_to_intensity_table(intensity_table=int_table,
spots=spots)

# Validate results are correct shape
self.codebook._validate_decode_intensity_input_matches_codebook_shape(int_table)

# Create DecodedIntensityTable
result = DecodedIntensityTable.from_intensity_table(
int_table,
targets=(Features.AXIS, allCodes['targets'].astype('U')),
distances=(Features.AXIS, allCodes["distance"]),
passes_threshold=(Features.AXIS, np.full(len(allCodes), True)),
rounds_used=(Features.AXIS, allCodes['rounds_used']))
# If no targets found returns empty DecodedIntensityTable
if len(allCodes) > 0:
# Fill in data values
table_codes = []
for i in range(len(allCodes)):
code = []
# ints = allCodes.loc[i, 'intensities']
for j, ch in enumerate(allCodes.loc[i, 'best_barcodes']):
# If a round is not used, row will be all zeros
code.append(np.asarray([0 if k != ch - 1 else 1 for k in range(len(channels))]))
table_codes.append(np.asarray(code).T)
int_table.values = np.asarray(table_codes)
int_table = transfer_physical_coords_to_intensity_table(intensity_table=int_table,
spots=spots)

# Validate results are correct shape
self.codebook._validate_decode_intensity_input_matches_codebook_shape(int_table)

# Create DecodedIntensityTable
result = DecodedIntensityTable.from_intensity_table(
int_table,
targets=(Features.AXIS, allCodes['targets'].astype('U')),
distances=(Features.AXIS, allCodes["distance"]),
passes_threshold=(Features.AXIS, np.full(len(allCodes), True)),
rounds_used=(Features.AXIS, allCodes['rounds_used']))
else:
result = DecodedIntensityTable.from_intensity_table(
int_table,
targets=(Features.AXIS, np.array([])),
distances=(Features.AXIS, np.array([])),
passes_threshold=(Features.AXIS, np.array([])),
rounds_used=(Features.AXIS, np.array([])))

return result
Loading