add dcm2niix binaries #417
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: phantoms | |
| on: | |
| workflow_call: | |
| push: | |
| branches: | |
| - main | |
| - switch-phantoms-to-s3 | |
| 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-latest, windows-latest, macOS-latest] | |
| python: ["3.12"] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v2 | |
| - name: Cache Node Posix | |
| if: runner.os != 'Windows' && !env.ACT | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: npm-${{ runner.os }}-${{ env.cache-name }} | |
| - name: Cache Phantoms | |
| if: ${{ !env.ACT }} | |
| id: phantom-cache | |
| uses: actions/cache@v4 | |
| 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: Set up python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| pypet2bids/pyproject.toml | |
| - name: Install UV (Linux/macOS) | |
| if: runner.os != 'Windows' | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh && echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
| - name: Install UV (Windows) | |
| if: runner.os == 'Windows' | |
| run: | | |
| powershell -c "irm https://astral.sh/uv/install.ps1 | iex" | |
| echo "$env:USERPROFILE\.cargo\bin" >> $env:GITHUB_PATH | |
| - name: Install Python Dependencies | |
| run: | | |
| cd pypet2bids | |
| pip install -e .[dev] | |
| - name: Install UV Build Package | |
| run: | | |
| make installuv | |
| make buildpackage | |
| cd pypet2bids && uv pip install dist/pypet2bids-*.whl --system | |
| dcm2niix4pet -h | |
| - name: Set Up Node | |
| uses: actions/setup-node@v4 | |
| - name: Install BIDS Validator | |
| run: npm install -g [email protected] | |
| - name: Collect Phantoms (Linux/macOS) | |
| if: ${{ steps.cache-phantoms.outputs.cache-hit != 'true' }} && ${{ !env.ACT }} && runner.os != 'Windows' | |
| run: wget -O PHANTOMS.zip https://openneuropet.s3.amazonaws.com/US-sourced-OpenNeuroPET-Phantoms.zip | |
| - name: Collect Phantoms (Windows) | |
| if: ${{ steps.cache-phantoms.outputs.cache-hit != 'true' }} && ${{ !env.ACT }} && runner.os == 'Windows' | |
| run: Invoke-WebRequest -Uri "https://openneuropet.s3.amazonaws.com/US-sourced-OpenNeuroPET-Phantoms.zip" -OutFile "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-latest' }} | |
| uses: matlab-actions/setup-matlab@v1 | |
| # note matlab-actions/setup-matlab@v2 breaks this script, don't update unless you're forced to | |
| #with: | |
| #release: 'R2023a' | |
| #cache: true | |
| - name: Run Matlab Conversion Script on Phantoms | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| 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 | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| python scripts/compare_jsons.py OpenNeuroPET-Phantoms/python OpenNeuroPET-Phantoms/matlab | |
| - name: Validate Python Conversion | |
| run: | | |
| bids-validator OpenNeuroPET-Phantoms/python | |
| - 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: Validate Matlab Conversion | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| bids-validator OpenNeuroPET-Phantoms/matlab |