Skip to content

Commit

Permalink
Restore download scripts and remove hard-coded paths
Browse files Browse the repository at this point in the history
  • Loading branch information
anwai98 committed Jan 8, 2025
1 parent 1858afe commit 57c39b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions scripts/datasets/medical/check_kits.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@


def check_kits():
# from util import ROOT
ROOT = "/media/anwai/ANWAI/data"
from util import ROOT

loader = get_kits_loader(
path=os.path.join(ROOT, "kits"),
Expand Down
24 changes: 12 additions & 12 deletions torch_em/data/datasets/medical/kits.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ def get_kits_data(path: Union[os.PathLike, str], download: bool = False) -> str:
The folder where the dataset is downloaded and preprocessed.
"""
data_dir = os.path.join(path, "preprocessed")
# if os.path.exists(data_dir):
# return data_dir
if os.path.exists(data_dir):
return data_dir

# os.makedirs(path, exist_ok=True)
os.makedirs(path, exist_ok=True)

# if not download:
# raise RuntimeError("The dataset is not found and download is set to False.")
if not download:
raise RuntimeError("The dataset is not found and download is set to False.")

# # We clone the environment.
# subprocess.run(["git", "clone", URL, os.path.join(path, "kits23")])
# We clone the environment.
subprocess.run(["git", "clone", URL, os.path.join(path, "kits23")])

# # We install the package-only (with the assumption that the other necessary packages already exists).
# subprocess.run(["pip", "install", "-e", os.path.join(path, "kits23"), "--no-deps"])
# We install the package-only (with the assumption that the other necessary packages already exists).
subprocess.run(["pip", "install", "-e", os.path.join(path, "kits23"), "--no-deps"])

# print("The download might take several hours. Make sure you have consistent internet connection.")
print("The download might take several hours. Make sure you have consistent internet connection.")

# # Now, we run the CLI.
# subprocess.run(["kits23_download_data"])
# Now, we run the CLI.
subprocess.run(["kits23_download_data"])

# Preprocess the images.
_preprocess_inputs(path)
Expand Down

0 comments on commit 57c39b4

Please sign in to comment.