Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch phantoms to s3, update CI, fix bug with updatepetjson.m on GE dicoms #259

Merged
merged 9 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/phantoms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- switch-phantoms-to-s3
pull_request:
branches:
- main
Expand Down Expand Up @@ -84,7 +85,6 @@ jobs:
run: |
cd pypet2bids
pip install .
pip install gdown

- name: Install Poetry Build Package
run: |
Expand All @@ -99,9 +99,9 @@ jobs:
- name: Install BIDS Validator
run: npm install -g bids-validator

- name: Collect Phantoms from Google Drive
- name: Collect Phantoms
if: ${{ steps.cache-phantoms.outputs.cache-hit != 'true' }} && ${{ !env.ACT }}
run: gdown ${{ secrets.ZIPPED_OPEN_NEURO_PET_PHANTOMS_URL }} -O PHANTOMS.zip
run: wget -O PHANTOMS.zip https://openneuropet.s3.amazonaws.com/US-sourced-OpenNeuroPET-Phantoms.zip

- name: Decompress phantoms windows
if: steps.cache-phantoms.outputs.cache-hit != 'true' && !env.ACT && runner.os == 'Windows'
Expand Down
44 changes: 26 additions & 18 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
branches:
- main
- switch-phantoms-to-s3
workflow_call:
workflow_dispatch:
inputs:
Expand All @@ -18,8 +19,7 @@ jobs:
runs-on: ${{ matrix.os }}

env:
ECAT_TEST_FOLDER: "cimbi36"
REAL_TEST_ECAT_PATH: cimbi36/Gris_102_19_2skan-2019.04.30.13.04.41_em_3d.v
REAL_ECAT_TEST_PATH: ${{ github.workspace }}/OpenNeuroPET-Phantoms/sourcedata/SiemensHRRT-JHU/Hoffman.v
SMALLER_ECAT_PATH: ${{ github.workspace }}/ecat_validation/ECAT7_multiframe.v.gz
TEST_ECAT_PATH: ${{ github.workspace }}/ecat_validation/ECAT7_multiframe.v
OUTPUT_NIFTI_PATH: ${{ github.workspace}}/pypet2bids/tests/ECAT7_multiframe.nii
Expand All @@ -36,41 +36,49 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Cache ECAT
id: cache-ecat
- name: Cache Phantoms
id: cache-phantoms
uses: actions/cache@v2
with:
path: cimbi36
key: ${{ runner.os }}-ecats
path: US-sourced-OpenNeuroPET-Phantoms.zip
key: ${{ runner.os }}-phantoms

- name: Set up python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
cd pypet2bids
pip3 install .
python -m pip install --upgrade pip
pip install poetry
poetry install --with dev

- name: Install gdown and collect Ecat from Google Drive
if: steps.cache-ecat.outputs.cache-hit != 'true'
run: "python3 -m pip install gdown && gdown ${{ secrets.CIMBI_ECAT_ON_GOOGLE_DRIVE }} -O ecat_test"
- name: Collect ECAT and other phantoms
if: steps.cache-phantoms.outputs.cache-hit != 'true'
run: "wget https://openneuropet.s3.amazonaws.com/US-sourced-OpenNeuroPET-Phantoms.zip"

- name: Decompress dataset
if: steps.cache-ecat.outputs.cache-hit != 'true'
run: "tar xvzf ecat_test && rm ecat_test"
- name: Decompress ECAT and other phantoms
run: "unzip US-sourced-OpenNeuroPET-Phantoms.zip"

- 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: Test CLI --help
run: |
cd pypet2bids/
python3 -m pypet2bids.ecat_cli --help
poetry run python3 -m pypet2bids.ecat_cli --help

- name: Test CLI Ecat Dump
run: |
cd pypet2bids/
python3 -m pypet2bids.ecat_cli ../${{ env.REAL_TEST_ECAT_PATH }} --dump
poetry run python3 -m pypet2bids.ecat_cli ${{ env.REAL_ECAT_TEST_PATH }} --dump

# the larger real data file uses too much ram for the github runner, we use the small file for
# heavy io operations instead
Expand All @@ -79,9 +87,9 @@ jobs:
gzip -d ${{ env.SMALLER_ECAT_PATH }}

- name: Test ecatread
run: "cd pypet2bids/ && python3 -m tests.test_ecatread"
run: "cd pypet2bids/ && poetry run python3 -m tests.test_ecatread"

- name: Run All Other Python Tests w/ Pytest
run: |
cd pypet2bids
pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/
poetry run pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/
8 changes: 6 additions & 2 deletions matlab/updatejsonpetfile.m
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,12 @@
else % returns none if actually seen as empty by get_recon_method
filemetadata.ReconMethodParameterLabels = "none";
filemetadata.ReconMethodParameterUnits = "none";
if isempty(filemetadata.ReconMethodParameterValues) % in cas user passes info
filemetadata.ReconMethodParameterValues = 0; % if none should be 0
try
if isempty(filemetadata.ReconMethodParameterValues) % in case user passes info
filemetadata.ReconMethodParameterValues = 0; % if none should be 0
end
catch
filemetadata.ReconMethodParameterValues = 0;
end
end
end
Expand Down
Loading
Loading