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

Minor updates to LM datasets #483

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions torch_em/data/datasets/light_microscopy/arvidsson.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def get_arvidsson_data(
if os.path.exists(data_dir):
return data_dir

os.makedirs(path, exist_ok=True)

zip_path = os.path.join(path, f"{dname}.zip")
util.download_source(path=zip_path, url=URLS[split], download=download, checksum=CHECKSUMS[split])
util.unzip(zip_path=os.path.join(path, f"{dname}.zip"), dst=path)
Expand Down
6 changes: 3 additions & 3 deletions torch_em/data/datasets/light_microscopy/bitdepth_nucseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_bitdepth_nucseg_data(path: Union[os.PathLike, str], download: bool = Fal

def get_bitdepth_nucseg_paths(
path: Union[os.PathLike, str],
magnification: Optional[Literal['20x', '40x_air', '40x_oil' '63x_oil']] = None,
magnification: Optional[Literal['20x', '40x_air', '40x_oil', '63x_oil']] = None,
download: bool = False
) -> Tuple[List[str], List[str]]:
"""Get paths to the BitDepth NucSeg data.
Expand Down Expand Up @@ -101,7 +101,7 @@ def get_bitdepth_nucseg_paths(
def get_bitdepth_nucseg_dataset(
path: Union[os.PathLike, str],
patch_shape: Tuple[int, int],
magnification: Optional[Literal['20x', '40x_air', '40x_oil' '63x_oil']] = None,
magnification: Optional[Literal['20x', '40x_air', '40x_oil', '63x_oil']] = None,
download: bool = False,
**kwargs
) -> Dataset:
Expand Down Expand Up @@ -134,7 +134,7 @@ def get_bitdepth_nucseg_loader(
path: Union[os.PathLike, str],
batch_size: int,
patch_shape: Tuple[int, int],
magnification: Optional[Literal['20x', '40x_air', '40x_oil' '63x_oil']] = None,
magnification: Optional[Literal['20x', '40x_air', '40x_oil', '63x_oil']] = None,
download: bool = False,
**kwargs
) -> DataLoader:
Expand Down
6 changes: 3 additions & 3 deletions torch_em/data/datasets/light_microscopy/brifiseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def get_brifiseg_data(path: Union[os.PathLike, str], download: bool = False) ->
if os.path.exists(data_dir):
return data_dir

tar_path = os.path.join(path, "1channel.tar")
if not os.path.exists(tar_path) and not download:
raise ValueError("The tar file is not found and download is set to 'False'.")
os.makedirs(path, exist_ok=True)

tar_path = os.path.join(path, "1channel.tar")
util.download_source(path=tar_path, url=URL, checksum=CHECKSUM, download=download)
util.unzip_tarfile(tar_path=tar_path, dst=path)

for zip_path in glob(os.path.join(os.path.join(path, "1channel"), "*.zip")):
Expand Down