Skip to content

Commit 28cfecd

Browse files
committed
ENH: some stylistic changes
1 parent e8d7cb2 commit 28cfecd

6 files changed

+136
-80
lines changed

notebooks/basic_import_workflows.ipynb

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@
3737
{
3838
"cell_type": "code",
3939
"execution_count": null,
40-
"metadata": {
41-
"collapsed": true
42-
},
40+
"metadata": {},
4341
"outputs": [],
4442
"source": [
4543
"from nipype.workflows.fmri.fsl.preprocess import create_susan_smooth\n",
@@ -81,9 +79,7 @@
8179
{
8280
"cell_type": "code",
8381
"execution_count": null,
84-
"metadata": {
85-
"collapsed": true
86-
},
82+
"metadata": {},
8783
"outputs": [],
8884
"source": [
8985
"!fslmaths /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-fingerfootlips_bold.nii.gz \\\n",
@@ -100,9 +96,7 @@
10096
{
10197
"cell_type": "code",
10298
"execution_count": null,
103-
"metadata": {
104-
"collapsed": true
105-
},
99+
"metadata": {},
106100
"outputs": [],
107101
"source": [
108102
"smoothwf.inputs.inputnode.in_files = '/data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-fingerfootlips_bold.nii.gz'\n",
@@ -121,9 +115,7 @@
121115
{
122116
"cell_type": "code",
123117
"execution_count": null,
124-
"metadata": {
125-
"collapsed": true
126-
},
118+
"metadata": {},
127119
"outputs": [],
128120
"source": [
129121
"%pylab inline\n",
@@ -142,9 +134,7 @@
142134
{
143135
"cell_type": "code",
144136
"execution_count": null,
145-
"metadata": {
146-
"collapsed": true
147-
},
137+
"metadata": {},
148138
"outputs": [],
149139
"source": [
150140
"smoothwf.run('MultiProc', plugin_args={'n_procs': 4})"
@@ -160,22 +150,36 @@
160150
{
161151
"cell_type": "code",
162152
"execution_count": null,
163-
"metadata": {
164-
"collapsed": true
165-
},
153+
"metadata": {},
154+
"outputs": [],
155+
"source": [
156+
"%%bash\n",
157+
"fslmaths /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-fingerfootlips_bold.nii.gz -Tmean fmean.nii.gz\n",
158+
"fslmaths /output/susan_smooth/smooth/mapflow/_smooth0/sub-01_ses-test_task-fingerfootlips_bold_smooth.nii.gz \\\n",
159+
" -Tmean smean.nii.gz"
160+
]
161+
},
162+
{
163+
"cell_type": "code",
164+
"execution_count": null,
165+
"metadata": {},
166+
"outputs": [],
167+
"source": [
168+
"from nilearn import image, plotting"
169+
]
170+
},
171+
{
172+
"cell_type": "code",
173+
"execution_count": null,
174+
"metadata": {},
166175
"outputs": [],
167176
"source": [
168-
"!fslmaths /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-fingerfootlips_bold.nii.gz -Tmean fmean.nii.gz\n",
169-
"!fslmaths /output/susan_smooth/smooth/mapflow/_smooth0/sub-01_ses-test_task-fingerfootlips_bold_smooth.nii.gz \\\n",
170-
" -Tmean smean.nii.gz\n",
171-
"\n",
172-
"from nilearn import image, plotting\n",
173177
"plotting.plot_epi(\n",
174178
" 'fmean.nii.gz', title=\"mean (no smoothing)\", display_mode='z',\n",
175-
" cmap='gray', cut_coords=(-45, -30, -15, 0, 15))\n",
179+
" cmap='gray', cut_coords=(-45, -30, -15, 0, 15));\n",
176180
"plotting.plot_epi(\n",
177181
" 'smean.nii.gz', title=\"mean (susan smoothed)\", display_mode='z',\n",
178-
" cmap='gray', cut_coords=(-45, -30, -15, 0, 15))"
182+
" cmap='gray', cut_coords=(-45, -30, -15, 0, 15));"
179183
]
180184
},
181185
{
@@ -190,9 +194,7 @@
190194
{
191195
"cell_type": "code",
192196
"execution_count": null,
193-
"metadata": {
194-
"collapsed": true
195-
},
197+
"metadata": {},
196198
"outputs": [],
197199
"source": [
198200
"print(smoothwf.list_node_names())"
@@ -208,9 +210,7 @@
208210
{
209211
"cell_type": "code",
210212
"execution_count": null,
211-
"metadata": {
212-
"collapsed": true
213-
},
213+
"metadata": {},
214214
"outputs": [],
215215
"source": [
216216
"median = smoothwf.get_node('median')"
@@ -226,9 +226,7 @@
226226
{
227227
"cell_type": "code",
228228
"execution_count": null,
229-
"metadata": {
230-
"collapsed": true
231-
},
229+
"metadata": {},
232230
"outputs": [],
233231
"source": [
234232
"median.inputs.op_string = '-k %s -p 99'"
@@ -244,9 +242,7 @@
244242
{
245243
"cell_type": "code",
246244
"execution_count": null,
247-
"metadata": {
248-
"collapsed": true
249-
},
245+
"metadata": {},
250246
"outputs": [],
251247
"source": [
252248
"smoothwf.run('MultiProc', plugin_args={'n_procs': 4})"
@@ -262,15 +258,28 @@
262258
{
263259
"cell_type": "code",
264260
"execution_count": null,
265-
"metadata": {
266-
"collapsed": true
267-
},
261+
"metadata": {},
268262
"outputs": [],
269263
"source": [
270264
"!fslmaths /output/susan_smooth/smooth/mapflow/_smooth0/sub-01_ses-test_task-fingerfootlips_bold_smooth.nii.gz \\\n",
271-
" -Tmean mmean.nii.gz\n",
272-
"\n",
273-
"from nilearn import image, plotting\n",
265+
" -Tmean mmean.nii.gz"
266+
]
267+
},
268+
{
269+
"cell_type": "code",
270+
"execution_count": null,
271+
"metadata": {},
272+
"outputs": [],
273+
"source": [
274+
"from nilearn import image, plotting"
275+
]
276+
},
277+
{
278+
"cell_type": "code",
279+
"execution_count": null,
280+
"metadata": {},
281+
"outputs": [],
282+
"source": [
274283
"plotting.plot_epi(\n",
275284
" 'smean.nii.gz', title=\"mean (susan smooth)\", display_mode='z',\n",
276285
" cmap='gray', cut_coords=(-45, -30, -15, 0, 15))\n",
@@ -283,21 +292,21 @@
283292
"metadata": {
284293
"anaconda-cloud": {},
285294
"kernelspec": {
286-
"display_name": "Python [conda env:cos1]",
295+
"display_name": "Python [default]",
287296
"language": "python",
288-
"name": "conda-env-cos1-py"
297+
"name": "python3"
289298
},
290299
"language_info": {
291300
"codemirror_mode": {
292301
"name": "ipython",
293-
"version": 2
302+
"version": 3
294303
},
295304
"file_extension": ".py",
296305
"mimetype": "text/x-python",
297306
"name": "python",
298307
"nbconvert_exporter": "python",
299-
"pygments_lexer": "ipython2",
300-
"version": "2.7.12"
308+
"pygments_lexer": "ipython3",
309+
"version": "3.6.4"
301310
}
302311
},
303312
"nbformat": 4,

notebooks/basic_interfaces_caching.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"metadata": {},
8181
"outputs": [],
8282
"source": [
83-
"! ls -l /output/workingdir_mem/nipype_mem"
83+
"! ls -lh /output/workingdir_mem/nipype_mem"
8484
]
8585
},
8686
{
@@ -148,7 +148,7 @@
148148
],
149149
"metadata": {
150150
"kernelspec": {
151-
"display_name": "Python 3",
151+
"display_name": "Python [default]",
152152
"language": "python",
153153
"name": "python3"
154154
},

notebooks/basic_iteration.ipynb

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,63 @@
134134
"metadata": {},
135135
"outputs": [],
136136
"source": [
137-
"%pylab inline\n",
138-
"from nilearn import plotting\n",
137+
"%matplotlib inline\n",
138+
"from nilearn import plotting"
139+
]
140+
},
141+
{
142+
"cell_type": "code",
143+
"execution_count": null,
144+
"metadata": {},
145+
"outputs": [],
146+
"source": [
139147
"plotting.plot_anat(\n",
140148
" '/data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz', title='original',\n",
141-
" display_mode='z', cut_coords=(-50, -35, -20, -5), annotate=False)\n",
149+
" display_mode='z', dim=-1, cut_coords=(-50, -35, -20, -5), annotate=False);"
150+
]
151+
},
152+
{
153+
"cell_type": "code",
154+
"execution_count": null,
155+
"metadata": {},
156+
"outputs": [],
157+
"source": [
142158
"plotting.plot_anat(\n",
143159
" '/output/smoothflow/skullstrip/sub-01_ses-test_T1w_brain.nii.gz', title='skullstripped',\n",
144-
" display_mode='z', cut_coords=(-50, -35, -20, -5), annotate=False)\n",
160+
" display_mode='z', dim=-1, cut_coords=(-50, -35, -20, -5), annotate=False);"
161+
]
162+
},
163+
{
164+
"cell_type": "code",
165+
"execution_count": null,
166+
"metadata": {},
167+
"outputs": [],
168+
"source": [
145169
"plotting.plot_anat(\n",
146170
" '/output/smoothflow/_fwhm_4/iso_smooth/sub-01_ses-test_T1w_brain_smooth.nii.gz', title='FWHM=4',\n",
147-
" display_mode='z', cut_coords=(-50, -35, -20, -5), annotate=False)\n",
171+
" display_mode='z', dim=-0.5, cut_coords=(-50, -35, -20, -5), annotate=False);"
172+
]
173+
},
174+
{
175+
"cell_type": "code",
176+
"execution_count": null,
177+
"metadata": {},
178+
"outputs": [],
179+
"source": [
148180
"plotting.plot_anat(\n",
149181
" '/output/smoothflow/_fwhm_8/iso_smooth/sub-01_ses-test_T1w_brain_smooth.nii.gz', title='FWHM=8',\n",
150-
" display_mode='z', cut_coords=(-50, -35, -20, -5), annotate=False)\n",
182+
" display_mode='z', dim=-0.5, cut_coords=(-50, -35, -20, -5), annotate=False);"
183+
]
184+
},
185+
{
186+
"cell_type": "code",
187+
"execution_count": null,
188+
"metadata": {},
189+
"outputs": [],
190+
"source": [
151191
"plotting.plot_anat(\n",
152192
" '/output/smoothflow/_fwhm_16/iso_smooth/sub-01_ses-test_T1w_brain_smooth.nii.gz', title='FWHM=16',\n",
153-
" display_mode='z', cut_coords=(-50, -35, -20, -5), annotate=False)"
193+
" display_mode='z', dim=-0.5, cut_coords=(-50, -35, -20, -5), annotate=False);"
154194
]
155195
},
156196
{
@@ -242,7 +282,7 @@
242282
"metadata": {},
243283
"outputs": [],
244284
"source": [
245-
"! ls -l /output/datasink/anat_files/"
285+
"! ls -lh /output/datasink/anat_files/"
246286
]
247287
},
248288
{
@@ -256,7 +296,7 @@
256296
"cell_type": "markdown",
257297
"metadata": {},
258298
"source": [
259-
"#### Exercise 1\n",
299+
"## Exercise 1\n",
260300
"Create a workflow to calculate a various powers of ``2`` using two nodes, one for ``IdentityInterface`` with ``iterables``, and one for ``Function`` interface to calculate power of ``2``."
261301
]
262302
},
@@ -329,7 +369,7 @@
329369
"metadata": {
330370
"anaconda-cloud": {},
331371
"kernelspec": {
332-
"display_name": "Python 3",
372+
"display_name": "Python [default]",
333373
"language": "python",
334374
"name": "python3"
335375
},
@@ -343,7 +383,7 @@
343383
"name": "python",
344384
"nbconvert_exporter": "python",
345385
"pygments_lexer": "ipython3",
346-
"version": "3.6.3"
386+
"version": "3.6.4"
347387
}
348388
},
349389
"nbformat": 4,

notebooks/example_2ndlevel.ipynb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,7 @@
241241
{
242242
"cell_type": "code",
243243
"execution_count": null,
244-
"metadata": {
245-
"scrolled": true
246-
},
244+
"metadata": {},
247245
"outputs": [],
248246
"source": [
249247
"l2analysis.run('MultiProc', plugin_args={'n_procs': 4})"
@@ -495,24 +493,24 @@
495493
"source": [
496494
"from nilearn.plotting import plot_glass_brain\n",
497495
"plot_glass_brain(\n",
498-
" '/output/datasink/2ndLevel/spm_con_0005_fwhm4/spmT_0001_thr.nii',\n",
496+
" '/output/datasink/2ndLevel/spm_con_0005_fwhm4/spmT_0001_thr.nii', colorbar=True,\n",
499497
" threshold=2, display_mode='lyrz', black_bg=True, vmax=10, title='spm_fwhm4');\n",
500498
"plot_glass_brain(\n",
501-
" '/output/datasink/2ndLevel/ants_con_0005_fwhm4/spmT_0001_thr.nii',\n",
499+
" '/output/datasink/2ndLevel/ants_con_0005_fwhm4/spmT_0001_thr.nii', colorbar=True,\n",
502500
" threshold=2, display_mode='lyrz', black_bg=True, vmax=10, title='ants_fwhm4');\n",
503501
"plot_glass_brain(\n",
504-
" '/output/datasink/2ndLevel/spm_con_0005_fwhm8/spmT_0001_thr.nii',\n",
502+
" '/output/datasink/2ndLevel/spm_con_0005_fwhm8/spmT_0001_thr.nii', colorbar=True,\n",
505503
" threshold=2, display_mode='lyrz', black_bg=True, vmax=10, title='spm_fwhm8');\n",
506504
"plot_glass_brain(\n",
507-
" '/output/datasink/2ndLevel/ants_con_0005_fwhm8/spmT_0001_thr.nii',\n",
505+
" '/output/datasink/2ndLevel/ants_con_0005_fwhm8/spmT_0001_thr.nii', colorbar=True,\n",
508506
" threshold=2, display_mode='lyrz', black_bg=True, vmax=10, title='ants_fwhm8');"
509507
]
510508
}
511509
],
512510
"metadata": {
513511
"anaconda-cloud": {},
514512
"kernelspec": {
515-
"display_name": "Python 3",
513+
"display_name": "Python [default]",
516514
"language": "python",
517515
"name": "python3"
518516
},
@@ -526,7 +524,7 @@
526524
"name": "python",
527525
"nbconvert_exporter": "python",
528526
"pygments_lexer": "ipython3",
529-
"version": "3.6.3"
527+
"version": "3.6.4"
530528
}
531529
},
532530
"nbformat": 4,

0 commit comments

Comments
 (0)