-
-
Notifications
You must be signed in to change notification settings - Fork 20
159 lines (136 loc) · 5.04 KB
/
phantoms.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: phantoms
on:
workflow_call:
push:
branches:
- main
pull_request:
branches:
- main
- dev
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
phantoms:
runs-on: ${{ matrix.os }}
env:
DCM2NIIX_WIN_PATH: dcm2niix_win/dcm2niix.exe
MATLAB_CODE_PATH: ${{ github.workspace }}/matlab/
METADATA_PATH: ${{ github.workspace }}/metadata/
strategy:
matrix:
os: [ubuntu-20.04]
python: ["3.10"]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Cache Node Posix
if: runner.os != 'Windows' && !env.ACT
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ env.cache-name }}
- name: Cache Phantoms
if: ${{ !env.ACT }}
id: phantom-cache
uses: actions/cache@v3
env:
cache-name: cache-phantoms
with:
path: PHANTOMS.zip
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('PHANTOMS.zip') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-
- name: Install dcm2niix posix
if: runner.os != 'Windows'
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
mkdir dcm2niix_install/ && cd dcm2niix_install/
curl -fLO https://github.com/rordenlab/dcm2niix/releases/download/v1.0.20230411/dcm2niix_lnx.zip
unzip dcm2niix*.zip
echo "${{ github.workspace }}/dcm2niix_install/" >> $GITHUB_PATH
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install dcm2niix
fi
- name: Install dcm2niix windows
if: runner.os == 'Windows'
run: |
curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_win.zip
powershell -command "Expand-Archive dcm2niix_win.zip"
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: |
pypet2bids/pyproject.toml
- name: Install Python Dependencies
run: |
cd pypet2bids
pip install .
pip install gdown
- name: Install Poetry Build Package
run: |
make installpoetry
make buildpackage
make installpackage
dcm2niix4pet -h
- name: Set Up Node
uses: actions/setup-node@v3
- name: Install BIDS Validator
run: npm install -g bids-validator
- name: Collect Phantoms from Google Drive
if: ${{ steps.cache-phantoms.outputs.cache-hit != 'true' }} && ${{ !env.ACT }}
run: gdown ${{ secrets.ZIPPED_OPEN_NEURO_PET_PHANTOMS_URL }} -O PHANTOMS.zip
- name: Decompress phantoms windows
if: steps.cache-phantoms.outputs.cache-hit != 'true' && !env.ACT && runner.os == 'Windows'
run: powershell -command "Expand-Archive PHANTOMS.zip"
- name: Decompress phantoms posix
if: steps.cache-phantoms.outputs.cache-hit != 'true' && !env.ACT && runner.os != 'Windows'
run: unzip PHANTOMS.zip
- name: Copy Conversion Scripts from Version Control
run: |
mkdir -p OpenNeuroPET-Phantoms/code/
cp scripts/matlab_conversions.m OpenNeuroPET-Phantoms/code/matlab_conversions.m
cp scripts/python_conversions.sh OpenNeuroPET-Phantoms/code/python_conversions.sh
- name: Debug
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
timeout-minutes: 15
with:
limit-access-to-actor: true
- name: Run Python Conversion Script on Phantoms
run: |
cd OpenNeuroPET-Phantoms/code
bash python_conversions.sh
- name: SetupMatlab
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: matlab-actions/setup-matlab@v1
- name: Run Matlab Conversion Script on Phantoms
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: matlab-actions/run-command@v1
with:
command: |
addpath('${{ github.workspace }}/OpenNeuroPET-Phantoms/code')
addpath('${{ env.MATLAB_CODE_PATH }}');
addpath('${{ env.MATLAB_CODE_PATH }}/unit_tests');
addpath('${{ env.MATLAB_CODE_PATH }}/template_txt');
addpath('${{ env.SMALLER_ECAT_PATH }}');
addpath('${{ env.METADATA_PATH }}');
matlab_conversions
- name: Check Parity
run: |
python scripts/compare_jsons.py OpenNeuroPET-Phantoms/python OpenNeuroPET-Phantoms/matlab
- name: Validate Python Conversion
run: |
bids-validator OpenNeuroPET-Phantoms/python
- name: Validate Matlab Conversion
run: |
bids-validator OpenNeuroPET-Phantoms/matlab