Skip to content

Commit

Permalink
Merge pull request #59 from frheault/trx_integration_dipy_2
Browse files Browse the repository at this point in the history
Trx integration to Dipy (part 2)
  • Loading branch information
arokem committed Oct 7, 2023
2 parents 3998fbe + 99631da commit 86d5c98
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Expand Up @@ -12,8 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Expand Up @@ -10,6 +10,3 @@ __version__ = "{version}"
"""
fallback_version = "0.0"
local_scheme = "no-local-version"
authors = [
"Francois Rheault @FrancoisRheault",
]
1 change: 0 additions & 1 deletion scripts/tff_manipulate_datatype.py
Expand Up @@ -78,7 +78,6 @@ def main():
dtype_dict['positions'] = np.dtype(args.positions_dtype)
if args.offsets_dtype:
dtype_dict['offsets'] = np.dtype(args.offsets_dtype)

if args.dpv:
dtype_dict['dpv'] = {}
for name, dtype in args.dpv:
Expand Down
10 changes: 6 additions & 4 deletions setup.cfg
Expand Up @@ -21,19 +21,21 @@ include_package_data = True


[options]
python_requires = >=3.7
python_requires = >=3.8
setup_requires =
packaging >= 19.0
cython >= 0.29
install_requires =
setuptools_scm
deepdiff
nibabel >= 3
dipy@git+https://git@github.com/arokem/dipy@11a94c0fcf9b3
nibabel >= 5
numpy >= 1.22
dipy@git+https://git@github.com/frheault/dipy@cf4338d
fury

[options.extras_require]
doc = sphinx <= 6
doc = astroid==2.15.8
sphinx
pydata-sphinx-theme
sphinx-autoapi
numpydoc
Expand Down
16 changes: 13 additions & 3 deletions trx/trx_file_memmap.py
Expand Up @@ -1065,8 +1065,15 @@ def _create_trx_from_pointer(
ext = ".bool"
mem_adress, size = dict_pointer_size[elem_filename]

if root is not None and folder.startswith(root.rstrip("/")):
folder = folder.replace(root, "").lstrip("/")
if root is not None:
# This is for Unix
if os.name != 'nt' and folder.startswith(root.rstrip("/")):
folder = folder.replace(root, "").lstrip("/")
# These two are for Windows
elif os.path.isdir(folder) and os.path.basename(folder) in ['dpg', 'dpv', 'dps']:
folder = os.path.basename(folder)
else:
folder = ''

# Parse/walk the directory tree
if base == "positions" and folder == "":
Expand All @@ -1089,7 +1096,10 @@ def _create_trx_from_pointer(
shape=(trx.header["NB_STREAMLINES"]+1,),
dtype=ext[1:],
)
lengths = _compute_lengths(offsets)
if offsets[-1] != 0:
lengths = _compute_lengths(offsets)
else:
lengths = [0]
elif folder == "dps":
nb_scalar = size / trx.header["NB_STREAMLINES"]
if not nb_scalar.is_integer() or nb_scalar != dim:
Expand Down

0 comments on commit 86d5c98

Please sign in to comment.