Skip to content

Commit

Permalink
fix output project name
Browse files Browse the repository at this point in the history
  • Loading branch information
vorozhkog committed Oct 1, 2024
1 parent b28b06a commit a7d22cb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main_script": "src/main.py",
"modal_template": "src/modal.html",
"modal_template_state": {
"dstProjectName": "DICOM Volumes project",
"dstProjectName": "",
"dstProjectMode": "new project",
"dstDatasetMode": "new dataset",
"files": "",
Expand Down
8 changes: 4 additions & 4 deletions local.env
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PYTHONUNBUFFERED=1

TASK_ID=27590
TASK_ID=66427

context.teamId=8
context.workspaceId=349

#modal.state.slyFolder="agent://160/import-dicom/my_volumes_project/ds2/volume/"
modal.state.slyFolder="agent://197/volumes-test-same-names/"
modal.state.slyFolder="/import/import-dicom-volumes/2024-10-01 14:15:22.563/"

modal.state.project_name=
modal.state.project_name=""
modal.state.anonymizeVolumes=false
modal.state.remove_source=false
modal.state.removeSource=false

DEBUG_APP_DIR="src/debug/app_data"
DEBUG_CACHE_DIR="src/debug/app_cache"
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def import_dicom_volumes(
else:
if g.PROJECT_ID is None:
project_name = (
f.get_project_name_from_input_path(project_dir)
if len(g.OUTPUT_PROJECT_NAME) == 0
f.get_project_name_from_input_path(project_dir) or "DICOM Volumes project"
if len(g.OUTPUT_PROJECT_NAME.strip()) == 0
else g.OUTPUT_PROJECT_NAME
)

Expand Down
5 changes: 4 additions & 1 deletion src/sly_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@

def get_project_name_from_input_path(input_path: str) -> str:
"""Returns project name from target sly folder name."""
return os.path.basename(input_path)
basename = os.path.basename(input_path)
if basename == "":
return None
return basename


def update_progress(count, api: sly.Api, task_id: int, progress: sly.Progress) -> None:
Expand Down
3 changes: 0 additions & 3 deletions src/sly_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@


OUTPUT_PROJECT_NAME = os.environ.get("modal.state.dstProjectName", "")
if OUTPUT_PROJECT_NAME.strip() == "":
OUTPUT_PROJECT_NAME = "DICOM Volumes project"

REMOVE_SOURCE = bool(strtobool(os.getenv("modal.state.removeSource")))

DEFAULT_DATASET_NAME = "ds0"
Expand Down

0 comments on commit a7d22cb

Please sign in to comment.