Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Commit

Permalink
Refactor imports (#21)
Browse files Browse the repository at this point in the history
* points to brainrender

* update testing

* refactor

* refactor

* badges

* notes

* initial inj finder commit (#11)

* formatting with black

* add .DS_store to gitignore

* typo

* update imports

* update imports

* deal with no obj path given

* error typo

* move utils too imlib

* remove amap imports

* optional logging to file

* tidy

* registration moved to imlib

* keep largest object

* reduce RAM usage

* remove unnecessary logging args

* adds lesion and track estimation and generic tools

* add missing dir support for cell export

* add missing dir support for cell export

* reduce mem requirements

* remove old code

* remove old code

* refactor scaling

* fix failing heatmap test

* update docs

* ensure output directory exists

* make pixel sizes mandatory

* make pixel sizes mandatory (#17)

* move functionality to imlib

* remove hard coded smoothing

* Refactor (#19)

* make pixel sizes mandatory

* move functionality to imlib

* remove hard coded smoothing

* update docs

* Injectionsite (#20)

* refactors code from SL to import from neuro and imlib only

* moves amap_vis to neuro and removes amap and cellfinder dependencies;

* format with black

* amap_vis

Co-authored-by: Federico Claudi <federicoclaudi@protonmail.com>
Co-authored-by: stephen <stephen.lenzi@gmail.com>
  • Loading branch information
3 people authored Apr 16, 2020
1 parent e524c0d commit ae09539
Show file tree
Hide file tree
Showing 34 changed files with 1,798 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ venv.bak/
.idea/
.vs/
*.~lock.*


# macOS
*.DS_Store
2 changes: 1 addition & 1 deletion doc_build/main/dev/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ clean commit history.


#### Formatting
`neuro` uses [Black](https://github.com/python/black) o ensure a consistent
`neuro` uses [Black](https://github.com/python/black) to ensure a consistent
code style. Please run `black ./ -l 79 --target-version py37` before making
any commits. To prevent any errors, it is easier to add a formatting check
as a [pre-commit hook](https://www.atlassian.com/git/tutorials/git-hooks).
Expand Down
5 changes: 3 additions & 2 deletions doc_build/main/user_guide/tools/cells_to_brainrender.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To convert cell positions (e.g. in `cells_in_standard_space.xml`) to
a format that can be used in
[BrainRender](https://github.com/BrancoLab/BrainRender).


### Usage
```bash
points_to_brainrender cells_in_standard_space.xml exported_cells.h5
```
Expand All @@ -16,7 +16,8 @@ Run `points_to_brainrender -h` to see all options.
#### Positional
* [Cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)
cells file to be converted
* Output filename. Should end with '.h5'
* Output filename. Should end with '.h5'. If the containing directory doesn't
exist, it will be created.


#### The following options may also need to be used:
Expand Down
47 changes: 47 additions & 0 deletions doc_build/main/user_guide/tools/heatmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Heatmap generation

To generate a heatmap of detected cells, which shows cell distributions in a
more intuitive way that showing individual cell positions:


<img src="https://raw.githubusercontent.com/SainsburyWellcomeCentre/cellfinder/master/resources/heatmap.png" alt="heatmap" width="500"/>

*Overlay on raw data and segentation from
[amap](https://github.com/SainsburyWellcomeCentre) added separately*


### Usage
```bash
heatmap cell_classification.xml heatmap.nii raw_data registered_atlas.nii -x 2 -y 2 -z 5
```

### Arguments
Run `heatmap -h` to see all options.

#### Positional arguments
* [Cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)
classified cells file (usually `cell_classification.xml`)
* Output filename. Should end with '.nii'. If the containing directory doesn't
exist, it will be created.
* Path to raw data (just a single channel). Used to find the shape of the
raw image that the detected cell positions are defined in.
* Registered atlas file from [amap](https://github.com/SainsburyWellcomeCentre)
(typically run automatically in
[Cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)). File
is usually `registered_atlas.nii`.


#### Keyword arguments
* `-x` or `--x-pixel-size` Pixel spacing of the data that the cells are
defined in, in the first dimension, specified in um.
* `-y` or `--y-pixel-size` Pixel spacing of the data that the cells are
defined in, in the second dimension, specified in um.
* `-z` or `--z-pixel-size` Pixel spacing of the data that the cells are
defined in, in the third dimension, specified in um.


#### The following options may also need to be used:
* `--heatmap-bin` Heatmap bin size (um of each edge of histogram cube)
* `--heatmap-smoothing` Gaussian smoothing sigma, in um.
* `--no-mask-figs` Don't mask the figures (removing any areas outside the
brain, from e.g. smoothing)
2 changes: 1 addition & 1 deletion docs/_sources/main/dev/CONTRIBUTING.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ clean commit history.


#### Formatting
`neuro` uses [Black](https://github.com/python/black) o ensure a consistent
`neuro` uses [Black](https://github.com/python/black) to ensure a consistent
code style. Please run `black ./ -l 79 --target-version py37` before making
any commits. To prevent any errors, it is easier to add a formatting check
as a [pre-commit hook](https://www.atlassian.com/git/tutorials/git-hooks).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To convert cell positions (e.g. in `cells_in_standard_space.xml`) to
a format that can be used in
[BrainRender](https://github.com/BrancoLab/BrainRender).


### Usage
```bash
points_to_brainrender cells_in_standard_space.xml exported_cells.h5
```
Expand All @@ -16,7 +16,8 @@ Run `points_to_brainrender -h` to see all options.
#### Positional
* [Cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)
cells file to be converted
* Output filename. Should end with '.h5'
* Output filename. Should end with '.h5'. If the containing directory doesn't
exist, it will be created.


#### The following options may also need to be used:
Expand Down
47 changes: 47 additions & 0 deletions docs/_sources/main/user_guide/tools/heatmap.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Heatmap generation

To generate a heatmap of detected cells, which shows cell distributions in a
more intuitive way that showing individual cell positions:


<img src="https://raw.githubusercontent.com/SainsburyWellcomeCentre/cellfinder/master/resources/heatmap.png" alt="heatmap" width="500"/>

*Overlay on raw data and segentation from
[amap](https://github.com/SainsburyWellcomeCentre) added separately*


### Usage
```bash
heatmap cell_classification.xml heatmap.nii raw_data registered_atlas.nii -x 2 -y 2 -z 5
```

### Arguments
Run `heatmap -h` to see all options.

#### Positional arguments
* [Cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)
classified cells file (usually `cell_classification.xml`)
* Output filename. Should end with '.nii'. If the containing directory doesn't
exist, it will be created.
* Path to raw data (just a single channel). Used to find the shape of the
raw image that the detected cell positions are defined in.
* Registered atlas file from [amap](https://github.com/SainsburyWellcomeCentre)
(typically run automatically in
[Cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)). File
is usually `registered_atlas.nii`.


#### Keyword arguments
* `-x` or `--x-pixel-size` Pixel spacing of the data that the cells are
defined in, in the first dimension, specified in um.
* `-y` or `--y-pixel-size` Pixel spacing of the data that the cells are
defined in, in the second dimension, specified in um.
* `-z` or `--z-pixel-size` Pixel spacing of the data that the cells are
defined in, in the third dimension, specified in um.


#### The following options may also need to be used:
* `--heatmap-bin` Heatmap bin size (um of each edge of histogram cube)
* `--heatmap-smoothing` Gaussian smoothing sigma, in um.
* `--no-mask-figs` Don't mask the figures (removing any areas outside the
brain, from e.g. smoothing)
1 change: 1 addition & 0 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="main/user_guide/tools/cells_to_brainrender.html">Converting cells from cellfinder to brainrender format</a></li>
<li class="toctree-l1"><a class="reference internal" href="main/user_guide/tools/heatmap.html">Heatmap generation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="main/dev/CONTRIBUTING.html">Contributing</a></li>
Expand Down
2 changes: 2 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="main/user_guide/tools/cells_to_brainrender.html">Converting cells from cellfinder to brainrender format</a></li>
<li class="toctree-l1"><a class="reference internal" href="main/user_guide/tools/heatmap.html">Heatmap generation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="main/dev/CONTRIBUTING.html">Contributing</a></li>
Expand Down Expand Up @@ -165,6 +166,7 @@ <h2>Tools<a class="headerlink" href="#tools" title="Permalink to this headline">
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="main/user_guide/tools/cells_to_brainrender.html">Converting cells from cellfinder to brainrender format</a></li>
<li class="toctree-l1"><a class="reference internal" href="main/user_guide/tools/heatmap.html">Heatmap generation</a></li>
</ul>
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions docs/main/dev/CONTRIBUTING.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="prev" title="Converting cells from cellfinder to brainrender format" href="../user_guide/tools/cells_to_brainrender.html" />
<link rel="prev" title="Heatmap generation" href="../user_guide/tools/heatmap.html" />
</head>

<body class="wy-body-for-nav">
Expand Down Expand Up @@ -81,6 +81,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/tools/cells_to_brainrender.html">Converting cells from cellfinder to brainrender format</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/tools/heatmap.html">Heatmap generation</a></li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Contributing</a><ul>
Expand Down Expand Up @@ -186,7 +187,7 @@ <h2>Pull requests<a class="headerlink" href="#pull-requests" title="Permalink to
</div>
<div class="section" id="formatting">
<h2>Formatting<a class="headerlink" href="#formatting" title="Permalink to this headline"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">neuro</span></code> uses <a class="reference external" href="https://github.com/python/black">Black</a> o ensure a consistent
<p><code class="docutils literal notranslate"><span class="pre">neuro</span></code> uses <a class="reference external" href="https://github.com/python/black">Black</a> to ensure a consistent
code style. Please run <code class="docutils literal notranslate"><span class="pre">black</span> <span class="pre">./</span> <span class="pre">-l</span> <span class="pre">79</span> <span class="pre">--target-version</span> <span class="pre">py37</span></code> before making
any commits. To prevent any errors, it is easier to add a formatting check
as a <a class="reference external" href="https://www.atlassian.com/git/tutorials/git-hooks">pre-commit hook</a>.
Expand Down Expand Up @@ -235,7 +236,7 @@ <h2>Dependencies<a class="headerlink" href="#dependencies" title="Permalink to t
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">


<a href="../user_guide/tools/cells_to_brainrender.html" class="btn btn-neutral float-left" title="Converting cells from cellfinder to brainrender format" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="../user_guide/tools/heatmap.html" class="btn btn-neutral float-left" title="Heatmap generation" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>

</div>

Expand Down
12 changes: 9 additions & 3 deletions docs/main/user_guide/tools/cells_to_brainrender.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="Contributing" href="../../dev/CONTRIBUTING.html" />
<link rel="next" title="Heatmap generation" href="heatmap.html" />
<link rel="prev" title="neuro" href="../../../index.html" />
</head>

Expand Down Expand Up @@ -82,6 +82,7 @@

<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Converting cells from cellfinder to brainrender format</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#usage">Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="#arguments">Arguments</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#positional">Positional</a></li>
<li class="toctree-l3"><a class="reference internal" href="#the-following-options-may-also-need-to-be-used">The following options may also need to be used:</a></li>
Expand All @@ -90,6 +91,7 @@
<li class="toctree-l2"><a class="reference internal" href="#to-visualise-this-file-in-brainrender">To visualise this file in BrainRender</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="heatmap.html">Heatmap generation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../dev/CONTRIBUTING.html">Contributing</a></li>
Expand Down Expand Up @@ -160,9 +162,12 @@ <h1>Converting cells from cellfinder to brainrender format<a class="headerlink"
<p>To convert cell positions (e.g. in <code class="docutils literal notranslate"><span class="pre">cells_in_standard_space.xml</span></code>) to
a format that can be used in
<a class="reference external" href="https://github.com/BrancoLab/BrainRender">BrainRender</a>.</p>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span> points_to_brainrender cells_in_standard_space.xml exported_cells.h5
</pre></div>
</div>
</div>
<div class="section" id="arguments">
<h2>Arguments<a class="headerlink" href="#arguments" title="Permalink to this headline"></a></h2>
<p>Run <code class="docutils literal notranslate"><span class="pre">points_to_brainrender</span> <span class="pre">-h</span></code> to see all options.</p>
Expand All @@ -171,7 +176,8 @@ <h3>Positional<a class="headerlink" href="#positional" title="Permalink to this
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/SainsburyWellcomeCentre/cellfinder">Cellfinder</a>
cells file to be converted</p></li>
<li><p>Output filename. Should end with ‘.h5’</p></li>
<li><p>Output filename. Should end with ‘.h5’. If the containing directory doesn’t
exist, it will be created.</p></li>
</ul>
</div>
<div class="section" id="the-following-options-may-also-need-to-be-used">
Expand Down Expand Up @@ -208,7 +214,7 @@ <h2>To visualise this file in BrainRender<a class="headerlink" href="#to-visuali

<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">

<a href="../../dev/CONTRIBUTING.html" class="btn btn-neutral float-right" title="Contributing" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="heatmap.html" class="btn btn-neutral float-right" title="Heatmap generation" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>


<a href="../../../index.html" class="btn btn-neutral float-left" title="neuro" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
Expand Down
Loading

0 comments on commit ae09539

Please sign in to comment.