Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,7 @@ dmypy.json

# Pyre type checker
.pyre/

#cmp output
Notebooks/tractography_workflow/
Notebooks/segmentation_workflow/
235 changes: 13 additions & 222 deletions Notebooks/tractography_report.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:48:46,19 nipype.utils WARNING:\n",
"\t A newer version (1.5.1) of nipy/nipype is available. You are using 1.5.0\n"
]
}
],
"outputs": [],
"source": [
"# Imports\n",
"import os\n",
Expand Down Expand Up @@ -50,7 +41,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -60,15 +51,15 @@
" bids_ds_path = '/Volumes/SSD-Bercows/Joan/research/0_data/Sample_Multi-Modal_BIDS_dataset/ds-sample/'\n",
"\n",
"if user == 'andres':\n",
" bids_ds_path = '/home/andres/Desktop/BIDS/DS001_BIDS_andres/'\n",
" bids_ds_path = '/media/sf_UbuntuShare/BIDS/DS001_BIDS_andres/'\n",
"\n",
"deriv_cmp_dir = join(bids_ds_path, \"derivatives\", \"cmp\")\n",
"deriv_nipype_dir = join(bids_ds_path, \"nipype\", \"sub-01\", \"ses-01\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -88,9 +79,10 @@
" def _run_interface(self, runtime):\n",
"\n",
" # Call our python code here:\n",
" self.fig_file = self._tractography_plot(\n",
" self.fig_file = []\n",
" self.fig_file.append(self._tractography_plot(\n",
" self.inputs.trk_file[0]\n",
" )\n",
" ))\n",
"\n",
" # And we are done\n",
" return runtime\n",
Expand Down Expand Up @@ -130,17 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"trk_path = '/home/andres/Desktop/BIDS/DS001_BIDS_andres/derivatives/cmp/sub-01/dwi/sub-01_model-CSD_desc-DET_tractogram.trk'\n",
"trk_image = dis.load_trk('/home/andres/Desktop/BIDS/DS001_BIDS_andres/derivatives/cmp/sub-01/dwi/sub-01_model-CSD_desc-DET_tractogram.trk', trk_path)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -183,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -202,7 +184,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -214,200 +196,9 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:07,606 nipype.workflow INFO:\n",
"\t Workflow tractography_workflow settings: ['check', 'execution', 'logging', 'monitoring']\n",
"210326-16:50:07,806 nipype.workflow INFO:\n",
"\t Running serially.\n",
"210326-16:50:07,807 nipype.workflow INFO:\n",
"\t [Node] Setting-up \"tractography_workflow.bids-grabber\" in \"/tmp/tmpxhothp5m/tractography_workflow/bids-grabber\".\n",
"210326-16:50:07,824 nipype.workflow INFO:\n",
"\t [Node] Running \"bids-grabber\" (\"nipype.interfaces.io.BIDSDataGrabber\")\n",
"210326-16:50:09,541 nipype.workflow INFO:\n",
"\t [Node] Finished \"tractography_workflow.bids-grabber\".\n",
"210326-16:50:09,542 nipype.workflow INFO:\n",
"\t [Node] Setting-up \"tractography_workflow.tractography_fig\" in \"/tmp/tmp9u6lswrj/tractography_workflow/tractography_fig\".\n",
"210326-16:50:09,546 nipype.workflow INFO:\n",
"\t [Node] Running \"tractography_fig\" (\"__main__.TractographyPlot\")\n",
"210326-16:50:17,664 nipype.workflow WARNING:\n",
"\t Storing result file without outputs\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:nipype.workflow:Storing result file without outputs\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,665 nipype.workflow WARNING:\n",
"\t [Node] Error on \"tractography_workflow.tractography_fig\" (/tmp/tmp9u6lswrj/tractography_workflow/tractography_fig)\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:nipype.workflow:[Node] Error on \"tractography_workflow.tractography_fig\" (/tmp/tmp9u6lswrj/tractography_workflow/tractography_fig)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,667 nipype.workflow ERROR:\n",
"\t Node tractography_fig failed to run on host andres-VirtualBox.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR:nipype.workflow:Node tractography_fig failed to run on host andres-VirtualBox.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,668 nipype.workflow ERROR:\n",
"\t Saving crash info to /home/andres/Desktop/BIDS/cmp3-dev/Notebooks/crash-20210326-165017-andres-tractography_fig-7a1433f2-3b42-4be1-b24d-58e288dd77a2.pklz\n",
"Traceback (most recent call last):\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/plugins/linear.py\", line 46, in run\n",
" node.run(updatehash=updatehash)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py\", line 516, in run\n",
" result = self._run_interface(execute=True)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py\", line 635, in _run_interface\n",
" return self._run_command(execute)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py\", line 741, in _run_command\n",
" result = self._interface.run(cwd=outdir)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/interfaces/base/core.py\", line 399, in run\n",
" outputs = self.aggregate_outputs(runtime)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/interfaces/base/core.py\", line 508, in aggregate_outputs\n",
" raise error\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/interfaces/base/core.py\", line 500, in aggregate_outputs\n",
" setattr(outputs, key, val)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/traits/trait_types.py\", line 2363, in validate\n",
" self.error(object, name, value)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/traits/base_trait_handler.py\", line 77, in error\n",
" object, name, self.full_info(object, name, value), value\n",
"traits.trait_errors.TraitError: The 'fig_file' trait of a TractographyPlotOutputSpec instance must be a list of items which are any value, but a value of '/home/andres/Desktop/BIDS/DS001_BIDS_andres/derivatives/nipype/sub-01/tractography.png' <class 'str'> was specified.\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR:nipype.workflow:Saving crash info to /home/andres/Desktop/BIDS/cmp3-dev/Notebooks/crash-20210326-165017-andres-tractography_fig-7a1433f2-3b42-4be1-b24d-58e288dd77a2.pklz\n",
"Traceback (most recent call last):\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/plugins/linear.py\", line 46, in run\n",
" node.run(updatehash=updatehash)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py\", line 516, in run\n",
" result = self._run_interface(execute=True)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py\", line 635, in _run_interface\n",
" return self._run_command(execute)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/nodes.py\", line 741, in _run_command\n",
" result = self._interface.run(cwd=outdir)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/interfaces/base/core.py\", line 399, in run\n",
" outputs = self.aggregate_outputs(runtime)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/interfaces/base/core.py\", line 508, in aggregate_outputs\n",
" raise error\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/interfaces/base/core.py\", line 500, in aggregate_outputs\n",
" setattr(outputs, key, val)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/traits/trait_types.py\", line 2363, in validate\n",
" self.error(object, name, value)\n",
" File \"/home/andres/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/traits/base_trait_handler.py\", line 77, in error\n",
" object, name, self.full_info(object, name, value), value\n",
"traits.trait_errors.TraitError: The 'fig_file' trait of a TractographyPlotOutputSpec instance must be a list of items which are any value, but a value of '/home/andres/Desktop/BIDS/DS001_BIDS_andres/derivatives/nipype/sub-01/tractography.png' <class 'str'> was specified.\n",
"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,688 nipype.workflow INFO:\n",
"\t ***********************************\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:nipype.workflow:***********************************\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,689 nipype.workflow ERROR:\n",
"\t could not run node: tractography_workflow.tractography_fig\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"ERROR:nipype.workflow:could not run node: tractography_workflow.tractography_fig\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,690 nipype.workflow INFO:\n",
"\t crashfile: /home/andres/Desktop/BIDS/cmp3-dev/Notebooks/crash-20210326-165017-andres-tractography_fig-7a1433f2-3b42-4be1-b24d-58e288dd77a2.pklz\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:nipype.workflow:crashfile: /home/andres/Desktop/BIDS/cmp3-dev/Notebooks/crash-20210326-165017-andres-tractography_fig-7a1433f2-3b42-4be1-b24d-58e288dd77a2.pklz\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"210326-16:50:17,691 nipype.workflow INFO:\n",
"\t ***********************************\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:nipype.workflow:***********************************\n"
]
},
{
"ename": "RuntimeError",
"evalue": "Workflow did not execute cleanly. Check log for details",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-2a459d17165d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mworkflow\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moverlay\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'fig_file'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreport\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'fig_file'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0mworkflow\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/engine/workflows.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, plugin, plugin_args, updatehash)\u001b[0m\n\u001b[1;32m 630\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstr2bool\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconfig\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"execution\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"create_report\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 631\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_write_report_info\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbase_dir\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecgraph\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 632\u001b[0;31m \u001b[0mrunner\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mexecgraph\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mupdatehash\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mupdatehash\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconfig\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 633\u001b[0m \u001b[0mdatestr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdatetime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mutcnow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstrftime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"%Y%m%dT%H%M%S\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 634\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mstr2bool\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconfig\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"execution\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"write_provenance\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/plugins/linear.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self, graph, config, updatehash)\u001b[0m\n\u001b[1;32m 68\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 69\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchdir\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mold_wd\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# Return wherever we were before\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 70\u001b[0;31m \u001b[0mreport_nodes_not_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnotrun\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/miniconda3/envs/py37cmp-gui/lib/python3.7/site-packages/nipype/pipeline/plugins/tools.py\u001b[0m in \u001b[0;36mreport_nodes_not_run\u001b[0;34m(notrun)\u001b[0m\n\u001b[1;32m 96\u001b[0m \u001b[0mlogger\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"***********************************\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 97\u001b[0m raise RuntimeError(\n\u001b[0;32m---> 98\u001b[0;31m \u001b[0;34m(\u001b[0m\u001b[0;34m\"Workflow did not execute cleanly. \"\u001b[0m \u001b[0;34m\"Check log for details\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 99\u001b[0m )\n\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mRuntimeError\u001b[0m: Workflow did not execute cleanly. Check log for details"
]
}
],
"outputs": [],
"source": [
"workflow = Workflow(\"tractography_workflow\")\n",
"\n",
Expand Down