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

REL: 0.8.5 #155

Merged
merged 6 commits into from
Oct 31, 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
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
Loading