Skip to content

Commit

Permalink
fix: 🐛 Fix writing bugs
Browse files Browse the repository at this point in the history
Tested via the cellmap-segmentation-challenge repo.
  • Loading branch information
rhoadesScholar committed Nov 5, 2024
1 parent 069fae5 commit 1310767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cellmap_data/dataset_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def __setitem__(
for c, label in enumerate(self.classes):
self.target_array_writers[array_name][label][
self._current_center
] = array[c]
] = array[:, c, ...]

def __repr__(self) -> str:
"""Returns a string representation of the dataset."""
Expand Down
5 changes: 4 additions & 1 deletion src/cellmap_data/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,10 @@ def __setitem__(
f"Writing to center {center} in image {self.path} failed. Coordinates: are not all within the image's bounds. Will drop out of bounds data."
)
# Crop data to match the number of coordinates matched in the image
slices = [slice(None, len(coord)) for coord in coords.values()]
slices = []
for coord in coords.values():
if len(coord) > 1:
slices.append(slice(None, len(coord)))
data = data[*slices]
self.array.loc[coords] = data

Expand Down

0 comments on commit 1310767

Please sign in to comment.