-
Notifications
You must be signed in to change notification settings - Fork 533
[ENH] Add all DIPY workflows dynamically #2905
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a854869
add get_dipy_workflows function
skoudoro 61ebb29
add tests
skoudoro dfef177
add preprocessing cmd line
skoudoro ab693cf
update reconst cmd line
skoudoro 2575f3d
update registration cmd line
skoudoro 0a2ff69
add stats cmd line
skoudoro f1fc014
update track cmd line
skoudoro 5f2445c
update zenodo
skoudoro 289d856
fix tests
skoudoro 4f09bac
doctest skip
skoudoro ece338b
fix doctests error
skoudoro bdd4d21
address ariel comment
skoudoro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,13 @@ | |
from ... import logging | ||
from ..base import TraitedSpec, File, traits, isdefined | ||
from .base import (DipyDiffusionInterface, DipyBaseInterfaceInputSpec, | ||
HAVE_DIPY, dipy_version, dipy_to_nipype_interface) | ||
HAVE_DIPY, dipy_version, dipy_to_nipype_interface, | ||
get_dipy_workflows) | ||
|
||
|
||
IFLOGGER = logging.getLogger('nipype.interface') | ||
|
||
if HAVE_DIPY and LooseVersion(dipy_version()) >= LooseVersion('0.15'): | ||
if HAVE_DIPY and (LooseVersion('0.15') >= LooseVersion(dipy_version()) >= LooseVersion('0.16')): | ||
from dipy.workflows.reconst import (ReconstDkiFlow, ReconstCSAFlow, | ||
ReconstCSDFlow, ReconstMAPMRIFlow, | ||
ReconstDtiFlow) | ||
|
@@ -33,9 +34,19 @@ | |
DTIModel = dipy_to_nipype_interface("DTIModel", ReconstDtiFlow) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you want to remove these from here? |
||
CSAModel = dipy_to_nipype_interface("CSAModel", ReconstCSAFlow) | ||
CSDModel = dipy_to_nipype_interface("CSDModel", ReconstCSDFlow) | ||
|
||
elif HAVE_DIPY and LooseVersion(dipy_version()) >= LooseVersion('1.0'): | ||
from dipy.workflows import reconst | ||
|
||
l_wkflw = get_dipy_workflows(reconst) | ||
for name, obj in l_wkflw: | ||
new_name = name.replace('Flow', '') | ||
globals()[new_name] = dipy_to_nipype_interface(new_name, obj) | ||
del l_wkflw | ||
|
||
else: | ||
IFLOGGER.info("We advise you to upgrade DIPY version. This upgrade will" | ||
" activate DKIModel, MapmriModel, DTIModel, CSAModel, CSDModel.") | ||
" open access to more models") | ||
|
||
|
||
class RESTOREInputSpec(DipyBaseInterfaceInputSpec): | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
|
||
from distutils.version import LooseVersion | ||
from ... import logging | ||
from .base import HAVE_DIPY, dipy_version, dipy_to_nipype_interface | ||
from .base import (HAVE_DIPY, dipy_version, dipy_to_nipype_interface, | ||
get_dipy_workflows) | ||
|
||
IFLOGGER = logging.getLogger('nipype.interface') | ||
|
||
if HAVE_DIPY and LooseVersion(dipy_version()) >= LooseVersion('0.15'): | ||
if HAVE_DIPY and (LooseVersion('0.15') >= LooseVersion(dipy_version()) >= LooseVersion('0.16')): | ||
|
||
from dipy.workflows.align import ResliceFlow, SlrWithQbxFlow | ||
|
||
Reslice = dipy_to_nipype_interface("Reslice", ResliceFlow) | ||
StreamlineRegistration = dipy_to_nipype_interface("StreamlineRegistration", | ||
SlrWithQbxFlow) | ||
|
||
elif HAVE_DIPY and LooseVersion(dipy_version()) >= LooseVersion('1.0'): | ||
from dipy.workflows import align | ||
|
||
l_wkflw = get_dipy_workflows(align) | ||
for name, obj in l_wkflw: | ||
new_name = name.replace('Flow', '') | ||
globals()[new_name] = dipy_to_nipype_interface(new_name, obj) | ||
del l_wkflw | ||
|
||
else: | ||
IFLOGGER.info("We advise you to upgrade DIPY version. This upgrade will" | ||
" activate Reslice, StreamlineRegistration.") | ||
" open access to more function") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
from distutils.version import LooseVersion | ||
from ... import logging | ||
from .base import (HAVE_DIPY, dipy_version, dipy_to_nipype_interface, | ||
get_dipy_workflows) | ||
|
||
IFLOGGER = logging.getLogger('nipype.interface') | ||
|
||
if HAVE_DIPY and LooseVersion(dipy_version()) >= LooseVersion('0.16'): | ||
from dipy.workflows import stats | ||
|
||
l_wkflw = get_dipy_workflows(stats) | ||
for name, obj in l_wkflw: | ||
new_name = name.replace('Flow', '') | ||
globals()[new_name] = dipy_to_nipype_interface(new_name, obj) | ||
del l_wkflw | ||
|
||
else: | ||
IFLOGGER.info("We advise you to upgrade DIPY version. This upgrade will" | ||
" open access to more function") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in dipy/dipy#1800, I suggest that you set this list to be a module-level constant.
BTW: the fact that you are using this same code there suggests that this might be a pattern worth including in the dipy library code, instead of here.