Skip to content

Commit

Permalink
update release and dev
Browse files Browse the repository at this point in the history
  • Loading branch information
skoudoro committed Dec 14, 2023
1 parent e6ac9a3 commit e2e0316
Show file tree
Hide file tree
Showing 1,756 changed files with 98,771 additions and 105,165 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@
A ``CombinedWorkflow`` is a series of DIPY_ workflows organized together in a
way that the output of a workflow serves as input for the next one.
"""

###############################################################################
# First create your ``CombinedWorkflow`` class. Your ``CombinedWorkflow`` class
# file is usually located in the ``dipy/workflows`` directory.
First create your ``CombinedWorkflow`` class. Your ``CombinedWorkflow`` class
file is usually located in the ``dipy/workflows`` directory.
"""

from dipy.workflows.combined_workflow import CombinedWorkflow

###############################################################################
# ``CombinedWorkflow`` is the base class that will be extended to create our
# combined workflow.


from dipy.workflows.denoise import NLMeansFlow
from dipy.workflows.segment import MedianOtsuFlow

Expand All @@ -27,7 +24,6 @@
# processing section.



class DenoiseAndSegment(CombinedWorkflow):

"""
Expand All @@ -42,8 +38,8 @@ def _get_sub_flows(self):
]

"""
It is mandatory to implement this method if you want to make all the sub
workflows parameters available in commandline.
It is mandatory to implement this method if you want to make all the
sub workflows parameters available in commandline.
"""

def run(self, input_files, out_dir='', out_file='processed.nii.gz'):
Expand Down Expand Up @@ -84,59 +80,46 @@ def run(self, input_files, out_dir='', out_file='processed.nii.gz'):

###############################################################################
# Use ``self.get_io_iterator()`` in every workflow you create. This creates
# an ``IOIterator`` object that create output file names and directory structure
# based on the inputs and some other advanced output strategy parameters.
#
# an ``IOIterator`` object that create output file names and directory
# structure based on the inputs and some other advanced output strategy
# parameters.
#
# Iterating on the ``IOIterator`` object you created previously you
# conveniently get all input and output paths for every input file
# found when globbin the input parameters.
#
# In the ``IOIterator`` loop you can see how we create a new ``NLMeans`` workflow
# then run it using ``self.run_sub_flow``. Running it this way will pass any
# workflow specific parameter that was retrieved from the command line and will
# append the ones you specify as optional parameters (``out_dir`` in this case).
#
#
# In the ``IOIterator`` loop you can see how we create a new ``NLMeans``
# workflow then run it using ``self.run_sub_flow``. Running it this way will
# pass any workflow specific parameter that was retrieved from the command line
# and will append the ones you specify as optional parameters (``out_dir``
# in this case).
#
# Lastly, the outputs paths are retrieved using
# ``workflow.last_generated_outputs``. This allows to use ``denoise`` as the
# input for the ``MedianOtsuFlow``.


###############################################################################
#
# This is it for the combined workflow class! Now to be able to call it easily via
# command line, you need this last bit of code. It is usually in an executable
# file located in ``bin``.


from dipy.workflows.flow_runner import run_flow
###############################################################################
# This is the method that will wrap everything that is needed to make a workflow
# ready then run it.


# if __name__ == "__main__":
# run_flow(DenoiseAndSegment())
###############################################################################
# This is the only thing needed to make your workflow available through command
# line.
#
# Now just call the script you just made with ``-h`` to see the argparser help
#
#
# This is it for the combined workflow class! Now to be able to call it easily
# via command line, you need to add this workflow in 2 different files:
# - ``<dipy_root>/pyproject.toml``: open this file and add the following line
# to the ``[project.scripts]`` section:
# ``dipy_denoise_segment = "dipy.workflows.cli:run"``
# - ``<dipy_root>/dipy/workflows/cli.py``: open this file and add the workflow
# information to the ``cli_flows`` dictionary. The key is the name of the
# command line command and the value is a tuple with the module name and the
# workflow class name. In this case it would be:
# ``"dipy_denoise_segment": ("dipy.workflows.my_combined_workflow",
# "DenoiseAndSegment")``
#
# That`s it! Now you can call your workflow from anywhere with the command line.
# Let's just call the script you just made with ``-h`` to see the argparser help
# text::
#
# python combined_workflow_creation.py --help
#
# You should see all your parameters available along with some extra common ones
# like logging file and force overwrite. Also all the documentation you wrote
# about each parameter is there. Also note that every sub workflow optional
# parameter is available.
#
# Now call it for real with a nifti file to see the results. Experiment
# with the parameters and see the results::
#
# python combined_workflow_creation.py volume.nii.gz
#
# .. include:: ../links_names.inc
#
#
# dipy_denoise_segment --help
#
# You should see all your parameters available along with some extra common
# ones like logging file and force overwrite. Also all the documentation you
# wrote about each parameter is there.

###############################################################################
# .. include:: ../../links_names.inc
Expand Down
Loading

0 comments on commit e2e0316

Please sign in to comment.