Skip to content

Commit

Permalink
Minor fix to RADS download
Browse files Browse the repository at this point in the history
  • Loading branch information
dbouget committed Apr 7, 2023
1 parent cb640df commit 4588652
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ The plugin has been tested with the stable release 5.2.2 of 3D Slicer.
∘ (Alt.) Cloning current state:
> git clone --single-branch --branch master https:/raidionics/Raidionics-Slicer.git
* Download and install Docker (see [below](https:/raidionics/Raidionics-Slicer#docker-setup--)).
* Download and install Docker (see [below](https:/raidionics/Raidionics-Slicer#docker-setup--)).
The necessary _Raidionics_ Docker image should be collected automatically when downloading a model for the first time.
Please do the following if it did not happen correctly:
> docker pull dbouget/raidionics-rads:v1.1
* Load the plugin into 3D Slicer:
∘ All Modules > Extension Wizard.
Expand Down
3 changes: 3 additions & 0 deletions Raidionics/Raidionics/src/gui/RaidionicsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ def on_purge_models_options_clicked(self):
if os.path.isdir(SharedResources.getInstance().diagnosis_path):
shutil.rmtree(SharedResources.getInstance().diagnosis_path)
os.makedirs(SharedResources.getInstance().diagnosis_path)
if os.path.isdir(os.path.join(SharedResources.getInstance().Raidionics_dir, '.cache')):
shutil.rmtree(os.path.join(SharedResources.getInstance().Raidionics_dir, '.cache'))
os.makedirs(os.path.join(SharedResources.getInstance().Raidionics_dir, '.cache'))
# @TODO. Should send a signal to refresh both local models boxes in segmentation and RADS
except Exception as e:
logging.error("Purging local models failed.")
Expand Down
26 changes: 13 additions & 13 deletions Raidionics/Raidionics/src/utils/io_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,20 +390,20 @@ def download_cloud_diagnosis2(self, selected_diagnosis):
diagnosis_md5sum = diagnosis[3]
diagnosis_pipeline_url = diagnosis[4]

json_local_dir = SharedResources.getInstance().json_local_dir
dl_dest = os.path.join(SharedResources.getInstance().Raidionics_dir, '.cache',
str('_'.join(selected_diagnosis.split(']')[:-1]).replace('[', '').replace('/',
'-'))
+ '.json')
gdown.cached_download(url=diagnosis_url, path=dl_dest, md5=diagnosis_md5sum)
shutil.copy(src=dl_dest, dst=os.path.join(json_local_dir, os.path.basename(dl_dest)))
json_local_dir = SharedResources.getInstance().json_local_dir
dl_dest = os.path.join(SharedResources.getInstance().Raidionics_dir, '.cache',
str('_'.join(selected_diagnosis.split(']')[:-1]).replace('[', '').replace('/',
'-'))
+ '.json')
gdown.cached_download(url=diagnosis_url, path=dl_dest, md5=diagnosis_md5sum)
shutil.copy(src=dl_dest, dst=os.path.join(json_local_dir, os.path.basename(dl_dest)))

diagnosis_dir = SharedResources.getInstance().diagnosis_path
dl_dest = os.path.join(diagnosis_dir,
str('_'.join(selected_diagnosis.split(']')[:-1]).replace('[', '').replace('/',
'-'))
+ '_pipeline.json')
gdown.cached_download(url=diagnosis_pipeline_url, path=dl_dest)
diagnosis_dir = SharedResources.getInstance().diagnosis_path
dl_dest = os.path.join(diagnosis_dir,
str('_'.join(selected_diagnosis.split(']')[:-1]).replace('[', '').replace('/',
'-'))
+ '_pipeline.json')
gdown.cached_download(url=diagnosis_pipeline_url, path=dl_dest)

# Checking if dependencies are needed and if they exist already locally, otherwise triggers a download
if len(diagnosis_dependencies) > 0:
Expand Down

0 comments on commit 4588652

Please sign in to comment.