Created
August 17, 2012 16:49
-
-
Save satra/3380502 to your computer and use it in GitHub Desktop.
provenance from a nipype interface
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
| from nipype.interfaces.fsl import BET | |
| res = BET(in_file='struct.nii').run() | |
| import nipype.external.prov as prov | |
| import nipype.external.provgraph as pg | |
| g = prov.json.load(open('provenance.json'), cls=prov.ProvBundle.JSONDecoder) | |
| dot = pg.prov_to_dot(g) | |
| dot.set_dpi(120) | |
| dot.write_png('test.png') |
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
| from nipype.interfaces.fsl import BET, FLIRT, Info | |
| from nipype.pipeline.engine import Workflow, Node | |
| import os | |
| wf = Workflow(name='testprov') | |
| wf.base_dir = os.getcwd() | |
| node = Node(BET(in_file=os.path.abspath('struct.nii')), name='better') | |
| flirter = Node(FLIRT(), name = 'flirter') | |
| flirter.inputs.reference = Info.standard_image('MNI152_T1_1mm_brain.nii.gz') | |
| wf.connect(node, 'out_file', flirter, 'in_file') | |
| eg = wf.run() | |
| from nipype.pipeline.utils import write_prov | |
| g = write_prov(eg) | |
| import nipype.external.prov as prov | |
| import nipype.external.provgraph as pg | |
| g = prov.json.load(open('workflow_provenance.json'), cls=prov.ProvBundle.JSONDecoder) | |
| pg.provjson_to_filename(g, 'workflow_test.png', use_labels=True) | |
| pg.provjson_to_filename(g, 'workflow_test.pdf', format='pdf', use_labels=True) | |
| pg.provjson_to_filename(g, 'workflow_test.svg', format='svg', use_labels=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment