Skip to content

Commit

Permalink
Replaced the term script with command as needed for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-rijsketic committed Jun 19, 2024
1 parent d7e17cf commit dbf600c
Show file tree
Hide file tree
Showing 66 changed files with 70 additions and 75 deletions.
2 changes: 1 addition & 1 deletion unravel/cluster_stats/cluster_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def parse_args():
# TODO: Move cell vs. label arg from config back to argparse and make it a required arg to prevent accidentally using the wrong metric

def run_script(script_name, script_args):
"""Run a script using subprocess that respects the system's PATH and captures output."""
"""Run a command/script using subprocess that respects the system's PATH and captures output."""
# Convert all script arguments to string
script_args = [str(arg) for arg in script_args]
command = [script_name] + script_args
Expand Down
4 changes: 2 additions & 2 deletions unravel/cluster_stats/cluster_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
- ./sample??/clusters/<cluster_index_dir>/outer_bounds.txt
- ./sample??/clusters/<cluster_index_dir>/<args.density>_data.csv
For -s, if a dir name is provided, the script will load ./sample??/seg_dir/sample??_seg_dir.nii.gz.
If a relative path is provided, the script will load the image at the specified path.
For -s, if a dir name is provided, the command will load ./sample??/seg_dir/sample??_seg_dir.nii.gz.
If a relative path is provided, the command will load the image at the specified path.
Next command:
``cluster_summary``
Expand Down
6 changes: 3 additions & 3 deletions unravel/cluster_stats/group_bilateral_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
Use ``cluster_group_data`` from UNRAVEL to organize bilateral csv outputs from ``cluster_validation``
Run this script in the target_dir from ``cluster_org_data``
Run this command in the target_dir from ``cluster_org_data``
Usage
-----
Expand All @@ -15,13 +15,13 @@
- <cluster_validation_dir>_LH for left hemisphere files
- <cluster_validation_dir>_RH for right hemisphere files
For example, if the script is run in a directory containing the following directories:
For example, if the command is run in a directory containing the following directories:
- cluster_valid_results_1_LH
- cluster_valid_results_1_RH
- cluster_valid_results_2_LH
- cluster_valid_results_2_RH
The script will create a new directory for each cluster and move the corresponding left and right hemisphere files into it.
The command will create a new directory for each cluster and move the corresponding left and right hemisphere files into it.
The original directories will be removed.
The resulting directory structure will be:
Expand Down
2 changes: 1 addition & 1 deletion unravel/cluster_stats/prism.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- condition2_sample03_<cell|label>_density_data.csv
- condition2_sample04_<cell|label>_density_data.csv
Example bilateral inputs (if any file has _LH.csv or _RH.csv, the script will attempt to pool data):
Example bilateral inputs (if any file has _LH.csv or _RH.csv, the command will attempt to pool data):
- condition1_sample01_<cell|label>_density_data_LH.csv
- condition1_sample01_<cell|label>_density_data_RH.csv
- ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-----
cluster_mirror_indices -m RH -v
Use this script after ``cluster_fdr`` to mirror the cluster indices for the other side of the brain before running ``cluster_validation``.
Use this command after ``cluster_fdr`` to mirror the cluster indices for the other side of the brain before running ``cluster_validation``.
"""

import argparse
Expand Down
2 changes: 1 addition & 1 deletion unravel/cluster_stats/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- condition2_sample03_<cell|label>_density_data.csv
- condition2_sample04_<cell|label>_density_data.csv
Example bilateral inputs (if any file has _LH.csv or _RH.csv, the script will attempt to pool data):
Example bilateral inputs (if any file has _LH.csv or _RH.csv, the command will attempt to pool data):
- condition1_sample01_<cell|label>_density_data_LH.csv
- condition1_sample01_<cell|label>_density_data_RH.csv
Expand Down
2 changes: 1 addition & 1 deletion unravel/cluster_stats/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cluster_table
Prereqs:
``cluster_index`` has been run. Run this script from the valid_clusters dir. <asterisk>cluster_info.txt in working dir.
``cluster_index`` has been run. Run this command from the valid_clusters dir. <asterisk>cluster_info.txt in working dir.
Sorting by hierarchy and volume:
--------------------------------
Expand Down
Binary file modified unravel/docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/cluster_stats/prism.doctree
Binary file not shown.
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/cluster_stats/stats.doctree
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/cluster_stats/table.doctree
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/image_io/h5_to_tifs.doctree
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/image_io/metadata.doctree
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/image_tools/DoG.doctree
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/register/reg_prep.doctree
Binary file not shown.
Binary file modified unravel/docs/_build/doctrees/unravel/segment/brain_mask.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ <h1>Source code for unravel.cluster_stats.cluster_summary</h1><div class="highli
<div class="viewcode-block" id="run_script">
<a class="viewcode-back" href="../../../unravel/cluster_stats/cluster_summary.html#unravel.cluster_stats.cluster_summary.run_script">[docs]</a>
<span class="k">def</span> <span class="nf">run_script</span><span class="p">(</span><span class="n">script_name</span><span class="p">,</span> <span class="n">script_args</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Run a script using subprocess that respects the system&#39;s PATH and captures output.&quot;&quot;&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Run a command/script using subprocess that respects the system&#39;s PATH and captures output.&quot;&quot;&quot;</span>
<span class="c1"># Convert all script arguments to string</span>
<span class="n">script_args</span> <span class="o">=</span> <span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span> <span class="k">for</span> <span class="n">arg</span> <span class="ow">in</span> <span class="n">script_args</span><span class="p">]</span>
<span class="n">command</span> <span class="o">=</span> <span class="p">[</span><span class="n">script_name</span><span class="p">]</span> <span class="o">+</span> <span class="n">script_args</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ <h1>Source code for unravel.cluster_stats.cluster_validation</h1><div class="hig
<span class="sd"> - ./sample??/clusters/&lt;cluster_index_dir&gt;/outer_bounds.txt</span>
<span class="sd"> - ./sample??/clusters/&lt;cluster_index_dir&gt;/&lt;args.density&gt;_data.csv</span>

<span class="sd">For -s, if a dir name is provided, the script will load ./sample??/seg_dir/sample??_seg_dir.nii.gz. </span>
<span class="sd">If a relative path is provided, the script will load the image at the specified path.</span>
<span class="sd">For -s, if a dir name is provided, the command will load ./sample??/seg_dir/sample??_seg_dir.nii.gz. </span>
<span class="sd">If a relative path is provided, the command will load the image at the specified path.</span>

<span class="sd">Next command:</span>
<span class="sd"> ``cluster_summary``</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ <h1>Source code for unravel.cluster_stats.group_bilateral_data</h1><div class="h
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Use ``cluster_group_data`` from UNRAVEL to organize bilateral csv outputs from ``cluster_validation``</span>

<span class="sd">Run this script in the target_dir from ``cluster_org_data``</span>
<span class="sd">Run this command in the target_dir from ``cluster_org_data``</span>
<span class="sd"> </span>
<span class="sd">Usage</span>
<span class="sd">-----</span>
Expand All @@ -366,13 +366,13 @@ <h1>Source code for unravel.cluster_stats.group_bilateral_data</h1><div class="h
<span class="sd"> - &lt;cluster_validation_dir&gt;_LH for left hemisphere files</span>
<span class="sd"> - &lt;cluster_validation_dir&gt;_RH for right hemisphere files</span>

<span class="sd">For example, if the script is run in a directory containing the following directories:</span>
<span class="sd">For example, if the command is run in a directory containing the following directories:</span>
<span class="sd"> - cluster_valid_results_1_LH</span>
<span class="sd"> - cluster_valid_results_1_RH</span>
<span class="sd"> - cluster_valid_results_2_LH</span>
<span class="sd"> - cluster_valid_results_2_RH</span>

<span class="sd">The script will create a new directory for each cluster and move the corresponding left and right hemisphere files into it. </span>
<span class="sd">The command will create a new directory for each cluster and move the corresponding left and right hemisphere files into it. </span>
<span class="sd">The original directories will be removed.</span>

<span class="sd">The resulting directory structure will be:</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ <h1>Source code for unravel.cluster_stats.prism</h1><div class="highlight"><pre>
<span class="sd"> - condition2_sample03_&lt;cell|label&gt;_density_data.csv</span>
<span class="sd"> - condition2_sample04_&lt;cell|label&gt;_density_data.csv</span>

<span class="sd">Example bilateral inputs (if any file has _LH.csv or _RH.csv, the script will attempt to pool data):</span>
<span class="sd">Example bilateral inputs (if any file has _LH.csv or _RH.csv, the command will attempt to pool data):</span>
<span class="sd"> - condition1_sample01_&lt;cell|label&gt;_density_data_LH.csv</span>
<span class="sd"> - condition1_sample01_&lt;cell|label&gt;_density_data_RH.csv</span>
<span class="sd"> - ...</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ <h1>Source code for unravel.cluster_stats.recursively_mirror_rev_cluster_indices
<span class="sd">-----</span>
<span class="sd"> cluster_mirror_indices -m RH -v</span>
<span class="sd"> </span>
<span class="sd">Use this script after ``cluster_fdr`` to mirror the cluster indices for the other side of the brain before running ``cluster_validation``. </span>
<span class="sd">Use this command after ``cluster_fdr`` to mirror the cluster indices for the other side of the brain before running ``cluster_validation``. </span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">argparse</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ <h1>Source code for unravel.cluster_stats.stats</h1><div class="highlight"><pre>
<span class="sd"> - condition2_sample03_&lt;cell|label&gt;_density_data.csv</span>
<span class="sd"> - condition2_sample04_&lt;cell|label&gt;_density_data.csv</span>

<span class="sd">Example bilateral inputs (if any file has _LH.csv or _RH.csv, the script will attempt to pool data):</span>
<span class="sd">Example bilateral inputs (if any file has _LH.csv or _RH.csv, the command will attempt to pool data):</span>
<span class="sd"> - condition1_sample01_&lt;cell|label&gt;_density_data_LH.csv</span>
<span class="sd"> - condition1_sample01_&lt;cell|label&gt;_density_data_RH.csv</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ <h1>Source code for unravel.cluster_stats.table</h1><div class="highlight"><pre>
<span class="sd"> cluster_table</span>

<span class="sd">Prereqs:</span>
<span class="sd"> ``cluster_index`` has been run. Run this script from the valid_clusters dir. &lt;asterisk&gt;cluster_info.txt in working dir.</span>
<span class="sd"> ``cluster_index`` has been run. Run this command from the valid_clusters dir. &lt;asterisk&gt;cluster_info.txt in working dir.</span>

<span class="sd">Sorting by hierarchy and volume:</span>
<span class="sd">--------------------------------</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,13 @@ <h1>Source code for unravel.image_io.h5_to_tifs</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Use ``io_h5_to_tifs`` from UNRAVEL to load a h5/hdf5 image and save it as tifs.</span>

<span class="sd">Run this script from a sample?? folder containing the image.h5 file.</span>

<span class="sd">Usage:</span>
<span class="sd">------</span>
<span class="sd"> io_h5_to_tifs -i path/image.h5 -t autofl</span>

<span class="sd">Inputs:</span>
<span class="sd"> - image.h5 either from -i path/image.h5 or largest &lt;asterisk&gt;.h5 in cwd</span>
<span class="sd"> - This script assumes that the first dataset in the hdf5 file has the highest resolution.</span>
<span class="sd"> - This assumes that the first dataset in the hdf5 file has the highest resolution.</span>

<span class="sd">Outputs:</span>
<span class="sd"> - ./&lt;tif_dir_out&gt;/slice_&lt;asterisk&gt;.tif series</span>
Expand Down Expand Up @@ -488,7 +486,7 @@ <h1>Source code for unravel.image_io.h5_to_tifs</h1><div class="highlight"><pre>
<span class="c1"># Make parameters directory in the sample?? folder</span>
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="s2">&quot;parameters&quot;</span><span class="p">,</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="c1"># Save metadata to text file so resolution can be obtained by other scripts</span>
<span class="c1"># Save metadata to text file so resolution can be obtained by other commands/modules</span>
<span class="n">metadata_txt_path</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="s2">&quot;parameters&quot;</span><span class="p">,</span> <span class="s2">&quot;metadata&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">metadata_txt_path</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
<span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">f</span><span class="s1">&#39;Voxel size: </span><span class="si">{</span><span class="n">xy_res</span><span class="si">}</span><span class="s1">x</span><span class="si">{</span><span class="n">xy_res</span><span class="si">}</span><span class="s1">x</span><span class="si">{</span><span class="n">z_res</span><span class="si">}</span><span class="s1"> micron^3&#39;</span><span class="p">)</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ <h1>Source code for unravel.image_io.metadata</h1><div class="highlight"><pre>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Use ``io_metadata`` from UNRAVEL to save x/y and z voxel sizes in microns as well as image dimensions to a metadata file in each sample directory.</span>

<span class="sd">Run this script from an experiment, sample?? folder, or provide -e/--exp_paths and -d/--dirs arguments to specify the experiment and sample directories.</span>
<span class="sd">Run this command from an experiment, sample?? folder, or provide -e/--exp_paths and -d/--dirs arguments to specify the experiment and sample directories.</span>

<span class="sd">Usage for when metadata is extractable:</span>
<span class="sd">---------------------------------------</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ <h1>Source code for unravel.image_io.tif_to_tifs</h1><div class="highlight"><pre
<span class="c1"># Make parameters directory in the sample?? folder</span>
<span class="n">os</span><span class="o">.</span><span class="n">makedirs</span><span class="p">(</span><span class="s2">&quot;parameters&quot;</span><span class="p">,</span> <span class="n">exist_ok</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="c1"># Save metadata to text file so resolution can be obtained by other scripts</span>
<span class="c1"># Save metadata to text file so resolution can be obtained by other commands/modules</span>
<span class="n">metadata_txt_path</span> <span class="o">=</span> <span class="n">Path</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="s2">&quot;parameters&quot;</span><span class="p">,</span> <span class="s2">&quot;metadata&quot;</span><span class="p">)</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">metadata_txt_path</span><span class="p">,</span> <span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
<span class="n">file</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Voxel size: </span><span class="si">{</span><span class="n">xy_res</span><span class="si">:</span><span class="s2">.4f</span><span class="si">}</span><span class="s2">x</span><span class="si">{</span><span class="n">xy_res</span><span class="si">:</span><span class="s2">.4f</span><span class="si">}</span><span class="s2">x</span><span class="si">{</span><span class="n">z_res</span><span class="si">:</span><span class="s2">.4f</span><span class="si">}</span><span class="s2"> µm^3&quot;</span><span class="p">)</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1>Source code for unravel.image_tools.DoG</h1><div class="highlight"><pre>
<span class="sd"> - The ratio of simga2 to sigma1 should ideally be at least 1.5 to 2. This helps ensure that the blurring difference is significant enough to highlight the features of interest.</span>

<span class="sd">Note: </span>
<span class="sd"> - This script is intended to test the DoG method on a single image.</span>
<span class="sd"> - This command is intended to test the DoG method on a single image.</span>
<span class="sd"> - 2D DoG is not implemented in vstats_prep. </span>
<span class="sd"> - DoG could be added to vstats_prep in the future if needed. </span>
<span class="sd"> - 3D spatial averaging and 2D rolling ball background subtraction are used in vstats_prep instead.</span>
Expand Down
Loading

0 comments on commit dbf600c

Please sign in to comment.