Skip to content

Commit

Permalink
bump version, merge pull request #27 from NiftyPET/devel
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Sep 15, 2022
2 parents 767896f + f69c6ff commit 3171d7a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/comment-bot.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
name: Comment Bot
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issue_comment: {types: [created]}
pull_request_review_comment: {types: [created]}
jobs:
tag: # /tag <tagname> <commit>
if: startsWith(github.event.comment.body, '/tag ')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: React Seen
uses: actions/github-script@v2
uses: actions/github-script@v6
with:
script: |
const perm = await github.repos.getCollaboratorPermissionLevel({
const perm = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner, repo: context.repo.repo,
username: context.payload.comment.user.login})
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
? github.rest.reactions.createForIssueComment
: github.rest.reactions.createForPullRequestReviewComment)
if (!["admin", "write"].includes(perm.data.permission)){
post({
owner: context.repo.owner, repo: context.repo.repo,
Expand All @@ -40,12 +38,12 @@ jobs:
BODY: ${{ github.event.comment.body }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: React Success
uses: actions/github-script@v2
uses: actions/github-script@v6
with:
script: |
post = (context.eventName == "issue_comment"
? github.reactions.createForIssueComment
: github.reactions.createForPullRequestReviewComment)
? github.rest.reactions.createForIssueComment
: github.rest.reactions.createForPullRequestReviewComment)
post({
owner: context.repo.owner, repo: context.repo.repo,
comment_id: context.payload.comment.id, content: "rocket"})
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
runs-on: ubuntu-latest
name: Check
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: set PYSHA
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
Expand All @@ -35,13 +35,13 @@ jobs:
- run: pre-commit run -a --show-diff-on-failure
test:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: Test py${{ matrix.python }}
runs-on: [self-hosted, cuda, python]
strategy:
matrix:
python: [3.7, 3.9]
python: [3.7, '3.10']
name: Test py${{ matrix.python }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run setup-python
Expand All @@ -57,10 +57,10 @@ jobs:
name: PyPI Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
Expand Down
19 changes: 17 additions & 2 deletions niftypet/nimpa/prc/imio.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
- grouping: defines how series are recognised, i.e., either by time plus
series description ('t+d') or by the description only ('d'),
or by acquisition and series times plus series description
('a+t+d').
('a+t+d'), or using series instance unique id ('d+suid').
'''

# > insure that `folder` is Path object
Expand Down Expand Up @@ -648,6 +648,10 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
if [0x0008, 0x103e] in dhdr:
srs_dcrp = dhdr[0x0008, 0x103e].value

srs_uid = ''
if [0x020, 0x00e] in dhdr:
srs_uid = dhdr[0x020, 0x00e].value

prtcl = ''
# > protocol
if [0x018, 0x1030] in dhdr:
Expand Down Expand Up @@ -708,7 +712,7 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
recognised_series = True
break

if grouping == 'a+t+d':
elif grouping == 'a+t+d':
if (np.array_equal(srs[s]['imorient'], ornt)
and np.array_equal(srs[s]['imsize'], imsz)
and np.array_equal(srs[s]['voxsize'], vxsz)
Expand All @@ -725,6 +729,14 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
recognised_series = True
break

elif grouping == 'd+suid':
if (np.array_equal(srs[s]['imorient'], ornt)
and np.array_equal(srs[s]['imsize'], imsz)
and np.array_equal(srs[s]['voxsize'], vxsz)
and srs[s]['series'] == srs_dcrp and srs[s]['series_uid'] == srs_uid):
recognised_series = True
break

else:
raise ValueError('Unrecognised grouping option')

Expand All @@ -736,6 +748,8 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
s = acq_time + '_' + srs_time + '_' + srs_dcrp
elif grouping == 'd':
s = srs_dcrp
elif grouping == 'd+suid':
s = srs_dcrp + '_' + srs_uid[-10:]
else:
raise ValueError('Unrecognised grouping option')

Expand All @@ -748,6 +762,7 @@ def dcmsort(folder, copy_series=False, Cnt=None, outpath=None, grouping='t+d'):
srs[s]['tstudy'] = std_time
srs[s]['dstudy'] = std_date
srs[s]['series'] = srs_dcrp
srs[s]['series_uid'] = srs_uid
srs[s]['protocol'] = prtcl

if tinjct is not None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
# cuvec>=2.8.0
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4",
"ninst>=0.9.0", "cuvec-base", "miutil[cuda]>=0.4.0",
"ninst>=0.12.0", "cuvec-base", "miutil[cuda]>=0.4.0",
"scikit-build>=0.11.0", "cmake>=3.18", "ninja"]

[tool.setuptools_scm]
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ classifiers=
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
Topic :: Scientific/Engineering :: Medical Science Apps.
[options]
Expand All @@ -39,7 +40,7 @@ setup_requires=
setuptools>=42
wheel
setuptools_scm[toml]
ninst>=0.9.0
ninst>=0.12.0
scikit-build>=0.11.0
cmake>=3.18
ninja
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
setup_kwargs = {
"use_scm_version": True, "packages": find_packages(exclude=["tests"]),
"package_data": {"niftypet": ["nimpa/auxdata/*"]}, "install_requires": [
'dipy>=1.3.0', 'miutil[nii]>=0.10.0', 'nibabel>=2.4.0', 'ninst>=0.4.0', 'numpy>=1.14',
'dipy>=1.3.0', 'miutil[nii]>=0.10.0', 'nibabel>=2.4.0', 'ninst>=0.12.0', 'numpy>=1.14',
'pydicom>=1.0.2', 'scipy', 'setuptools', 'spm12']}
# 'SimpleITK>=1.2.0'
cmake_args = [
Expand Down

0 comments on commit 3171d7a

Please sign in to comment.