Skip to content

Commit

Permalink
Deploying to gh-pages from @ 13d173e 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
frheault committed Oct 11, 2023
1 parent afda540 commit 8cef03e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion _modules/trx/fetcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ <h1>Source code for trx.fetcher</h1><div class="highlight"><pre>
<span class="k">if</span> <span class="s1">&#39;TRX_HOME&#39;</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">:</span>
<span class="n">trx_home</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;TRX_HOME&#39;</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">trx_home</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span><span class="s1">&#39;~&#39;</span><span class="p">),</span> <span class="s1">&#39;.tee_ar_ex/&#39;</span><span class="p">)</span>
<span class="n">trx_home</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">expanduser</span><span class="p">(</span><span class="s1">&#39;~&#39;</span><span class="p">),</span> <span class="s1">&#39;.tee_ar_ex&#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">trx_home</span></div>


Expand Down
3 changes: 2 additions & 1 deletion _modules/trx/io.html
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ <h1>Source code for trx.io</h1><div class="highlight"><pre>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tractogram_obj</span><span class="p">,</span> <span class="n">tmm</span><span class="o">.</span><span class="n">TrxFile</span><span class="p">):</span>
<span class="n">tractogram_obj</span> <span class="o">=</span> <span class="n">tmm</span><span class="o">.</span><span class="n">TrxFile</span><span class="o">.</span><span class="n">from_sft</span><span class="p">(</span><span class="n">tractogram_obj</span><span class="p">)</span>
<span class="n">tmm</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">tractogram_obj</span><span class="p">,</span> <span class="n">tractogram_filename</span><span class="p">)</span></div>
<span class="n">tmm</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">tractogram_obj</span><span class="p">,</span> <span class="n">tractogram_filename</span><span class="p">)</span>
<span class="n">tractogram_obj</span><span class="o">.</span><span class="n">close</span><span class="p">()</span></div>

</pre></div>

Expand Down
18 changes: 9 additions & 9 deletions _modules/trx/trx_file_memmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ <h1>Source code for trx.trx_file_memmap</h1><div class="highlight"><pre>
<span class="s2">&quot;An undeclared group (</span><span class="si">{}</span><span class="s2">) has &quot;</span> <span class="s2">&quot;data_per_group.&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">dpg</span><span class="p">)</span>
<span class="p">)</span>

<span class="k">return</span> <span class="n">trx</span></div>


Expand Down Expand Up @@ -710,7 +709,6 @@ <h1>Source code for trx.trx_file_memmap</h1><div class="highlight"><pre>

<span class="n">dtype_size</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">dtype</span><span class="p">(</span><span class="n">ext</span><span class="p">[</span><span class="mi">1</span><span class="p">:])</span><span class="o">.</span><span class="n">itemsize</span>
<span class="n">size</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">getsize</span><span class="p">(</span><span class="n">elem_filename</span><span class="p">)</span> <span class="o">/</span> <span class="n">dtype_size</span>

<span class="k">if</span> <span class="n">size</span><span class="o">.</span><span class="n">is_integer</span><span class="p">():</span>
<span class="n">files_pointer_size</span><span class="p">[</span><span class="n">elem_filename</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">int</span><span class="p">(</span><span class="n">size</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">getsize</span><span class="p">(</span><span class="n">elem_filename</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
Expand Down Expand Up @@ -923,7 +921,6 @@ <h1>Source code for trx.trx_file_memmap</h1><div class="highlight"><pre>

<span class="n">copy_trx</span> <span class="o">=</span> <span class="n">trx</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">()</span>
<span class="n">copy_trx</span><span class="o">.</span><span class="n">resize</span><span class="p">()</span>

<span class="n">tmp_dir_name</span> <span class="o">=</span> <span class="n">copy_trx</span><span class="o">.</span><span class="n">_uncompressed_folder_handle</span><span class="o">.</span><span class="n">name</span>
<span class="k">if</span> <span class="n">ext</span> <span class="ow">in</span> <span class="p">[</span><span class="s2">&quot;.zip&quot;</span><span class="p">,</span> <span class="s2">&quot;.trx&quot;</span><span class="p">]:</span>
<span class="n">zip_from_folder</span><span class="p">(</span><span class="n">tmp_dir_name</span><span class="p">,</span> <span class="n">filename</span><span class="p">,</span> <span class="n">compression_standard</span><span class="p">)</span>
Expand All @@ -950,11 +947,11 @@ <h1>Source code for trx.trx_file_memmap</h1><div class="highlight"><pre>

<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">with</span> <span class="n">zipfile</span><span class="o">.</span><span class="n">ZipFile</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;w&quot;</span><span class="p">,</span> <span class="n">compression</span><span class="o">=</span><span class="n">compression_standard</span><span class="p">)</span> <span class="k">as</span> <span class="n">zf</span><span class="p">:</span>
<span class="k">for</span> <span class="n">root</span><span class="p">,</span> <span class="n">dirs</span><span class="p">,</span> <span class="n">files</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">directory</span><span class="p">):</span>
<span class="k">for</span> <span class="n">root</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">files</span> <span class="ow">in</span> <span class="n">os</span><span class="o">.</span><span class="n">walk</span><span class="p">(</span><span class="n">directory</span><span class="p">):</span>
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">files</span><span class="p">:</span>
<span class="n">tmp_filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="n">zf</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">tmp_filename</span><span class="p">,</span> <span class="n">tmp_filename</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span>
<span class="n">directory</span> <span class="o">+</span> <span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">))</span></div>
<span class="n">curr_filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="n">name</span><span class="p">)</span>
<span class="n">tmp_filename</span> <span class="o">=</span> <span class="n">curr_filename</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">directory</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">zf</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">curr_filename</span><span class="p">,</span> <span class="n">tmp_filename</span><span class="p">)</span></div>



Expand Down Expand Up @@ -1490,9 +1487,11 @@ <h1>Source code for trx.trx_file_memmap</h1><div class="highlight"><pre>
<span class="c1"># This is for Unix</span>
<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="s1">&#39;nt&#39;</span> <span class="ow">and</span> <span class="n">folder</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">root</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)):</span>
<span class="n">folder</span> <span class="o">=</span> <span class="n">folder</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">lstrip</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)</span>
<span class="c1"># These two are for Windows</span>
<span class="k">elif</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">folder</span><span class="p">)</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">folder</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;dpg&#39;</span><span class="p">,</span> <span class="s1">&#39;dpv&#39;</span><span class="p">,</span> <span class="s1">&#39;dps&#39;</span><span class="p">]:</span>
<span class="c1"># These three are for Windows</span>
<span class="k">elif</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">folder</span><span class="p">)</span> <span class="ow">and</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">folder</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s1">&#39;dpv&#39;</span><span class="p">,</span> <span class="s1">&#39;dps&#39;</span><span class="p">,</span> <span class="s1">&#39;groups&#39;</span><span class="p">]:</span>
<span class="n">folder</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">folder</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">folder</span><span class="p">))</span> <span class="o">==</span> <span class="s1">&#39;dpg&#39;</span><span class="p">:</span>
<span class="n">folder</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s1">&#39;dpg&#39;</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">folder</span><span class="p">))</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">folder</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span>

Expand Down Expand Up @@ -2030,6 +2029,7 @@ <h1>Source code for trx.trx_file_memmap</h1><div class="highlight"><pre>
<span class="n">save</span><span class="p">(</span><span class="n">trx</span><span class="p">,</span> <span class="n">tmp_dir</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="n">trx</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="n">trx</span> <span class="o">=</span> <span class="n">load_from_directory</span><span class="p">(</span><span class="n">tmp_dir</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="n">trx</span><span class="o">.</span><span class="n">_uncompressed_folder_handle</span> <span class="o">=</span> <span class="n">tmp_dir</span>

<span class="n">sft</span><span class="o">.</span><span class="n">to_space</span><span class="p">(</span><span class="n">old_space</span><span class="p">)</span>
<span class="n">sft</span><span class="o">.</span><span class="n">to_origin</span><span class="p">(</span><span class="n">old_origin</span><span class="p">)</span>
Expand Down
5 changes: 2 additions & 3 deletions _modules/trx/workflows.html
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ <h1>Source code for trx.workflows</h1><div class="highlight"><pre>
<span class="n">f_out</span><span class="o">.</span><span class="n">writelines</span><span class="p">(</span><span class="n">f_in</span><span class="p">)</span>
<span class="n">sft</span> <span class="o">=</span> <span class="n">load_tractogram</span><span class="p">(</span><span class="s1">&#39;tmp.trk&#39;</span><span class="p">,</span> <span class="s1">&#39;same&#39;</span><span class="p">,</span>
<span class="n">bbox_valid_check</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="s1">&#39;tmp.trk&#39;</span><span class="p">)</span>
<span class="n">os</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="s1">&#39;tmp.trk&#39;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">in_ext</span> <span class="o">==</span> <span class="s1">&#39;.trk&#39;</span><span class="p">:</span>
<span class="n">sft</span> <span class="o">=</span> <span class="n">load_tractogram</span><span class="p">(</span><span class="n">in_dsi_tractogram</span><span class="p">,</span> <span class="s1">&#39;same&#39;</span><span class="p">,</span>
<span class="n">bbox_valid_check</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
Expand Down Expand Up @@ -603,7 +603,7 @@ <h1>Source code for trx.workflows</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tractogram_obj</span><span class="p">,</span> <span class="n">StatefulTractogram</span><span class="p">):</span>
<span class="n">sft</span> <span class="o">=</span> <span class="n">tractogram_obj</span><span class="o">.</span><span class="n">to_sft</span><span class="p">()</span>
<span class="n">tractogram_obj</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
<span class="c1"># tractogram_obj.close()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">sft</span> <span class="o">=</span> <span class="n">tractogram_obj</span>

Expand Down Expand Up @@ -761,7 +761,6 @@ <h1>Source code for trx.workflows</h1><div class="highlight"><pre>
<span class="n">curr_filename</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">tmp_dir_name</span><span class="p">,</span> <span class="s1">&#39;dps&#39;</span><span class="p">,</span> <span class="s1">&#39;</span><span class="si">{}</span><span class="s1">.</span><span class="si">{}{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
<span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">basename</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">splitext</span><span class="p">(</span><span class="n">arg</span><span class="p">[</span><span class="mi">0</span><span class="p">])[</span><span class="mi">0</span><span class="p">]),</span> <span class="n">dim</span><span class="p">,</span> <span class="n">arg</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
<span class="n">curr_arr</span><span class="o">.</span><span class="n">tofile</span><span class="p">(</span><span class="n">curr_filename</span><span class="p">)</span>

<span class="k">if</span> <span class="n">groups</span><span class="p">:</span>
<span class="n">os</span><span class="o">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">tmp_dir_name</span><span class="p">,</span> <span class="s1">&#39;groups&#39;</span><span class="p">))</span>
<span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">groups</span><span class="p">:</span>
Expand Down

0 comments on commit 8cef03e

Please sign in to comment.