-
Notifications
You must be signed in to change notification settings - Fork 11
Adding support for pyramids #129
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
b07f0ad
8a137d4
0ff15ab
dd78377
e120680
9f251a6
68e9ccd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,5 +62,6 @@ data: | |
- 256 | ||
caching: false | ||
ground_truth_masks: null | ||
pyramid_resolution: "0" | ||
ckpt_path: null | ||
verbose: true |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -104,6 +104,8 @@ class SlidingWindowDataset(Dataset): | |||
:param ChannelMap channels: source and target channel names, | ||||
e.g. ``{'source': 'Phase', 'target': ['Nuclei', 'Membrane']}`` | ||||
:param int z_window_size: Z window size of the 2.5D U-Net, 1 for 2D | ||||
:param int pyramid_resolution: pyramid level. | ||||
defaults to 0 (full resolution) | ||||
ziw-liu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||
:param DictTransform | None transform: | ||||
a callable that transforms data, defaults to None | ||||
""" | ||||
|
@@ -113,6 +115,7 @@ def __init__( | |||
positions: list[Position], | ||||
channels: ChannelMap, | ||||
z_window_size: int, | ||||
pyramid_resolution: str = "0", | ||||
transform: DictTransform | None = None, | ||||
) -> None: | ||||
super().__init__() | ||||
|
@@ -128,6 +131,7 @@ def __init__( | |||
) | ||||
self.z_window_size = z_window_size | ||||
self.transform = transform | ||||
self.pyramid_resolution = pyramid_resolution | ||||
self._get_windows() | ||||
|
||||
def _get_windows(self) -> None: | ||||
|
@@ -138,7 +142,7 @@ def _get_windows(self) -> None: | |||
self.window_arrays = [] | ||||
self.window_norm_meta: list[NormMeta | None] = [] | ||||
for fov in self.positions: | ||||
img_arr: ImageArray = fov["0"] | ||||
img_arr: ImageArray = fov[str(self.pyramid_resolution)] | ||||
ts = img_arr.frames | ||||
zs = img_arr.slices - self.z_window_size + 1 | ||||
w += ts * zs | ||||
|
@@ -219,7 +223,7 @@ def __getitem__(self, index: int) -> Sample: | |||
sample = { | ||||
"index": sample_index, | ||||
"source": self._stack_channels(sample_images, "source"), | ||||
"norm_meta": norm_meta, | ||||
# "norm_meta": norm_meta, | ||||
|
||||
} | ||||
if self.target_ch_idx is not None: | ||||
sample["target"] = self._stack_channels(sample_images, "target") | ||||
|
@@ -301,6 +305,8 @@ class HCSDataModule(LightningDataModule): | |||
:param Path | None ground_truth_masks: path to the ground truth masks, | ||||
used in the test stage to compute segmentation metrics, | ||||
defaults to None | ||||
:param int pyramid_resolution: pyramid resolution level. | ||||
defaults to 0 (full resolution) | ||||
""" | ||||
|
||||
def __init__( | ||||
|
@@ -318,6 +324,7 @@ def __init__( | |||
augmentations: list[MapTransform] = [], | ||||
caching: bool = False, | ||||
ground_truth_masks: Path | None = None, | ||||
pyramid_resolution: str = "0", | ||||
|
array_key: str = "0", |
Uh oh!
There was an error while loading. Please reload this page.