download files only if root dir doesn't exist
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Download and extract the demo data\n",
+ "## Optionally download and extract the data\n",
"\n",
- "For this example we will be using a 350 MB zip file which contains a range of DICOM dose files as well as mephysto measurement files. To begin we shall download these."
+ "For this example we will be using a 350 MB zip file which contains a range of DICOM dose files as well as mephysto measurement files. We will now download these if the `data/tpscompare` directory doesn't already exist"
]
},
{
"source": [
"DATA_DIR = pathlib.Path('data')\n",
"DATA_DIR.mkdir(exist_ok=True)\n",
+ "ROOT_DIR = DATA_DIR.joinpath(\"tpscompare\")\n",
"\n",
+ "if not ROOT_DIR.exists():\n",
" zip_filepath = DATA_DIR.joinpath('tpscompare.zip')\n",
" \n",
- "if not zip_filepath.exists():\n",
" url = 'https://zenodo.org/record/3351939/files/tpscompare.zip?download=1'\n",
" urllib.request.urlretrieve(url, zip_filepath)\n",
" \n",
"metadata": {},
"outputs": [],
"source": [
- "ROOT_DIR = pathlib.Path(\"data/tpscompare\")\n",
- "\n",
"BEAM_MODELS_DIR = ROOT_DIR.joinpath(\"Beam Models\")\n",
"\n",
"PLAN_FILEPATH = BEAM_MODELS_DIR.joinpath(\"plan.dcm\")\n",
