Skip to content

Commit d7a6415

Browse files
committed
DOC: update docs to newest notebook version
1 parent 5411d32 commit d7a6415

29 files changed

+18322
-18254
lines changed

Diff for: docs/notebooks/advanced_create_interfaces.html

+29-32
Large diffs are not rendered by default.

Diff for: docs/notebooks/advanced_interfaces_caching.html

+5-15
Original file line numberDiff line numberDiff line change
@@ -11775,16 +11775,6 @@
1177511775
ga('create', 'UA-92929997-1', 'auto');
1177611776
ga('send', 'pageview');
1177711777

11778-
</script>
11779-
<script>
11780-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
11781-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
11782-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
11783-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
11784-
11785-
ga('create', 'UA-92929997-1', 'auto');
11786-
ga('send', 'pageview');
11787-
1178811778
</script>
1178911779
</head>
1179011780
<body>
@@ -11805,12 +11795,12 @@ <h1 id="Interface-caching">Interface caching<a class="anchor-link" href="#Interf
1180511795
<div class="inner_cell">
1180611796
<div class="text_cell_render border-box-sizing rendered_html">
1180711797
<h2 id="Interface-caching:-why-and-how">Interface caching: why and how<a class="anchor-link" href="#Interface-caching:-why-and-how">&#182;</a></h2><ul>
11808-
<li><p><code>Pipelines</code> (also called <code>workflows</code>) specify processing by an execution graph. This is useful because it opens the door to dependency checking and enable</p>
11798+
<li><p><code>Pipelines</code> (also called <code>workflows</code>) specify processing by an execution graph. This is useful because it opens the door to dependency checking and enables</p>
1180911799
<ul>
1181011800
<li>to minimize recomputations, </li>
1181111801
<li>to have the execution engine transparently deal with intermediate file manipulations.</li>
1181211802
</ul>
11813-
<p>They however do not blend in well with arbitrary Python code, as they must rely on their own execution engine.</p>
11803+
<p>They, however, do not blend in well with arbitrary Python code, as they must rely on their own execution engine.</p>
1181411804
</li>
1181511805
</ul>
1181611806
<ul>
@@ -11852,7 +11842,7 @@ <h2 id="A-big-picture-view:-using-the-Memory-object">A big picture view: using t
1185211842
<div class="inner_cell">
1185311843
<div class="text_cell_render border-box-sizing rendered_html">
1185411844
<p>Note that the caching directory is a subdirectory called <code>nipype_mem</code> of the given <code>base_dir</code>. This is done to avoid polluting the base director.</p>
11855-
<p>In the corresponding execution context, nipype interfaces can be turned into callables that can be used as functions using the <a href="http://nipype.readthedocs.io/en/latest/api/generated/nipype.caching.memory.html#nipype.caching.memory.Memory.cache"><code>Memory.cache</code></a> method. For instance if we want to run the fslMerge command on a set of files:</p>
11845+
<p>In the corresponding execution context, nipype interfaces can be turned into callables that can be used as functions using the <a href="http://nipype.readthedocs.io/en/latest/api/generated/nipype.caching.memory.html#nipype.caching.memory.Memory.cache"><code>Memory.cache</code></a> method. For instance, if we want to run the fslMerge command on a set of files:</p>
1185611846

1185711847
</div>
1185811848
</div>
@@ -11876,7 +11866,7 @@ <h2 id="A-big-picture-view:-using-the-Memory-object">A big picture view: using t
1187611866
<div class="inner_cell">
1187711867
<div class="text_cell_render border-box-sizing rendered_html">
1187811868
<p>Note that the <a href="http://nipype.readthedocs.io/en/latest/api/generated/nipype.caching.memory.html#nipype.caching.memory.Memory.cache"><code>Memory.cache</code></a> method takes interfaces <strong>classes</strong>, and not instances.</p>
11879-
<p>The resulting <code>fsl_merge</code> object can be applied as a function to parameters, that will form the inputs of the <code>merge</code> fsl commands. Those inputs are given as keyword arguments, bearing the same name as the name in the inputs specs of the interface. In IPython, you can also get the argument list by using the <code>fsl_merge?</code> synthax to inspect the docs:</p>
11869+
<p>The resulting <code>fsl_merge</code> object can be applied as a function to parameters, that will form the inputs of the <code>merge</code> fsl commands. Those inputs are given as keyword arguments, bearing the same name as the name in the inputs specs of the interface. In IPython, you can also get the argument list by using the <code>fsl_merge?</code> syntax to inspect the docs:</p>
1188011870

1188111871
</div>
1188211872
</div>
@@ -12077,7 +12067,7 @@ <h3 id="Example">Example<a class="anchor-link" href="#Example">&#182;</a></h3><p
1207712067
<h2 id="Usage-patterns:-working-efficiently-with-caching">Usage patterns: working efficiently with caching<a class="anchor-link" href="#Usage-patterns:-working-efficiently-with-caching">&#182;</a></h2><p>The goal of the <code>caching</code> module is to enable writing plain Python code rather than workflows. Use it: instead of data grabber nodes, use for instance the <code>glob</code> module. To vary parameters, use <code>for</code> loops. To make reusable code, write Python functions.</p>
1207812068
<p>One good rule of thumb to respect is to avoid the usage of explicit filenames apart from the outermost inputs and outputs of your processing. The reason being that the caching mechanism of <code>nipy.caching</code> takes care of generating the unique hashes, ensuring that, when you vary parameters, files are not overridden by the output of different computations.</p>
1207912069
<div class="alert alert-info">
12080-
**Debuging**:
12070+
**Debugging**:
1208112071
If you need to inspect the running environment of the nodes, it may be useful to know where they were executed. With `nipype.caching`, you do not control this location as it is encoded by hashes.
1208212072
To find out where an operation has been persisted, simply look in it's output variable:
1208312073
```out.runtime.cwd```

Diff for: docs/notebooks/advanced_spmmcr.html

+1-11
Original file line numberDiff line numberDiff line change
@@ -11775,16 +11775,6 @@
1177511775
ga('create', 'UA-92929997-1', 'auto');
1177611776
ga('send', 'pageview');
1177711777

11778-
</script>
11779-
<script>
11780-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
11781-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
11782-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
11783-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
11784-
11785-
ga('create', 'UA-92929997-1', 'auto');
11786-
ga('send', 'pageview');
11787-
1178811778
</script>
1178911779
</head>
1179011780
<body>
@@ -11806,7 +11796,7 @@ <h1 id="Using-SPM-with-MATLAB-Common-Runtime-(MCR)">Using SPM with MATLAB Common
1180611796
<div class="inner_cell">
1180711797
<div class="input_area">
1180811798
<div class=" highlight hl-ipython3"><pre><span></span><span class="kn">from</span> <span class="nn">nipype.interfaces</span> <span class="k">import</span> <span class="n">spm</span>
11809-
<span class="n">matlab_cmd</span> <span class="o">=</span> <span class="s1">&#39;/opt/spm12/run_spm12.sh /opt/mcr/v92/ script&#39;</span>
11799+
<span class="n">matlab_cmd</span> <span class="o">=</span> <span class="s1">&#39;/opt/spm12-r7219/run_spm12.sh /opt/matlabmcr-2010a/v713/ script&#39;</span>
1181011800
<span class="n">spm</span><span class="o">.</span><span class="n">SPMCommand</span><span class="o">.</span><span class="n">set_mlab_paths</span><span class="p">(</span><span class="n">matlab_cmd</span><span class="o">=</span><span class="n">matlab_cmd</span><span class="p">,</span> <span class="n">use_mcr</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
1181111801
</pre></div>
1181211802

Diff for: docs/notebooks/basic_data_input.html

+38-48
Original file line numberDiff line numberDiff line change
@@ -11775,16 +11775,6 @@
1177511775
ga('create', 'UA-92929997-1', 'auto');
1177611776
ga('send', 'pageview');
1177711777

11778-
</script>
11779-
<script>
11780-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
11781-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
11782-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
11783-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
11784-
11785-
ga('create', 'UA-92929997-1', 'auto');
11786-
ga('send', 'pageview');
11787-
1178811778
</script>
1178911779
</head>
1179011780
<body>
@@ -11816,49 +11806,49 @@ <h1 id="Data-Input">Data Input<a class="anchor-link" href="#Data-Input">&#182;</
1181611806
</div>
1181711807
<div class="inner_cell">
1181811808
<div class="text_cell_render border-box-sizing rendered_html">
11819-
<h1 id="Dataset-structure">Dataset structure<a class="anchor-link" href="#Dataset-structure">&#182;</a></h1><p>To be able to import data, you first need to be aware about the structure of your dataset. The structure of the dataset for this tutorial is according to BIDS, and looks as follows:</p>
11809+
<h1 id="Dataset-structure">Dataset structure<a class="anchor-link" href="#Dataset-structure">&#182;</a></h1><p>To be able to import data, you first need to be aware of the structure of your dataset. The structure of the dataset for this tutorial is according to BIDS, and looks as follows:</p>
1182011810

1182111811
<pre><code>ds000114
1182211812
├── CHANGES
1182311813
├── dataset_description.json
1182411814
├── derivatives
11825-
├── fmriprep
11826-
└── sub01...sub10
11827-
└── ...
11828-
├── freesurfer
11829-
├── fsaverage
11830-
├── fsaverage5
11831-
└── sub01...sub10
11832-
└── ...
11815+
   ├── fmriprep
11816+
   │   └── sub01...sub10
11817+
   │   └── ...
11818+
   ├── freesurfer
11819+
   ├── fsaverage
11820+
   ├── fsaverage5
11821+
   │   └── sub01...sub10
11822+
   │   └── ...
1183311823
├── dwi.bval
1183411824
├── dwi.bvec
1183511825
├── sub-01
11836-
├── ses-retest
11837-
├── anat
11838-
└── sub-01_ses-retest_T1w.nii.gz
11839-
├──func
11840-
├── sub-01_ses-retest_task-covertverbgeneration_bold.nii.gz
11841-
├── sub-01_ses-retest_task-fingerfootlips_bold.nii.gz
11842-
├── sub-01_ses-retest_task-linebisection_bold.nii.gz
11843-
├── sub-01_ses-retest_task-linebisection_events.tsv
11844-
├── sub-01_ses-retest_task-overtverbgeneration_bold.nii.gz
11845-
└── sub-01_ses-retest_task-overtwordrepetition_bold.nii.gz
11826+
   ├── ses-retest
11827+
   ├── anat
11828+
   │   └── sub-01_ses-retest_T1w.nii.gz
11829+
   ├──func
11830+
   ├── sub-01_ses-retest_task-covertverbgeneration_bold.nii.gz
11831+
   ├── sub-01_ses-retest_task-fingerfootlips_bold.nii.gz
11832+
   ├── sub-01_ses-retest_task-linebisection_bold.nii.gz
11833+
   ├── sub-01_ses-retest_task-linebisection_events.tsv
11834+
   ├── sub-01_ses-retest_task-overtverbgeneration_bold.nii.gz
11835+
   └── sub-01_ses-retest_task-overtwordrepetition_bold.nii.gz
1184611836
│ └── dwi
1184711837
│ └── sub-01_ses-retest_dwi.nii.gz
11848-
├── ses-test
11849-
├── anat
11850-
└── sub-01_ses-test_T1w.nii.gz
11851-
├──func
11852-
├── sub-01_ses-test_task-covertverbgeneration_bold.nii.gz
11853-
├── sub-01_ses-test_task-fingerfootlips_bold.nii.gz
11854-
├── sub-01_ses-test_task-linebisection_bold.nii.gz
11855-
├── sub-01_ses-test_task-linebisection_events.tsv
11856-
├── sub-01_ses-test_task-overtverbgeneration_bold.nii.gz
11857-
└── sub-01_ses-test_task-overtwordrepetition_bold.nii.gz
11838+
   ├── ses-test
11839+
   ├── anat
11840+
   │   └── sub-01_ses-test_T1w.nii.gz
11841+
   ├──func
11842+
   ├── sub-01_ses-test_task-covertverbgeneration_bold.nii.gz
11843+
   ├── sub-01_ses-test_task-fingerfootlips_bold.nii.gz
11844+
   ├── sub-01_ses-test_task-linebisection_bold.nii.gz
11845+
   ├── sub-01_ses-test_task-linebisection_events.tsv
11846+
   ├── sub-01_ses-test_task-overtverbgeneration_bold.nii.gz
11847+
   └── sub-01_ses-test_task-overtwordrepetition_bold.nii.gz
1185811848
│ └── dwi
1185911849
│ └── sub-01_ses-retest_dwi.nii.gz
1186011850
├── sub-02..sub-10
11861-
└── ...
11851+
   └── ...
1186211852
├── task-covertverbgeneration_bold.json
1186311853
├── task-covertverbgeneration_events.tsv
1186411854
├── task-fingerfootlips_bold.json
@@ -11980,8 +11970,8 @@ <h1 id="DataGrabber">DataGrabber<a class="anchor-link" href="#DataGrabber">&#182
1198011970
string template to match. So in the previous case <code>DataGrabber</code> is looking for
1198111971
path matches of the form <code>/data/ds000114/s*/ses-test/func/*fingerfootlips*.nii.gz</code>.</p>
1198211972
<div class="alert alert-info">
11983-
**Note**: When used with wildcards (e.g., `s*` and `*fingerfootlips*` above) `DataGrabber` does not return data in sorted order. In order to force it to return data in sorted order, one needs to set the input `sorted = True`. However, when explicitly specifying an order as we will see below, `sorted` should be set to `False`.
11984-
</div><p>More useful cases arise when the template can be filled by other inputs. In the
11973+
**Note**: When used with wildcards (e.g., `s*` and `*fingerfootlips*` above) `DataGrabber` does not return data in sorted order. In order to force it to return data in a sorted order, one needs to set the input `sorted = True`. However, when explicitly specifying an order as we will see below, `sorted` should be set to `False`.
11974+
</div><p>More use cases arise when the template can be filled by other inputs. In the
1198511975
example below, we define an input field for <code>DataGrabber</code> called <code>subject_id</code>. This is
1198611976
then used to set the template (see <code>%d</code> in the template).</p>
1198711977

@@ -12200,7 +12190,7 @@ <h2 id="A-more-realistic-use-case">A more realistic use-case<a class="anchor-lin
1220012190
</div>
1220112191
<div class="inner_cell">
1220212192
<div class="text_cell_render border-box-sizing rendered_html">
12203-
<p>Above, two more fields are introduced: <code>field_template</code> and <code>template_args</code>. These fields are both dictionaries whose keys correspond to the <code>outfields</code> keyword. The <code>field_template</code> reflects the search path for each output field, while the <code>template_args</code> reflect the inputs that satisfy the template. The inputs can either be one of the named inputs specified by the <code>infields</code> keyword arg or it can be raw strings or integers corresponding to the template. For the <code>func</code> output, the <strong>%s</strong> in the <code>field_template</code> is satisfied by <code>subject_id</code> and the <strong>%d</strong> is field in by the list of numbers.</p>
12193+
<p>Above, two more fields are introduced: <code>field_template</code> and <code>template_args</code>. These fields are both dictionaries whose keys correspond to the <code>outfields</code> keyword. The <code>field_template</code> reflects the search path for each output field, while the <code>template_args</code> reflect the inputs that satisfy the template. The inputs can either be one of the named inputs specified by the <code>infields</code> keyword arg or it can be raw strings or integers corresponding to the template. For the <code>func</code> output, the <strong>%s</strong> in the <code>field_template</code> is satisfied by <code>subject_id</code> and the <strong>%d</strong> is filled in by the list of numbers.</p>
1220412194

1220512195
</div>
1220612196
</div>
@@ -12510,14 +12500,14 @@ <h1 id="SelectFiles">SelectFiles<a class="anchor-link" href="#SelectFiles">&#182
1251012500
</div>
1251112501
<div class="inner_cell">
1251212502
<div class="text_cell_render border-box-sizing rendered_html">
12513-
<p><code>SelectFiles</code> uses the {}-based string formating syntax to plug values into string templates and collect the data. These templates can also be combined with glob wild cards. The field names in the formatting template (i.e. the terms in braces) will become inputs fields on the interface, and the keys in the templates dictionary will form the output fields.</p>
12503+
<p><code>SelectFiles</code> uses the {}-based string formatting syntax to plug values into string templates and collect the data. These templates can also be combined with glob wild cards. The field names in the formatting template (i.e. the terms in braces) will become inputs fields on the interface, and the keys in the templates dictionary will form the output fields.</p>
1251412504
<p>Let's focus again on the data we want to import:</p>
1251512505

1251612506
<pre><code>anat = /data/ds000114/sub-01/ses-test/anat/sub-01_ses-test_T1w.nii.gz
1251712507
func = /data/ds000114/sub-01/ses-test/func/sub-01_ses-test_task-fingerfootlips_bold.nii.gz
1251812508

1251912509
</code></pre>
12520-
<p>Now, we can replace those paths with the accoridng {}-based strings.</p>
12510+
<p>Now, we can replace those paths with the according {}-based strings.</p>
1252112511

1252212512
<pre><code>anat = /data/ds000114/sub-{subject_id}/ses-{ses_name}/anat/sub-{subject_id}_ses-{ses_name}_T1w.nii.gz
1252312513
func = /data/ds000114/sub-{subject_id}/ses-{ses_name}/func/ \
@@ -12705,7 +12695,7 @@ <h1 id="SelectFiles">SelectFiles<a class="anchor-link" href="#SelectFiles">&#182
1270512695
<div class="inner_cell">
1270612696
<div class="text_cell_render border-box-sizing rendered_html">
1270712697
<p>As you can see, now <code>anat</code> contains ten file paths, T1w images for all ten subject.</p>
12708-
<p>As a side node, you could also use <code>[]</code> string formating for some simple cases, e.g. for loading only subject 1 adn 2:</p>
12698+
<p>As a side note, you could also use <code>[]</code> string formatting for some simple cases, e.g. for loading only subject 1 and 2:</p>
1270912699

1271012700
<pre><code>'sub-0[1,2]/ses-test/anat/sub-0[1,2]_ses-test_T1w.nii.gz'</code></pre>
1271112701

@@ -12826,7 +12816,7 @@ <h3 id="Exercise-2">Exercise 2<a class="anchor-link" href="#Exercise-2">&#182;</
1282612816
</div>
1282712817
<div class="inner_cell">
1282812818
<div class="text_cell_render border-box-sizing rendered_html">
12829-
<h2 id="FreeSurferSource">FreeSurferSource<a class="anchor-link" href="#FreeSurferSource">&#182;</a></h2><p><code>FreeSurferSource</code> is a specific case of a file grabber that felicitates the data import of outputs from the FreeSurfer recon-all algorithm. This of course requires that you've already run <code>recon-all</code> on your subject.</p>
12819+
<h2 id="FreeSurferSource">FreeSurferSource<a class="anchor-link" href="#FreeSurferSource">&#182;</a></h2><p><code>FreeSurferSource</code> is a specific case of a file grabber that felicitates the data import of outputs from the FreeSurfer recon-all algorithm. This, of course, requires that you've already run <code>recon-all</code> on your subject.</p>
1283012820

1283112821
</div>
1283212822
</div>
@@ -12845,7 +12835,7 @@ <h2 id="FreeSurferSource">FreeSurferSource<a class="anchor-link" href="#FreeSurf
1284512835
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
1284612836
<div class="inner_cell">
1284712837
<div class="input_area">
12848-
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>datalad get -r -J 4 /data/ds000114/derivatives/freesurfer/sub-01
12838+
<div class=" highlight hl-ipython3"><pre><span></span><span class="o">!</span>datalad get -r -J <span class="m">4</span> /data/ds000114/derivatives/freesurfer/sub-01
1284912839
</pre></div>
1285012840

1285112841
</div>

0 commit comments

Comments
 (0)