|
| 1 | +--- |
| 2 | +description: Getting started with brainreg |
| 3 | +--- |
| 4 | + |
| 5 | +# Tutorial |
| 6 | + |
| 7 | +To test out brainreg, we supply a small mouse brain dataset to get you started. |
| 8 | + |
| 9 | +{% hint style="info" %} |
| 10 | +For full information on how to use brainreg, please see the [User guide](getting-started/) |
| 11 | +{% endhint %} |
| 12 | + |
| 13 | +### Instructions: |
| 14 | + |
| 15 | +#### Setting up |
| 16 | + |
| 17 | +* Download the data from [here](https://gin.g-node.org/cellfinder/data/raw/master/brainreg/test_brain.zip) \(the dataset is ~10MB, so it should download quickly\). |
| 18 | +* Unzip the data to a directory of your choice \(doesn't matter where\). You should end up with a directory called `test_brain` with 270 `.tif` images |
| 19 | +* Open a terminal \(Linux\) or your command prompt \(Windows\) |
| 20 | +* Activate your [conda environment ](../installation/using-conda.md) |
| 21 | + |
| 22 | +#### Run brainreg |
| 23 | + |
| 24 | +To run brainreg, you need to know: |
| 25 | + |
| 26 | +* Where your data is \(in this case, it's the path to the `test_brain` directory\) |
| 27 | +* Where you want to save the output data \(we'll just save it into a directory called `brainreg_output`in the same directory as the `test_brain`\) |
| 28 | +* The pixel sizes of your data in microns \(see [Specifying pixel size](../user-guide/usage/specifying-pixel-size.md) for details\). In this case, our data is 40um per pixel in x and y \(in the coronal plane\) and 50um in z \(the spacing of each plane\) |
| 29 | +* Which atlas you want to use \(you can see which are available by running `brainglobe list`. In this case, we want to use a mouse atlas \(as that's what our data is\), and we'll use the 50um version of the [Allen Mouse Brain Atlas](https://mouse.brain-map.org/static/atlas). |
| 30 | + |
| 31 | +{% hint style="warning" %} |
| 32 | +Normally the 50um mouse atlases are only used for testing \(the registration will work much quicker at lower resolution\). In this case, the test input data is very low resolution, so using a higher resolution atlas doesn't make much sense. |
| 33 | + |
| 34 | +When using your own data, you'll probably \(but not definitely\) find that higher resolution atlases work better. Make sure to test out the different resolutions to see what works best |
| 35 | +{% endhint %} |
| 36 | + |
| 37 | +To run brainreg, we put this all together in a single command: |
| 38 | + |
| 39 | +```text |
| 40 | +brainreg test_brain brainreg_output -x 40 -y 40 -z 50 --atlas allen_mouse_50um |
| 41 | +``` |
| 42 | + |
| 43 | +Lots of stuff will get printed to the console as brainreg runs, and when it's done \(it should only take a minute or so\), you will see something like: |
| 44 | + |
| 45 | +```text |
| 46 | +INFO - MainProcess cli.py:230 - Finished. Total time taken: 0:00:29.15 |
| 47 | +``` |
| 48 | + |
| 49 | +This means that the registration is complete. |
| 50 | + |
| 51 | +#### Visualising the results |
| 52 | + |
| 53 | +brainreg comes with a plugin for napari \(see [Visualisation](visualisation.md)\) for easy visualisation of the results. |
| 54 | + |
| 55 | +To view your data, run `napari` from the same terminal/command as you ran brianreg \(or open a new one and activate your conda environment\). You can then drag and drop the `brainreg_output` directory into napari, and see the results: |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +{% hint style="info" %} |
| 60 | +The results are likely not perfect because \(for speed and simplicity\) we: |
| 61 | + |
| 62 | +* Used very low resolution data |
| 63 | +* Used a low resolution atlas |
| 64 | +* Left all the parameters as default \(which were optimised for higher resolution atlases\) |
| 65 | +{% endhint %} |
| 66 | + |
| 67 | + |
| 68 | + |
0 commit comments