Skip to content

Commit

Permalink
REL: 0.8.5 (#155)
Browse files Browse the repository at this point in the history
* Prep for release, test 3.13 compatibility

* Wheels for python 3.13 not availible for scipy 1.13, bump to >=1.14

* Change test install strategy to avoid pypi conda conflicts.

* Fix mistake in pytest call for orientation marker.

* Try adding PIL as dependency.

* move from package_resources to importlib.resources for python 3.12+ compat
  • Loading branch information
wtclarke authored Oct 31, 2024
1 parent 9392c2a commit 3ba4b3c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/push_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: [ "3.9", "3.10", "3.11", "3.12"]
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -38,6 +38,6 @@ jobs:
- name: Run pytest
shell: bash -l {0}
run: |
conda install pytest h5py
pip install .
pytest -k "not orientation" tests
conda install pytest h5py pillow
pip install --no-deps .
pytest -m "not orientation" tests
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
This document contains the Spec2nii release history in reverse chronological order.

0.8.5 (Thursday 31st October 2024)
----------------------------------
- Add special case handling for DICOM dkd_svs_mslaser_msspnav sequence
- More GE HBCD sequence adjustments.
- Python 3.13 compatibility and testing, scipy dependency now >=1.13

0.8.4 (Monday 23rd September 2024)
-------------------------------
- GE HBCD sequence adjustments.
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent"],
python_requires='>=3.9',
Expand Down
57 changes: 30 additions & 27 deletions spec2nii/bruker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Copyright (C) 2021 Institute of Scientific Instruments of the CAS, v. v. i.
"""
import os
import pkg_resources
import importlib.resources as importlib_resources
import warnings
from datetime import datetime

Expand Down Expand Up @@ -64,40 +64,43 @@ def yield_bruker(args):
2/ Directory - function yields data and properties and data of all datasets compliant to the queries
"""
# get location of the spec2nii Bruker properties configuration file
bruker_properties_path = pkg_resources.resource_filename('spec2nii', 'bruker_properties.json')
bruker_fid_override_path = pkg_resources.resource_filename('spec2nii', 'bruker_fid_override.json')

# get a list of queries to filter datasets
queries = _get_queries(args)

# case of Bruker dataset
if os.path.isfile(args.file):
d = Dataset(
args.file,
property_files=[bruker_fid_override_path, bruker_properties_path],
parameter_files=['method'])
try:
d.query(queries)
except FilterEvalFalse:
raise ValueError(f'Bruker dataset {d.path} is not suitable for conversion to mrs_nifti')
yield from _proc_dataset(d, args)

# case of folder containing Bruker datasets
elif os.path.isdir(args.file):

# process individual datasets
for dataset in Folder(args.file, dataset_state={
"parameter_files": ['method'],
"property_files": [bruker_properties_path]
}).get_dataset_list_rec():
with dataset as d:
# get location of the spec2nii Bruker properties configuration file
ref1 = importlib_resources.files('spec2nii') / 'bruker_properties.json'
ref2 = importlib_resources.files('spec2nii') / 'bruker_fid_override.json'

with importlib_resources.as_file(ref1) as bruker_properties_path:
with importlib_resources.as_file(ref2) as bruker_fid_override_path:

# case of Bruker dataset
if os.path.isfile(args.file):
d = Dataset(
args.file,
property_files=[bruker_fid_override_path, bruker_properties_path],
parameter_files=['method'])
try:
d.query(queries)
except FilterEvalFalse:
continue
raise ValueError(f'Bruker dataset {d.path} is not suitable for conversion to mrs_nifti')
yield from _proc_dataset(d, args)

# case of folder containing Bruker datasets
elif os.path.isdir(args.file):

# process individual datasets
for dataset in Folder(args.file, dataset_state={
"parameter_files": ['method'],
"property_files": [bruker_properties_path]
}).get_dataset_list_rec():
with dataset as d:
try:
d.query(queries)
except FilterEvalFalse:
continue
yield from _proc_dataset(d, args)


def _get_queries(args):
"""
Expand Down

0 comments on commit 3ba4b3c

Please sign in to comment.