diff --git a/examples/freesurfer/freesurfer_longitudinal_processing/freesurfer_longitudinal.ipynb b/examples/freesurfer/freesurfer_longitudinal_processing/freesurfer_longitudinal.ipynb index a628c7d..30d9b89 100644 --- a/examples/freesurfer/freesurfer_longitudinal_processing/freesurfer_longitudinal.ipynb +++ b/examples/freesurfer/freesurfer_longitudinal_processing/freesurfer_longitudinal.ipynb @@ -82,6 +82,8 @@ "# Built-ins\n", "import tarfile\n", "import shutil\n", + "import ipywidgets as widgets\n", + "from IPython.display import display, clear_output\n", "from pathlib import Path\n", "\n", "# VIP\n", @@ -134,17 +136,29 @@ "GIRDER_OUTPUT_PATH = '/user/USER_NAME/FOLDER_NAME' # Your Girder path to the final outputs folder (must already exist), can be in collections or user folders\n", "\n", "# Local\n", - "LOCAL_DATASET_PATH = Path('~/PATH').expanduser() # Your local dataset path, where the Girder dataset will be downloaded, must already exist\n", + "LOCAL_DATASET_PATH = Path('~/PATH').expanduser() # Your local dataset path, where the Girder dataset will be downloaded, must already exist and be empty. Do not add unrelated custom files in this directory and its subdirectories as it may break vip executions.\n", "LICENSE_PATH = Path('~/PATH/LICENSE_NAME.txt').expanduser() # Your pipeline license path, will be copied into VIP input_dirs automatically\n", "\"\"\"\n", "\n", "if CONFIG_PATH.exists():\n", - " answer = input(\"The user_config.py file already exists. Overwrite config ? (y/N): \")\n", - " if answer != \"y\":\n", - " print(\"File not created, as user_config.py already exists.\")\n", - " else:\n", - " CONFIG_PATH.write_text(user_config)\n", - " print(\"User_config.py overwritten with default values.\")\n", + " print(\"The user_config.py file already exists. Overwrite config ?\")\n", + " out = widgets.Output()\n", + " yes_btn = widgets.Button(description=\"Yes\")\n", + " no_btn = widgets.Button(description=\"No\")\n", + " display(widgets.HBox([yes_btn, no_btn]), out)\n", + " def on_yes(_):\n", + " with out:\n", + " clear_output(wait=True)\n", + " CONFIG_PATH.write_text(user_config)\n", + " print(\"User_config.py overwritten with default values.\")\n", + "\n", + " def on_no(_):\n", + " with out:\n", + " clear_output(wait=True)\n", + " print(\"File not created, as user_config.py already exists.\")\n", + "\n", + " yes_btn.on_click(on_yes)\n", + " no_btn.on_click(on_no)\n", "else:\n", " CONFIG_PATH.write_text(user_config)\n", " print(\"User_config.py created with default values.\")\n"