Skip to content

Commit 1e54125

Browse files
committed
TST: Do not remove fMRI notebook from list of discovered notebooks
Do not remove fMRI notebook from list of discovered notebooks: this will allow running the notebook at the time scheduled by the `notebooks.yml` GHA workflow file. Download `SynthStrip` model for skull stripping. Used by the fMRI BOLD realignment notebook. Fixes: ``` FileNotFoundError Traceback (most recent call last) Cell In[4], line 19 14 if not bmask_path.exists(): 15 bmsk_results = SynthStrip( 16 in_file=str(avg_path), 17 use_gpu=True, 18 ).run(cwd=str(WORKDIR)) ---> 19 copy(bmsk_results.outputs.out_mask,bmask_path) (...) FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/tmp/nifreezedev/ismrm25/sub-01_task-mixedgamblestask_run-03_boldref_desc-brain_mask.nii.gz' ``` raised for example at: https://github.com/jhlegarreta/nifreeze/actions/runs/14897027210/job/41841440531#step:11:102 Modify the call to the `SynthStrip` workflow in the notebook so that the model is loaded from a file that is provided as an argument. Install AFNI in the GHA workflow.
1 parent 2ca25ff commit 1e54125

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.github/workflows/notebooks.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,35 @@ jobs:
4141
with:
4242
python-version: ${{ matrix.python-version }}
4343

44+
- name: Install AFNI
45+
run: |
46+
# Detect Ubuntu version
47+
UBUNTU_VERSION=$(lsb_release -rs | cut -d. -f1)
48+
AFNI_PACKAGE="linux_ubuntu_${UBUNTU_VERSION}_64"
49+
echo "Detected Ubuntu version: $UBUNTU_VERSION"
50+
echo "Using AFNI package: $AFNI_PACKAGE"
51+
52+
# Install dependencies
53+
sudo apt-get update
54+
sudo apt-get install -y tcsh curl libglu1-mesa libxmu6 libxm4 libgsl-dev libglw1-mesa
55+
56+
# Download and install AFNI
57+
curl -O https://afni.nimh.nih.gov/pub/dist/bin/${AFNI_PACKAGE}/@update.afni.binaries
58+
tcsh @update.afni.binaries -package $AFNI_PACKAGE -do_extras
59+
60+
# Add AFNI to PATH
61+
echo "$HOME/abin" >> $GITHUB_PATH
62+
4463
- name: Download data from OSF
4564
run: |
4665
mkdir ${TEST_DATA_HOME}
4766
pip install osfclient
4867
osf -p 39k4x fetch hcpdata.npz "${TEST_DATA_HOME}/hcpdata.npz"
4968
69+
- name: Download SynthStrip model
70+
run: |
71+
wget https://ftp.nmr.mgh.harvard.edu/pub/dist/freesurfer/synthstrip/models/synthstrip.1.pt -P "${TEST_DATA_HOME}"
72+
5073
- name: Install TeX Live
5174
run: |
5275
sudo apt-get update

docs/notebooks/bold_realignment.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
" bmsk_results = SynthStrip(\n",
7979
" in_file=str(avg_path),\n",
8080
" use_gpu=True,\n",
81+
" model=DATA_PATH / \"synthstrip.1.pt\",\n",
8182
" ).run(cwd=str(WORKDIR))\n",
8283
" copy(bmsk_results.outputs.out_mask, bmask_path)\n",
8384
"\n",

tools/run_notebooks.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,5 @@
2727

2828
# Find and run the notebooks
2929
notebooks = glob.glob("docs/notebooks/*.ipynb")
30-
# Make bold_realignment.ipynb Jupyter notebook an exception as it involves running a realignment
31-
# process for several DataLad datasets, which requires long running times.
32-
notebooks.remove("docs/notebooks/bold_realignment.ipynb")
3330

3431
sys.exit(subprocess.call(["pytest", "--nbmake"] + notebooks))

0 commit comments

Comments
 (0)