Skip to content

Commit cda0af5

Browse files
committed
Merge branch 'master' into develop
2 parents 6c77d39 + ed73643 commit cda0af5

File tree

3 files changed

+216
-287
lines changed

3 files changed

+216
-287
lines changed

atlaselectrophysiology/README.md

Lines changed: 1 addition & 178 deletions
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,5 @@
11
# Ephys Atlas GUI
22

3-
GUI to allow user to align electrophysiology data with histology data
3+
GUI to allow user to align electrophysiology data with histology data. Please refer to this wiki page for information on installation and usage https://github.com/int-brain-lab/iblapps/wiki
44

5-
## Setup
65

7-
Install the iblenv environment using the following instructions:
8-
https://github.com/int-brain-lab/iblenv
9-
10-
If you have previously installed the environment, an additional package that is required is SimpleITK. This can be
11-
installed in the environment using,
12-
13-
```
14-
conda activate iblenv
15-
pip install SimpleITK
16-
```
17-
18-
To launch the GUI run the following commands from a terminal
19-
```
20-
conda activate iblenv
21-
python <path to ephys_atlas_gui.py>
22-
```
23-
e.g
24-
```
25-
python int-brain-lab\iblapps\atlaselectrophysiology\ephys_atlas_gui.py
26-
```
27-
28-
## Usage
29-
### Getting Data
30-
Upon launching, the GUI automatically finds subjects that have probe tracks traced. To select a subject
31-
click on the subject drop down list (see figure below). A list of sessions for the chosen subject and
32-
previous alignments associated with each session will then be loaded in the second and third drop down menus respectively.
33-
If this is the first time an alignment is being conducted for a session the only alignment option will be 'original'. If,
34-
however, the session has been previously aligned, it is possible to initiate the GUI from the previous alignment. Once the
35-
drop down options have been chosen, click on the **Get Data** button to download the data. The gui will automatically
36-
download all data necessary
37-
38-
In the case that some data is not available on FlatIron, plots associated with this data will not be displayed and a
39-
warning message is printed in the terminal.
40-
41-
If you find that the histology image is not being found, please refer to the [histology image troubleshooting](#Histology-Image-Troubleshooting) section
42-
43-
44-
### Layout
45-
The GUI comprises four main figure areas.
46-
47-
![ephys_gui](ephys_atlas_image.png)
48-
49-
#### Figure 1 - Ephys Figure
50-
The first figure contains three panels which display electrophysiology data in the form of:
51-
52-
* Image Plots (2D representation of data in image or scatter plots)
53-
* Line Plots (1D representation of data in a line plot)
54-
* Probe Plots (2D representation of data as a heatmap overlaid on the Neuropixel 3B geometry)
55-
56-
Different types of data can be viewed in each of the panels and the available options can be seen by clicking on the **Image Plots**,
57-
**Line Plots** and **Probe Plots** menu bar. The display in each panel can be changed by clicking through the options in each menu bar or
58-
by using the shortcut Alt+ 1, Alt + 2, Alt + 3, for the image, line and probe plots respectively.
59-
60-
The order of the panels can also be rearranged by changing the view (under the **Display Options** menu bar) or by
61-
pressing, Shift + 1, Shift + 2 or Shift + 3.
62-
63-
#### Figure 2 - Histology Figure
64-
The second figure displays the brain regions through which the traced probe track passes (the trajectory). It is split into
65-
three panels, which display, from left to right,
66-
* Scaled brain regions
67-
* Scale factor applied to brain regions - represented as heatmap
68-
* Original (unscaled) brain regions - for reference
69-
70-
The black dotted lines on the left and right panels indicated the location along the trajectory of the first and last
71-
electrode. The labels overlaid on the brain regions can be toggled on and off using Shift + L
72-
73-
The actual scale factor value is displayed in the title of the colorbar (top of figure) when hovering over a region on
74-
the scale factor plot.
75-
76-
#### Figure 3 - Slice Figure
77-
The third figure displays a tilted slice through the brain. The tilt of the slice displayed is determined by the line
78-
of best fit through the traced points. Overlaid on the slice is a black line linking the traced points (the trajectory)
79-
and the location of the electrodes on the Neuropixel probe along this trajectory (red points). When reference lines are added
80-
to the Ephys and Histology figures, they are displayed as black dotted lines perpendicular to the local trajectory.
81-
The collection of lines and points overlaid on the slice figure can be toggled on and off using Shift + C.
82-
83-
There are three options for the tilted slice displayed (changed using Alt+ 4):
84-
* Slice taken from red channel of histology image
85-
* Slice taken from allen brain atlas
86-
* Slice taken from allen brain atlas annotation
87-
88-
The intensity of the slice images can be changed using the intensity scale bar located on the right hand side of the figure.
89-
90-
#### Figure 4 - Fit Figure
91-
The fourth figure provides a 2D representation of the scaling applied along the depth of the trajectory. Coordinates
92-
are relative to the location of the most ventral electrode. Three lines are displayed in this figure
93-
* Reference line (black dotted line) - reference for when no fit/scaling is applied
94-
* Fit line (blue solid line) - piecewise fit along depth of trajectory
95-
* Linear fit line (red dotted line) - linear fit along depth of trajectory (only present when two or more reference lines
96-
are implemented)
97-
98-
### Alignment
99-
Reference line pairs are used to align features on the Ephys and Histology figures. A pair can be added to the GUI by
100-
double clicking at any point on either the Ephys or Histology figure and the line on each figure moves independently.
101-
Once the two lines of a reference pair line have been moved to the feature/landmark that needs to be aligned, the fit
102-
can be applied by pressing the **Fit** button or by pressing Enter key.
103-
104-
Different types of fit are applied depending on the number of reference lines implemented.
105-
106-
#### One reference line
107-
A fit applied with a single reference line pair will result in an offset.
108-
109-
Two other methods (independent of reference lines) for applying an offset are available
110-
* Drag the black dotted lines (indicate location of first and last electrode) on the left panel of the histology figure
111-
to the desired position and press the **Offset** button or the 'o' key
112-
* Pressing Shift + Up arrow or Shift + Down arrow will apply a +- 50 um offset
113-
114-
#### Two reference lines
115-
A fit applied with two reference line pairs will result in an offset and scaling of regions between the two reference line pairs.
116-
The remaining regions, located beyond the reference lines, will be offset, however, will remain unscaled.
117-
118-
#### Three or more reference lines
119-
A fit applied with three or more reference line pairs will result in an offset and piecewise scaling of regions between each
120-
of the reference lines. By default the remaining regions will be scaled according to a linear fit through all the reference lines
121-
(red dotted line in fit figure). If instead, one wants to keep the regions beyond the reference lines unscaled, the default can be
122-
turned off by un-ticking the linear fit checkbox located in the fit figure.
123-
124-
When a fit is applied the location of the electrodes on the slice figure will update.
125-
126-
A reference line can be deleted by hovering over the line and pressing Shift + D. N.B. Any fits anchored on a reference line will
127-
be lost once the line is deleted. The reference lines can be hidden/ redisplayed using Shift + H.
128-
129-
### Uploading data
130-
Once the alignment is complete, the new locations of the electrode locations can be uploaded to Alyx by pressing the **Upload**
131-
button or Shift + U.
132-
133-
Upon upload, a window will pop-up asking to determine 1) the confidence in alignment, 2) the QC (which will label the insertion), 3) the reason for that QC (e.g. Drift and Noise seen in the recording).
134-
<img width="294" alt="Capture d’écran 2021-03-19 à 11 04 04" src="https://user-images.githubusercontent.com/43007596/112831143-cdaa1480-9093-11eb-8fc2-12fd586e604b.png">
135-
136-
137-
### Additional Features
138-
#### Session Notes
139-
If any notes associated with a session have been uploaded to Alyx, these can be displayed as a popup by clicking on
140-
**Session Information** on the menu bar and selecting **Session Notes**
141-
142-
#### Region Information
143-
Information about brain regions that has been entered in Alyx can be displayed by hovering over a brain region in the
144-
histology figure and pressing Shift + I. This will bring up a popup with the brain regions organised according to the allen
145-
atlas structure tree.
146-
147-
#### Cluster Popup
148-
When displaying the cluster plots on the 2D image plats, the cluster autocorrelogram and template waveform can be viewed in
149-
a popup by clicking on a scatter point. It is possible to display many popups for different clusters. To collectively
150-
minimise/ show the cluster popup windows press Alt + M (make sure your cursor is located on the main gui window, not a popup window).
151-
To close the cluster popup windows press Alt + X
152-
153-
#### Filter Units
154-
By default, the plots in the Ephys figure are shown for all units that have been classified as 'Good' and 'Mua' following
155-
spike sorting. The **Filter Unit** option in the menu bar can be used to restrict the type of unit displayed.
156-
157-
#### Previous Fits
158-
A total of 10 previous fits are stored in memory. One can move to previous fits by using the **Previous** and **Next** buttons or by using
159-
the Left and Right arrow keys.
160-
161-
#### Reset
162-
To reset the GUI to the original state, i.e. no alignments, press the **Reset** button or Shift + R.
163-
164-
#### Rescaling
165-
It is possible to zoom in on some plots in the Ephys and Histology figures. To reset the axis press Shift + A.
166-
167-
## Histology Image Troubleshooting
168-
The naming convention used for subjects in the histology folder on FlatIron (http://ibl.flatironinstitute.org/histology/)
169-
is not always consistent with the subject names stored in Alyx. While the code attempts to account for differences in
170-
capitalisation or underscores, sometimes the naming in the histology is just too quirky. In these cases, it will be
171-
necessary to manually download the histology image required for the GUI.
172-
173-
The image file required is located in the *downsampledStacks_25/sample2ARA/* folder of the subject on FlatIron, and has
174-
the extension **.....RD.tif** file. This file should be downloaded and placed in a folder called *histology* in the
175-
associated subject folder on your local computer
176-
177-
e.g. Download **STD_dsIBL_WITTEN_13_200109_121739_25_25_RD.tif** from
178-
http://ibl.flatironinstitute.org/histology/wittenlab/IBL_Witten_13/downsampledStacks_25/sample2ARA/
179-
180-
and place this file in
181-
182-
C:\Users\Mayo\Downloads\FlatIron\wittenlab\Subjects\ibl_witten_13\histology

0 commit comments

Comments
 (0)