Skip to content

Commit

Permalink
docs(master): Update docs of development line
Browse files Browse the repository at this point in the history
  • Loading branch information
nipreps-bot committed May 30, 2024
1 parent 77b5ca4 commit c4b2938
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 113 deletions.
3 changes: 1 addition & 2 deletions master/_modules/sdcflows/fieldmaps.html
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,7 @@ <h1>Source code for sdcflows.fieldmaps</h1><div class="highlight"><pre>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_wf</span>

<span class="c1"># Override workflow name</span>
<span class="n">clean_bids_id</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;[^a-zA-Z0-9]&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">bids_id</span><span class="p">)</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;wf_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;name&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;wf_</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span>

<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="ow">in</span> <span class="p">(</span><span class="n">EstimatorType</span><span class="o">.</span><span class="n">MAPPED</span><span class="p">,</span> <span class="n">EstimatorType</span><span class="o">.</span><span class="n">PHASEDIFF</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">.workflows.fit.fieldmap</span> <span class="kn">import</span> <span class="n">init_fmap_wf</span>
Expand Down
11 changes: 4 additions & 7 deletions master/_modules/sdcflows/workflows/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ <h1>Source code for sdcflows.workflows.base</h1><div class="highlight"><pre>
<span class="c1"># https://www.nipreps.org/community/licensing/</span>
<span class="c1">#</span>
<span class="sd">&quot;&quot;&quot;Estimate fieldmaps for :abbr:`SDC (susceptibility distortion correction)`.&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">re</span>

<span class="kn">from</span> <span class="nn">nipype</span> <span class="kn">import</span> <span class="n">logging</span>
<span class="kn">from</span> <span class="nn">nipype.pipeline</span> <span class="kn">import</span> <span class="n">engine</span> <span class="k">as</span> <span class="n">pe</span>
<span class="kn">from</span> <span class="nn">nipype.interfaces</span> <span class="kn">import</span> <span class="n">utility</span> <span class="k">as</span> <span class="n">niu</span>
Expand Down Expand Up @@ -430,7 +428,6 @@ <h1>Source code for sdcflows.workflows.base</h1><div class="highlight"><pre>
<span class="p">)</span>

<span class="k">for</span> <span class="n">n</span><span class="p">,</span> <span class="n">estimator</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">estimators</span><span class="p">,</span> <span class="mi">1</span><span class="p">):</span>
<span class="n">clean_bids_id</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;[^a-zA-Z0-9]&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="p">)</span>
<span class="n">est_wf</span> <span class="o">=</span> <span class="n">estimator</span><span class="o">.</span><span class="n">get_workflow</span><span class="p">(</span>
<span class="n">omp_nthreads</span><span class="o">=</span><span class="n">omp_nthreads</span><span class="p">,</span>
<span class="n">debug</span><span class="o">=</span><span class="n">debug</span><span class="p">,</span>
Expand All @@ -441,15 +438,15 @@ <h1>Source code for sdcflows.workflows.base</h1><div class="highlight"><pre>
<span class="p">]</span>

<span class="n">out_map</span> <span class="o">=</span> <span class="n">pe</span><span class="o">.</span><span class="n">Node</span><span class="p">(</span>
<span class="n">niu</span><span class="o">.</span><span class="n">IdentityInterface</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="n">out_fields</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;out_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="n">niu</span><span class="o">.</span><span class="n">IdentityInterface</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="n">out_fields</span><span class="p">),</span> <span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;out_</span><span class="si">{</span><span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="p">)</span>
<span class="n">out_map</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">fmap_id</span> <span class="o">=</span> <span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span>

<span class="n">fmap_derivatives_wf</span> <span class="o">=</span> <span class="n">init_fmap_derivatives_wf</span><span class="p">(</span>
<span class="n">output_dir</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">output_dir</span><span class="p">),</span>
<span class="n">write_coeff</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">bids_fmap_id</span><span class="o">=</span><span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_derivatives_wf_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_derivatives_wf_</span><span class="si">{</span><span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="n">fmap_derivatives_wf</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">inputnode</span><span class="o">.</span><span class="n">source_files</span> <span class="o">=</span> <span class="n">source_files</span>
<span class="n">fmap_derivatives_wf</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">inputnode</span><span class="o">.</span><span class="n">fmap_meta</span> <span class="o">=</span> <span class="p">[</span>
Expand All @@ -460,15 +457,15 @@ <h1>Source code for sdcflows.workflows.base</h1><div class="highlight"><pre>
<span class="n">output_dir</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">output_dir</span><span class="p">),</span>
<span class="n">fmap_type</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">estimator</span><span class="o">.</span><span class="n">method</span><span class="p">)</span><span class="o">.</span><span class="n">rpartition</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">(),</span>
<span class="n">bids_fmap_id</span><span class="o">=</span><span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_reports_wf_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_reports_wf_</span><span class="si">{</span><span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="n">fmap_reports_wf</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">inputnode</span><span class="o">.</span><span class="n">source_files</span> <span class="o">=</span> <span class="n">source_files</span>

<span class="k">if</span> <span class="n">estimator</span><span class="o">.</span><span class="n">method</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">(</span><span class="n">EstimatorType</span><span class="o">.</span><span class="n">MAPPED</span><span class="p">,</span> <span class="n">EstimatorType</span><span class="o">.</span><span class="n">PHASEDIFF</span><span class="p">):</span>
<span class="n">fields</span> <span class="o">=</span> <span class="n">INPUT_FIELDS</span><span class="p">[</span><span class="n">estimator</span><span class="o">.</span><span class="n">method</span><span class="p">]</span>
<span class="n">inputnode</span> <span class="o">=</span> <span class="n">pe</span><span class="o">.</span><span class="n">Node</span><span class="p">(</span>
<span class="n">niu</span><span class="o">.</span><span class="n">IdentityInterface</span><span class="p">(</span><span class="n">fields</span><span class="o">=</span><span class="n">fields</span><span class="p">),</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;in_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;in_</span><span class="si">{</span><span class="n">estimator</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="c1"># fmt:off</span>
<span class="n">workflow</span><span class="o">.</span><span class="n">connect</span><span class="p">([</span>
Expand Down
8 changes: 2 additions & 6 deletions master/_modules/sdcflows/workflows/fit/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ <h1>Source code for sdcflows.workflows.fit.base</h1><div class="highlight"><pre>
<a class="viewcode-back" href="../../../../api/sdcflows.workflows.fit.base.html#sdcflows.workflows.fit.base.init_sdcflows_wf">[docs]</a>
<span class="k">def</span> <span class="nf">init_sdcflows_wf</span><span class="p">():</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Create a multi-subject, multi-estimator *SDCFlows* workflow.&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">re</span>

<span class="kn">from</span> <span class="nn">nipype.pipeline.engine</span> <span class="kn">import</span> <span class="n">Workflow</span>
<span class="kn">from</span> <span class="nn">niworkflows.utils.bids</span> <span class="kn">import</span> <span class="n">collect_participants</span>

Expand All @@ -375,8 +373,6 @@ <h1>Source code for sdcflows.workflows.fit.base</h1><div class="highlight"><pre>

<span class="k">for</span> <span class="n">subject</span><span class="p">,</span> <span class="n">sub_estimators</span> <span class="ow">in</span> <span class="n">estimators_record</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">for</span> <span class="n">estim</span> <span class="ow">in</span> <span class="n">sub_estimators</span><span class="p">:</span>
<span class="n">clean_bids_id</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;[^a-zA-Z0-9]&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">estim</span><span class="o">.</span><span class="n">bids_id</span><span class="p">)</span>

<span class="n">estim_wf</span> <span class="o">=</span> <span class="n">estim</span><span class="o">.</span><span class="n">get_workflow</span><span class="p">(</span>
<span class="n">omp_nthreads</span><span class="o">=</span><span class="n">config</span><span class="o">.</span><span class="n">nipype</span><span class="o">.</span><span class="n">omp_nthreads</span><span class="p">,</span>
<span class="n">sloppy</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
Expand All @@ -387,7 +383,7 @@ <h1>Source code for sdcflows.workflows.fit.base</h1><div class="highlight"><pre>
<span class="n">output_dir</span><span class="o">=</span><span class="n">config</span><span class="o">.</span><span class="n">execution</span><span class="o">.</span><span class="n">output_dir</span><span class="p">,</span>
<span class="n">bids_fmap_id</span><span class="o">=</span><span class="n">estim</span><span class="o">.</span><span class="n">bids_id</span><span class="p">,</span>
<span class="n">write_coeff</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_derivatives_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_derivatives_</span><span class="si">{</span><span class="n">estim</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="p">)</span>

<span class="n">source_paths</span> <span class="o">=</span> <span class="p">[</span>
Expand All @@ -402,7 +398,7 @@ <h1>Source code for sdcflows.workflows.fit.base</h1><div class="highlight"><pre>
<span class="n">fmap_type</span><span class="o">=</span><span class="n">estim</span><span class="o">.</span><span class="n">method</span><span class="p">,</span>
<span class="n">output_dir</span><span class="o">=</span><span class="n">config</span><span class="o">.</span><span class="n">execution</span><span class="o">.</span><span class="n">output_dir</span><span class="p">,</span>
<span class="n">bids_fmap_id</span><span class="o">=</span><span class="n">estim</span><span class="o">.</span><span class="n">bids_id</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_reports_</span><span class="si">{</span><span class="n">clean_bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="sa">f</span><span class="s2">&quot;fmap_reports_</span><span class="si">{</span><span class="n">estim</span><span class="o">.</span><span class="n">bids_id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span>
<span class="p">)</span>
<span class="n">reportlets_wf</span><span class="o">.</span><span class="n">inputs</span><span class="o">.</span><span class="n">inputnode</span><span class="o">.</span><span class="n">source_files</span> <span class="o">=</span> <span class="n">source_paths</span>

Expand Down
Loading

0 comments on commit c4b2938

Please sign in to comment.