|
3 | 3 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
|
4 | 4 | # vi: set ft=python sts=4 ts=4 sw=4 et:
|
5 | 5 | """
|
| 6 | +
|
| 7 | +
|
| 8 | +:mod:`nipype.sphinxext.plot_workflow` -- Workflow plotting extension |
| 9 | +==================================================================== |
| 10 | +
|
| 11 | +
|
6 | 12 | A directive for including a nipype workflow graph in a Sphinx document.
|
7 | 13 |
|
| 14 | +This code is forked from the plot_figure sphinx extension of matplotlib. |
| 15 | +
|
8 | 16 | By default, in HTML output, `workflow` will include a .png file with a
|
9 | 17 | link to a high-res .png. In LaTeX output, it will include a
|
10 | 18 | .pdf.
|
11 | 19 | The source code for the workflow may be included as **inline content** to
|
12 |
| -the directive:: |
| 20 | +the directive `workflow`:: |
| 21 | +
|
| 22 | + .. workflow: |
| 23 | + :graph2use: flat |
| 24 | + :simple_form: no |
| 25 | +
|
| 26 | + from nipype.workflows.dmri.camino.connectivity_mapping import create_connectivity_pipeline |
| 27 | + wf = create_connectivity_pipeline() |
13 | 28 |
|
14 |
| - .. workflow:: |
15 |
| - from mriqc.workflows.anatomical import airmsk_wf |
16 |
| - wf = airmsk_wf() |
| 29 | +
|
| 30 | +For example, the following graph has been generated inserting the previous |
| 31 | +code block in this documentation: |
| 32 | +
|
| 33 | +.. workflow: |
| 34 | + :graph2use: flat |
| 35 | + :simple_form: no |
| 36 | +
|
| 37 | + from nipype.workflows.dmri.camino.connectivity_mapping import create_connectivity_pipeline |
| 38 | + wf = create_connectivity_pipeline() |
17 | 39 |
|
18 | 40 |
|
19 | 41 | Options
|
20 | 42 | -------
|
21 | 43 |
|
22 | 44 | The ``workflow`` directive supports the following options:
|
| 45 | + graph2use : {'hierarchical', 'colored', 'flat', 'orig', 'exec'} |
| 46 | + Specify the type of graph to be generated. |
| 47 | + simple_form: bool |
| 48 | + Whether the graph will be in detailed or simple form. |
23 | 49 | format : {'python', 'doctest'}
|
24 | 50 | Specify the format of the input
|
25 | 51 | include-source : bool
|
|
90 | 116 | from docutils.parsers.rst import directives
|
91 | 117 | from docutils.parsers.rst.directives.images import Image
|
92 | 118 |
|
93 |
| -from mriqc.utils.misc import check_folder as mkdirs |
94 |
| - |
| 119 | +from nipype.utils.filemanip import mkdirp |
95 | 120 |
|
96 | 121 |
|
97 | 122 | try:
|
@@ -661,9 +686,7 @@ def run(arguments, content, options, state_machine, state, lineno):
|
661 | 686 | state_machine.insert_input(total_lines, source=source_file_name)
|
662 | 687 |
|
663 | 688 | # copy image files to builder's output directory, if necessary
|
664 |
| - if not os.path.exists(dest_dir): |
665 |
| - mkdirs(dest_dir) |
666 |
| - |
| 689 | + mkdirp(dest_dir) |
667 | 690 | for code_piece, images in results:
|
668 | 691 | for img in images:
|
669 | 692 | for fn in img.filenames():
|
|
0 commit comments