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

[NF] Add workflow to convert tensors in different formats #3053

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

skoudoro
Copy link
Member

This PR allow the possible to convert tensor files from different software. it should help user to import their data from other software or visualize data processed by DIPY in other software.

@pep8speaks
Copy link

pep8speaks commented Jan 30, 2024

Hello @skoudoro, Thank you for updating !

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated at 2024-01-30 02:11:09 UTC

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (8c48165) 81.95% compared to head (26869b3) 81.99%.
Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3053      +/-   ##
==========================================
+ Coverage   81.95%   81.99%   +0.04%     
==========================================
  Files         147      147              
  Lines       20710    20740      +30     
  Branches     3330     3337       +7     
==========================================
+ Hits        16972    17005      +33     
+ Misses       2905     2903       -2     
+ Partials      833      832       -1     
Files Coverage Δ
dipy/reconst/utils.py 98.30% <100.00%> (+0.30%) ⬆️
dipy/workflows/cli.py 42.85% <ø> (ø)
dipy/workflows/io.py 74.78% <91.66%> (+0.91%) ⬆️

... and 1 file with indirect coverage changes

@skoudoro
Copy link
Member Author

skoudoro commented Feb 2, 2024

Did you have the opportunity to try @tangwei?

@tangwei
Copy link

tangwei commented Feb 2, 2024

Did you have the opportunity to try @tangwei?

I tried to install from the branch following your video instruction. I came to the point of checkout, but after I clicked the checkout button on the pull request description page:

image

I found myself in "pr/skoudoro/3053" rather than "convert-tensors":

image

I ran pip install . but it doesn't seem to be the correct version and doesn't have convert_tensors.

image image

I then tried pip install --no-build-isolation -v -e ., and this time the installation failed. Below is the output. I suspect the checkout took me to a wrong branch?

Using pip 22.3.1 from /Users/wei/anaconda3/lib/python3.10/site-packages/pip (python 3.10)
Obtaining file:///Users/wei/dipy/dipy
Running command Checking if build backend supports build_editable
Checking if build backend supports build_editable ... done
ERROR: Exception:
Traceback (most recent call last):
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 400, in run
requirement_set = resolver.resolve(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 73, in resolve
collected = self.factory.collect_root_requirements(root_reqs)
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 491, in collect_root_requirements
req = self._make_requirement_from_install_req(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 453, in _make_requirement_from_install_req
cand = self._make_candidate_from_link(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 185, in _make_candidate_from_link
self._editable_candidate_cache[link] = EditableCandidate(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 322, in init
super().init(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in init
self.dist = self._prepare()
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
dist = self._prepare_distribution()
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 332, in _prepare_distribution
return self._factory.preparer.prepare_editable_requirement(self._ireq)
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/operations/prepare.py", line 633, in prepare_editable_requirement
dist = _get_prepared_distribution(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/operations/prepare.py", line 69, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/distributions/sdist.py", line 61, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 527, in prepare_metadata
and self.supports_pyproject_editable()
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_internal/req/req_install.py", line 241, in supports_pyproject_editable
return "build_editable" in self.pep517_backend._supported_features()
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_vendor/pep517/wrappers.py", line 160, in _supported_features
return self._call_hook('_supported_features', {})
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_vendor/pep517/wrappers.py", line 319, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pep517.wrappers.BackendUnavailable: Traceback (most recent call last):
File "/Users/wei/anaconda3/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
File "/Users/wei/anaconda3/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mesonpy'

@skoudoro
Copy link
Member Author

skoudoro commented Feb 2, 2024

I found myself in "pr/skoudoro/3053" rather than "convert-tensors":

The branch is correct

I then tried pip install --no-build-isolation -v -e .

this is correct. Before that, you need to do pip install -r requirements/build.txt. you are just missing some packages

Let me know if it goes ok @tangwei . Thanks !

@tangwei
Copy link

tangwei commented Feb 2, 2024

Ah okay, now it installed correctly and I saw dipy_convert_tensors. I don't have tensor files from other software for testing though. @skoudoro do you know if there are test data somewhere I could use directly?

@skoudoro
Copy link
Member Author

skoudoro commented Feb 2, 2024

@skoudoro do you know if there are test data somewhere I could use directly?

No, sorry...

@skoudoro
Copy link
Member Author

skoudoro commented Feb 8, 2024

Do you have an update on this @tangwei ?

@tangwei
Copy link

tangwei commented Feb 8, 2024

The installation worked and I can pull up -help no problem. But I don't have data to test it. I basically don't have tensor files from other software.

@skoudoro
Copy link
Member Author

skoudoro commented Feb 8, 2024

in this case, the easy way is:

  • get dipy tensor
  • convert to fsl tensor
  • open with fsleyes the new tensor (it should look good)
  • open with fsleyes dipy tensor
  • open with dipy_horizon both tensor also (it should be different)

@tangwei
Copy link

tangwei commented Feb 8, 2024

Got ya. Will do!

@tangwei
Copy link

tangwei commented Feb 11, 2024

in this case, the easy way is:

  • get dipy tensor
  • convert to fsl tensor
  • open with fsleyes the new tensor (it should look good)
  • open with fsleyes dipy tensor
  • open with dipy_horizon both tensor also (it should be different)

@skoudoro I followed the DIPY tutorial to create tensor variables, but what file format should I save them as? Can you give me an example for the dipy tensor output?

@skoudoro
Copy link
Member Author

@Garyfallidis Garyfallidis merged commit 70f98b8 into dipy:master Mar 5, 2024
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants