|
38 | 38 | "from pathlib import Path\n", |
39 | 39 | "from tempfile import mkdtemp\n", |
40 | 40 | "import json\n", |
| 41 | + "import nest_asyncio\n", |
| 42 | + "\n", |
| 43 | + "# Allow running async code in Jupyter notebooks\n", |
| 44 | + "nest_asyncio.apply()\n", |
41 | 45 | "\n", |
42 | 46 | "JSON_CONTENTS = {'a': True, 'b': 'two', 'c': 3, 'd': [7, 0.55, 6]}\n", |
43 | 47 | "\n", |
|
57 | 61 | }, |
58 | 62 | { |
59 | 63 | "cell_type": "code", |
60 | | - "execution_count": 7, |
| 64 | + "execution_count": 2, |
61 | 65 | "metadata": {}, |
62 | | - "outputs": [], |
| 66 | + "outputs": [ |
| 67 | + { |
| 68 | + "name": "stderr", |
| 69 | + "output_type": "stream", |
| 70 | + "text": [ |
| 71 | + "A newer version (0.25) of nipype/pydra is available. You are using 0.25.dev128+g1e817743.d20250104\n" |
| 72 | + ] |
| 73 | + } |
| 74 | + ], |
63 | 75 | "source": [ |
64 | 76 | "# Import the task definition\n", |
65 | 77 | "from pydra.tasks.common import LoadJson\n", |
|
83 | 95 | }, |
84 | 96 | { |
85 | 97 | "cell_type": "code", |
86 | | - "execution_count": null, |
| 98 | + "execution_count": 3, |
87 | 99 | "metadata": {}, |
88 | 100 | "outputs": [], |
89 | 101 | "source": [ |
90 | 102 | "from pydra.engine.submitter import Submitter\n", |
91 | 103 | "\n", |
92 | | - "with Submitter(plugin='cf', n_procs=1) as submitter:\n", |
| 104 | + "with Submitter(plugin='serial', n_procs=1) as submitter:\n", |
93 | 105 | " result = submitter(load_json)" |
94 | 106 | ] |
95 | 107 | }, |
|
119 | 131 | }, |
120 | 132 | { |
121 | 133 | "cell_type": "code", |
122 | | - "execution_count": null, |
| 134 | + "execution_count": 4, |
123 | 135 | "metadata": {}, |
124 | 136 | "outputs": [], |
125 | 137 | "source": [ |
|
142 | 154 | }, |
143 | 155 | { |
144 | 156 | "cell_type": "code", |
145 | | - "execution_count": null, |
| 157 | + "execution_count": 5, |
146 | 158 | "metadata": {}, |
147 | | - "outputs": [], |
| 159 | + "outputs": [ |
| 160 | + { |
| 161 | + "ename": "AttributeError", |
| 162 | + "evalue": "'MrGrid' object has no attribute 'split'", |
| 163 | + "output_type": "error", |
| 164 | + "traceback": [ |
| 165 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 166 | + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", |
| 167 | + "Cell \u001b[0;32mIn[5], line 4\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mpydra\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtasks\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmrtrix3\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mv3_0\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MrGrid\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# Instantiate the task definition, \"splitting\" over all NIfTI files in the test directory\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m mrgrid \u001b[38;5;241m=\u001b[39m \u001b[43mMrGrid\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvoxel\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m,\u001b[49m\u001b[38;5;241;43m0.5\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msplit\u001b[49m(\u001b[38;5;28minput\u001b[39m\u001b[38;5;241m=\u001b[39mnifti_dir\u001b[38;5;241m.\u001b[39miterdir())\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# Run the task to resample all NIfTI files\u001b[39;00m\n\u001b[1;32m 7\u001b[0m outputs \u001b[38;5;241m=\u001b[39m mrgrid()\n", |
| 168 | + "\u001b[0;31mAttributeError\u001b[0m: 'MrGrid' object has no attribute 'split'" |
| 169 | + ] |
| 170 | + } |
| 171 | + ], |
148 | 172 | "source": [ |
149 | 173 | "from pydra.tasks.mrtrix3.v3_0 import MrGrid\n", |
150 | 174 | "\n", |
151 | 175 | "# Instantiate the task definition, \"splitting\" over all NIfTI files in the test directory\n", |
152 | | - "mrgrid = MrGrid(voxel=0.5).split(input=nifti_dir.iterdir())\n", |
| 176 | + "mrgrid = MrGrid(voxel=(0.5,0.5,0.5)).split(input=nifti_dir.iterdir())\n", |
153 | 177 | "\n", |
154 | 178 | "# Run the task to resample all NIfTI files\n", |
155 | 179 | "outputs = mrgrid()\n", |
|
0 commit comments