Skip to content

Commit 35c2e5d

Browse files
committed
remove mriqc leftovers
1 parent b0b9d84 commit 35c2e5d

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

nipype/sphinxext/plot_workflow.py

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,49 @@
33
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
44
# vi: set ft=python sts=4 ts=4 sw=4 et:
55
"""
6+
7+
8+
:mod:`nipype.sphinxext.plot_workflow` -- Workflow plotting extension
9+
====================================================================
10+
11+
612
A directive for including a nipype workflow graph in a Sphinx document.
713
14+
This code is forked from the plot_figure sphinx extension of matplotlib.
15+
816
By default, in HTML output, `workflow` will include a .png file with a
917
link to a high-res .png. In LaTeX output, it will include a
1018
.pdf.
1119
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()
1328
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()
1739
1840
1941
Options
2042
-------
2143
2244
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.
2349
format : {'python', 'doctest'}
2450
Specify the format of the input
2551
include-source : bool
@@ -90,8 +116,7 @@
90116
from docutils.parsers.rst import directives
91117
from docutils.parsers.rst.directives.images import Image
92118

93-
from mriqc.utils.misc import check_folder as mkdirs
94-
119+
from nipype.utils.filemanip import mkdirp
95120

96121

97122
try:
@@ -661,9 +686,7 @@ def run(arguments, content, options, state_machine, state, lineno):
661686
state_machine.insert_input(total_lines, source=source_file_name)
662687

663688
# 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)
667690
for code_piece, images in results:
668691
for img in images:
669692
for fn in img.filenames():

nipype/utils/filemanip.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import hashlib
1717
from hashlib import md5
1818
import os
19+
from errno import EEXIST
1920
import re
2021
import shutil
2122
import posixpath
@@ -425,6 +426,18 @@ def copyfiles(filelist, dest, copy=False, create_new=False):
425426
newfiles.insert(i, destfile)
426427
return newfiles
427428

429+
def mkdirp(folder):
430+
"""
431+
Equivalent to bash's mkdir -p
432+
"""
433+
if not os.path.exists(folder):
434+
try:
435+
os.makedirs(folder)
436+
except OSError as exc:
437+
if not exc.errno == EEXIST:
438+
raise
439+
return folder
440+
428441

429442
def filename_to_list(filename):
430443
"""Returns a list given either a string or a list

0 commit comments

Comments
 (0)