Skip to content

Commit

Permalink
Merge pull request dipy#3101 from skoudoro/fix-log-workflows
Browse files Browse the repository at this point in the history
[BF] Uniformize cython version
  • Loading branch information
Garyfallidis authored Mar 6, 2024
2 parents 8f604d5 + 26fee3b commit 379062e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dipy/workflows/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ class ConvertTensorsFlow(Workflow):
def get_short_name(cls):
return 'convert_tensors'

def run(self, tensor_files, from_format='dipy', to_format='mrtrix',
def run(self, tensor_files, from_format='mrtrix', to_format='dipy',
out_dir='.', out_tensor='converted_tensor'):
"""Converts tensor representation between different formats.
Expand Down
8 changes: 5 additions & 3 deletions dipy/workflows/reconst.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def run(self, data_files, bvals_files, bvecs_files, small_delta, big_delta,
save_nifti(out_parng, n.astype(np.float32), affine)

logging.info('MAPMRI saved in {0}'.
format(os.path.dirname(out_dir)))
format(os.path.abspath(out_dir)))


class ReconstDtiFlow(Workflow):
Expand Down Expand Up @@ -404,7 +404,8 @@ def run(self, input_files, bvalues_files, bvectors_files, mask_files,
save_nifti(oevals, tenfit.evals.astype(np.float32), affine)

if save_metrics:
logging.info('DTI metrics saved to')
msg = f'DTI metrics saved to {os.path.abspath(out_dir)}'
logging.info(msg)
for metric in save_metrics:
logging.info(self.last_generated_outputs["out_" + metric])

Expand Down Expand Up @@ -530,7 +531,8 @@ def run(self, input_files, bvalues_files, bvectors_files, mask_files,
peaks_to_niftis(peaks_dsi, oshm, opeaks_dir, opeaks_values,
opeaks_indices, reshape_dirs=True)

logging.info('DSI metrics saved to {0}'.format(out_dir))
logging.info('DSI metrics saved to {0}'.
format(os.path.abspath(out_dir)))


class ReconstCSDFlow(Workflow):
Expand Down
15 changes: 10 additions & 5 deletions doc/recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,34 @@ answer it yourself and contribute to the documentation!
save_tractogram(my_trk.streamlines, my_trk_file_path, 'same')
.. dropdown:: How do I convert my Spherical Harmonics from DIPY to MRTRIX3?
.. dropdown:: How do I convert my Spherical Harmonics from MRTRIX3 to DIPY?
:animate: fade-in-slide-down

*Available only on master branch. See `this thread <https://github.com/dipy/dipy/discussions/2959#discussioncomment-7481675>`_ for more information.
*Available from DIPY 1.9.0+. See `this thread <https://github.com/dipy/dipy/discussions/2959#discussioncomment-7481675>`_ for more information.
.. code-block:: Python
from dipy.reconst.shm import convert_sh_descoteaux_tournier
convert_sh_descoteaux_tournier(sh_coeffs)
.. dropdown:: How do I convert my tensors from DIPY to FSL?
.. dropdown:: How do I convert my tensors from FSL to DIPY or MRTRIX3 to DIPY?
:animate: fade-in-slide-down

*Available only on master branch
*Available with DIPY 1.9.0+
.. code-block:: Python
from dipy.reconst.utils import convert_tensors
from dipy.io.image import load_nifti, save_nifti
data, affine, img = load_nifti('my_data.nii.gz', return_img=True)
otensor = convert_tensors(data, 'dipy', 'fsl')
# convert from FSL to DIPY
otensor = convert_tensors(data, 'fsl', 'dipy')
save_nifti(otensor, data, affine, image.header)
# convert from MRTRIX3 to DIPY
otensor = convert_tensors(data, 'mrtrix', 'dipy')
save_nifti(otensor, data, affine, image.header)
.. include:: links_names.inc
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "dipy"
description = "Diffusion MRI Imaging in Python"
license = {file = "LICENSE"}
readme = "README.rst"
requires-python = ">=3.8"
requires-python = ">=3.9"
authors = [{ name = "DIPY developers", email = "[email protected]" }]
maintainers = [
{name = "Eleftherios Garyfallidis", email="[email protected]"},
Expand Down Expand Up @@ -99,7 +99,7 @@ dev = [
'setuptools>=67',
'packaging>=21',
'ninja',
'Cython>=0.29.32',
'Cython>=0.29.35',
'numpy>=1.22',
# Developer UI
'spin>=0.5',
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Check against .travis.yml file and dipy/info.py
cython>=0.29.24, !=0.29.29
cython>=0.29.35, !=0.29.29
numpy>=1.22.4
scipy>=1.8.1
nibabel>=4.0.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/build.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
meson-python>=0.13
ninja
Cython>=0.29.21
Cython>=0.29.35
packaging>=20.0
wheel
build
Expand Down

0 comments on commit 379062e

Please sign in to comment.