Skip to content

Commit b7d73b6

Browse files
adamltysongitbook-bot
authored andcommitted
GitBook: [master] 53 pages modified
1 parent 2b1c899 commit b7d73b6

File tree

6 files changed

+60
-50
lines changed

6 files changed

+60
-50
lines changed

SUMMARY.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@
5555
* [Introduction](brainreg/introduction.md)
5656
* [Installation](brainreg/installation.md)
5757
* [User guide](brainreg/getting-started/README.md)
58-
* [Image orientation](brainreg/getting-started/image-orientation.md)
5958
* [Registration parameters](brainreg/getting-started/registration-parameters.md)
60-
* [Downloading files](brainreg/downloading-files.md)
61-
6259

6360
## neuro
6461

@@ -96,4 +93,5 @@
9693
* [cellfinder](https://github.com/SainsburyWellcomeCentre/cellfinder)
9794
* [amap](https://github.com/SainsburyWellcomeCentre/amap-python)
9895
* [neuro](https://github.com/SainsburyWellcomeCentre/neuro)
96+
* [brainreg](https://github.com/brainglobe/brainreg)
9997

amap/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Remember to activate your conda environment before doing anything
4848
pip install amap
4949
```
5050

51-
## Download atlas and trained classification models \(optional\)
51+
## Download atlas \(optional\)
5252

5353
When you run amap, it will download the files it needs \(e.g. the atlas\). If you want to save time later, or you know you won't have an internet connection when you run amap you can download these in advance. See [downloading files](downloading-files.md) for details.
5454

brainreg/getting-started/README.md

+35-13
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ description: How to register your data to the template
77
## Basic usage
88

99
```bash
10-
amap /path/to/raw/data /path/to/output/directory -x 2 -y 2 -z 5
10+
brainreg /path/to/raw/data /path/to/output/directory -x 2 -y 2 -z 5
1111
```
1212

1313
{% hint style="info" %}
14-
Full command-line arguments are available with `amap -h`
14+
Full command-line arguments are available with `brainreg -h`
1515
{% endhint %}
1616

1717
{% hint style="warning" %}
18-
If you have any spaces in your file-path, please enclose it in quotation marks, otherwise amap will interpret it as two inputs, separated by a space.
18+
If you have any spaces in your file-path, please enclose it in quotation marks, otherwise brainreg will interpret it as two inputs, separated by a space.
1919

20-
**i.e. `"/path/to/my data"` not `path/to/my data`.**
20+
**i.e. `"/path/to/my data"` not `path/to/my data`.**
2121
{% endhint %}
2222

2323
## Arguments
@@ -34,28 +34,50 @@ You must also specify the pixel sizes, see [Specifying pixel size](../../user-gu
3434
### Additional options
3535

3636
* `-d` or `--downsample` Paths to N additional channels to downsample to the same coordinate space.
37-
* `--no-save-downsampled` Don't save the downsampled brain before filtering.
38-
* `--registration-config` To supply your own, custom registration configuration file
3937
* `--sort-input-file` If set to true, the input text file will be sorted using natural sorting. This means that the file paths will be sorted as would be expected by a human and not purely alphabetically
4038

4139
#### Misc options
4240

4341
* `--n-free-cpus` The number of CPU cores on the machine to leave unused by the program to spare resources.
4442
* `--debug` Debug mode. Will increase verbosity of logging and save all intermediate files for diagnosis of software issues.
4543

44+
### Atlas
45+
46+
By default, brainreg will use the 25um version of the [Allen Mouse Brain Atlas](https://mouse.brain-map.org/). To use another atlas \(e.g. for another species, or another resolution\), you must use the `--atlas` flag, followed by the string describing the atlas, e.g.:
47+
48+
```bash
49+
--atlas allen_mouse_50um
50+
```
51+
52+
{% hint style="info" %}
53+
To find out which atlases are available, once brainreg is installed, please run `brainglobe list`. The name of the resulting atlases is the string to pass with the `--atlas` flag.
54+
{% endhint %}
55+
56+
### Registration backend
57+
58+
To change the registration algorithm used, use the `--backend` flag. The default is `niftyreg` as that is currently the only option.
59+
4660
### Input data orientation
4761

48-
If your data does not match the NifTI standard orientation \(origin is the most ventral, posterior, left voxel\), then please see [Image orientation](image-orientation.md) to reorient the atlas
62+
If your data does not match the [brainglobe](https://github.com/brainglobe) default orientation \(the origin voxel is the most anterior, superior, left-most voxel, then you must specify the orientation by using the `--orientation` flag. What follows must be a string in the [bg-space](https://github.com/brainglobe/bg-space) "initials" form, to describe the origin voxel.
4963

50-
### Registration options
64+
{% hint style="info" %}
65+
When you work with a stack, the origin is the upper left corner when you show the first element `stack[0, :, :]` with matplotlib or when you open the stack with ImageJ. First dimension is the one that you are slicing, the second the height of the image, and the third the width of the image.
66+
{% endhint %}
5167

52-
To change how the actual registration performs, see [Registration parameters](registration-parameters.md)
68+
If the origin of your data \(first, top left voxel\) is the most posterior, superior, left part of the brain, then the orientation string would be "psl" \(posterior, superior, left\), and you would use:
5369

54-
### Visualisation options
70+
```bash
71+
--orientation psl
72+
```
5573

56-
* `--no-boundaries` Do not precompute the outline images \(if you don't want to use `amap_vis`\)
74+
{% hint style="warning" %}
75+
The order of the three initials must be the same as the axis order \(sliced plane, height, width\)
76+
{% endhint %}
77+
78+
### Registration options
79+
80+
To change how the actual registration performs, see [Registration parameters](registration-parameters.md)
5781

58-
## Visualisation
5982

60-
To visualise your data, please see [Visualisation](../../user-guide/visualisation.md)
6183

brainreg/getting-started/registration-parameters.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ description: How to refine the registration to the template image
44

55
# Registration parameters
66

7-
To change how the image registration performs, you can change the options that are passed to [NiftyReg](http://cmictig.cs.ucl.ac.uk/wiki/index.php/NiftyReg):
7+
To change how the image registration performs, you can change the options that are passed to the registration backend.
88

9-
### **Affine registration**
9+
## NiftyReg
10+
11+
If using the [NiftyReg](http://cmictig.cs.ucl.ac.uk/wiki/index.php/NiftyReg) backend, the following options can be changed:
12+
13+
#### **Affine registration**
1014

1115
* `--affine-n-steps` Registration starts with further downsampled versions of the original data to optimize the global fit of the result and prevent "getting stuck" in local minima of the similarity function. This parameter determines how many downsampling steps are being performed, with each step halving the data size along each dimension. **Default: 6**
1216
* `--affine-use-n-steps` Determines how many of the downsampling steps defined by `-affine-n-steps` will have their registration computed. The combination `--affine-n-steps 3 --affine-use-n-steps 2` will e.g. calculate 3 downsampled steps, each of which is half the size of the previous one but only perform the registration on the 2 smallest resampling steps, skipping the full resolution data. Can be used to save time if running the full resolution doesn't result in noticeable improvements. **Default: 5**
1317

14-
### **Freeform registration**
18+
#### **Freeform registration**
1519

1620
* `--freeform-n-steps` Registration starts with further downsampled versions of the original data to optimize the global fit of the result and prevent "getting stuck" in local minima of the similarity function. This parameter determines how many downsampling steps are being performed, with each step halving the data size along each dimension. **Default: 6**
1721
* `--freeform-use-n-steps` Determines how many of the downsampling steps defined by `--freeform-n-steps` will have their registration computed. The combination `--freeform-n-steps 3 --freeform-use-n-steps 2` will e.g. calculate 3 downsampled steps, each of which is half the size of the previous one but only perform the registration on the 2 smallest resampling steps, skipping the full resolution data. Can be used to save time if running the full resolution doesn't result in noticeable improvements. **Default: 4**

brainreg/installation.md

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
---
2-
description: Installing amap
2+
description: Installing brainreg
33
---
44

55
# Installation
66

7-
{% hint style="warning" %}
8-
If you already have cellfinder, then amap has been installed for you.
9-
{% endhint %}
10-
117
## Introduction
128

13-
amap is included with cellfinder. Unless you have a particular reason not to, I would install cellfinder as this will install all the packages you may need. See [cellfinder installation](../installation/installation.md).
14-
159
If you know what you're doing just run:
1610

1711
```bash
18-
pip install amap
12+
pip install brainreg
1913
```
2014

2115
{% hint style="info" %}
@@ -24,31 +18,31 @@ If you're not completely sure what you're doing, read on.
2418

2519
## Requirements
2620

27-
To run amap you will need a fairly high-powered computer running Windows or Linux \(see [system requirements](../installation/system-requirements.md) for details\). In particular, to use some of the atlases, you may need at least 32GB of RAM.
21+
The hardware requirements for brainreg depend on the atlas \(and in particular the resolution\) you want to use. Most machines \(including laptops\) will be able to use most of the atlases, but some atlases \(such as the 10um mouse atlases\) may need up to 32GB of RAM.
22+
23+
Currently brainreg works on Windows and Linux. macOS support is experimental.
2824

2925
## Setting up your machine
3026

3127
### Installing Python
3228

33-
amap is written in Python, and so needs a functional Python installation. Your machine may already have Python installed, but **I recommend installing miniconda**.
29+
brainreg is written in Python, and so needs a functional Python installation. Your machine may already have Python installed, but **I recommend installing miniconda**.
3430

35-
**See** [**Using conda**](../installation/using-conda.md) **for details.**
31+
**See** [**Using conda**](../installation/using-conda.md) **for details.**
3632

3733
{% hint style="danger" %}
38-
amap should run on any type of Python installation, but if you don't use conda, I may not be able to help you.
34+
brainreg should run on any type of Python installation, but if you don't use conda, I may not be able to help you.
3935
{% endhint %}
4036

41-
## Installing amap
37+
## Installing brainreg
4238

4339
{% hint style="info" %}
4440
Remember to activate your conda environment before doing anything
4541
{% endhint %}
4642

4743
```bash
48-
pip install amap
44+
pip install brainreg
4945
```
5046

51-
## Download atlas and trained classification models \(optional\)
5247

53-
When you run amap, it will download the files it needs \(e.g. the atlas\). If you want to save time later, or you know you won't have an internet connection when you run amap you can download these in advance. See [downloading files](downloading-files.md) for details.
5448

brainreg/introduction.md

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
11
# Introduction
22

3-
{% hint style="info" %}
4-
amap is included with cellfinder, and exists as a standalone tool if you do not need the cell detection part
5-
{% endhint %}
6-
73
## About
84

9-
amap is the part of cellfinder that takes care of image registration and atlas-based segmentation. It is a Python port of [aMAP](https://github.com/SainsburyWellcomeCentre/aMAP/wiki) \(originally written in Java\), which has been [validated against human segmentation](https://www.nature.com/articles/ncomms11879).
5+
brainreg is an update to [amap](https://github.com/SainsburyWellcomeCentre/amap-python) \(itself a port of the [original Java software](https://www.nature.com/articles/ncomms11879)\) to include multiple registration backends, and to support the many atlases provided by [bg-atlasapi](https://github.com/brainglobe/bg-atlasapi).
106

11-
The actual registration is carried out by [NiftyReg](http://cmictig.cs.ucl.ac.uk/wiki/index.php/NiftyReg).
7+
Currently the only registration backend is [NiftyReg](http://cmictig.cs.ucl.ac.uk/wiki/index.php/NiftyReg).
128

139
## Details
1410

15-
The aim of amap is to register the template brain \(e.g. from the [Allen Reference Atlas](https://mouse.brain-map.org/static/atlas)\) to the sample image. Once this is complete, any other image in the template space can be aligned with the sample \(such as region annotations, for segmentation of the sample image\). The template to sample transformation can also be inverted, allowing sample images to be aligned in a common coordinate space.
11+
The aim of brainreg is to register the template brain \(e.g. from the [Allen Reference Atlas](https://mouse.brain-map.org/static/atlas)\) to the sample image. Once this is complete, any other image in the template space can be aligned with the sample \(such as region annotations, for segmentation of the sample image\). The template to sample transformation can also be inverted, allowing sample images to be aligned in a common coordinate space.
1612

1713
To do this, the template and sample images are filtered, and then registered in a three step process \(reorientation, affine registration, and freeform registration.\) The resulting transform from template to standard space is then applied to the atlas.
1814

19-
Full details of the process are in the [original paper](https://www.nature.com/articles/ncomms11879).
15+
Full details of the process are in the [original paper](https://www.nature.com/articles/ncomms11879).
2016

2117
![Overview of the registration process](https://raw.githubusercontent.com/SainsburyWellcomeCentre/amap-python/master/resources/reg_process.png)
2218

2319
## Installation
2420

2521
```bash
26-
pip install amap
22+
pip install brainreg
2723
```
2824

2925
{% hint style="info" %}
@@ -33,14 +29,10 @@ For detailed instructions see [Installation](installation.md)
3329
## Usage
3430

3531
```bash
36-
amap /path/to/raw/data /path/to/output/directory -x 2 -y 2 -z 5
32+
brainreg /path/to/raw/data /path/to/output/directory -x 2 -y 2 -z 5
3733
```
3834

3935
{% hint style="info" %}
4036
For more information see [Getting started](getting-started/)
4137
{% endhint %}
4238

43-
###
44-
45-
46-

0 commit comments

Comments
 (0)