You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
section: Tips and Tricks:Closing the editor window
7
7
---
8
8
9
-
10
9
Since version 8, TrackMate ships a new feature that allows editing object shape in 2D.
11
10
The spot editor is based on [Labkit](/plugins/labkit) components, and is made to simplify and accelerate the creation of tracking ground truth.
12
-
In this tutorial we will explain how to use it to modify segmentation results directly in TrackMate
13
-
14
-
## Preparing the tutorial data
15
-
16
-
Download [this image](/media/plugins/trackmate/spot-editor/Celegans-2D.tif) and open it in Fiji.
17
-
It is a movie of the early development of a _C. elegans_ embryo, projected in 2D, for which the nuclei have been stained in fluorescence.
18
-
We will generate an incorrect segmentation of these nuclei in TrackMate, and fix it with the spot editor.
19
-
20
-
In Fiji, with the image open, launch TrackMate ({% include bc path="Plugins|Tracking|TrackMate"%}).
21
-
Click the _Next_ button and select the _Thresholding detector_.
22
-
In its configuration page, put a threshold of 1000 and click _Next_.
23
-
24
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-02.png" align="center" width="300px" %}
25
-
26
-
Click the _Next_ button until you are in the tracker selection page and select the _LAP tracker_.
27
-
In its configuration page,
28
-
- put 5 µm as max linking distance,
29
-
- uncheck the _Track segment gap closing_ button,
30
-
- check the _Track segment splitting_ button and put a _max distance_ of 5 µm,
31
-
- uncheck everything else.
32
-
33
-
You should get the following:
11
+
In this page we explain how to use it to modify segmentation results directly in TrackMate.
34
12
35
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-03.png" align="center" width="300px" %}
13
+
## The editor
36
14
37
-
## Launching the spot editor
38
-
39
-
The threshold we set is too stringent, and many nuclei are improperly segmented, and some polar bodies are missing.
40
-
For instance, in frame 2 the top-left nucleus looks like this:
41
-
42
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-05.png" align="center" width="300px" %}
43
-
44
-
We will use the spot editor to correct some of the mistakes there.
45
15
The spot editor can be launched from the _Display options_ panel of TrackMate:
46
16
47
17
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-04.png" align="center" %}
48
18
49
-
Move to frame 2 and click the `Launch spot editor button`.
50
-
The user interface of TrackMate is frozen and a new window appear:
19
+
This button is visible only for 2D images.
20
+
When clicking on this button, the user interface of TrackMate is frozen and a new window appear:
51
21
52
22
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-06.png" align="center" %}
53
23
54
-
The large bottom right panel displays the image overlaid with the spots.
55
-
Notice that the spots have been converted to masks, and that they have the same color that in the TrackMate UI.
24
+
The editor is made of several UI components:
25
+
- The main editor panel, where the image is painted along with the spot masks (center).
26
+
- The side panel (left) that contains from top to bottom:
27
+
- the 'Close and sen' button, that finishes editing and returns to TrackMate;
28
+
- the image visibility tool (with the eye button), that let you hide / unhide the image, perform auto contrast, and open the display settings panel (will appear on the right);
29
+
- the spot label list, listing all spots currently in the editor, and a global visibility button (the eye).
30
+
- The toolbar (top).
56
31
57
-
The top bar is made of widgets that change the brush mode (navigate, add, remove, fill, ...) and the brush size.
58
-
We will describe them below.
32
+
The toolbar shows the six editing tool we use to annotate an image:
59
33
60
-
The left side bar contains (from top to bottom)
61
-
- the button to end editing,
62
-
- auto-contrast and display config panel for the spot editor,
63
-
- the list of labels currently in the editor, initially there is one label per spot,
64
-
- a button to create a new label, possibly for a new spot.
34
+
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-six-tools-annotation-bis.png" align="center" %}
65
35
66
36
## Navigating in the editor
67
37
68
38
The editor window is actually a [BDV component](/plugins/bdv/index).
69
39
If you know your way around BDV you will get your bearings quickly.
70
-
Otherwise here is how to navigate in the image panel.
40
+
Otherwise, here is how to navigate in the image panel.
71
41
72
42
### Panning, rotating and zooming
73
43
@@ -87,6 +57,8 @@ Otherwise here is how to navigate in the image panel.
87
57
### Navigating to spots
88
58
89
59
On the left side bar, you can see the list of labels currently in the editor.
60
+
Each label initially corresponds to a spot in TrackMate.
61
+
The label will have the same name and color that of the current view in TrackMate.
90
62
Shift-clicking on a label in the list will center the image view on the corresponding spot mask
91
63
92
64
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-09.gif" align="center" %}
@@ -101,57 +73,142 @@ The _settings_ button will open a dialog to change the display settings of the i
101
73
102
74
## Editing spots
103
75
104
-
Let's fix the top left nucleus in frame 2.
105
-
Center and zoom in on it, so that it fills the panel.
106
-
We see that there are two spurious detections on the side, of 1-pixel size, and that the largest spot is not large enough to cover the nucleus.
107
-
Let's first remove the spurious detections.
76
+
Editing spots is made by painting labels in the editor.
77
+
When you modify a label, the modifications will be reimported into TrackMate when you close the editor.
78
+
In TrackMate, 2D spots are polygons, but we found out that painting inside the input image then converting to spots was fast and convenient, particularly with a tablet.
79
+
80
+
### For editing, TrackMate spots are written into labels
81
+
82
+
The editor will display the spots as a 'labeling', a colored image where the pixels inside each spot is painted with a specific label.
83
+
All the labels corresponding to the spots in the image are listed on the left side bar.
84
+
The are created with the same color and name that of the spot they correspond to.
85
+
86
+
So it is possible that two different spots will lead to two different labels in the editor, but with the same color, which will make them indisinguishable.
87
+
If this is the case we recommend changing the spot coloring before launching the editor.
88
+
For instance, selecting the _Random color_ mode.
89
+
90
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-RandomColoring.png" align="center" width="300" %}
91
+
92
+
Modifying a spot is adding a removing pixels from its shape.
93
+
There is a gotcha however: When you finish editing the actual label of a spot does not matter anymore.
94
+
For instance, if you paint a new spot with an existing label, so that the new spot is disconnected from the initial spot or even on another time-point, the new spot will be created as a separated one in TrackMate.
95
+
The fact that the initial spot and the new one have the same label plays no role if they are not touching.
96
+
97
+
### The six editing tools
98
+
99
+
When you select one of the tool by cliking on its icon or with F1 - F6, the right part of the toolbar changes to show the tool controls.
100
+
101
+
### The pan / move tool - {% include key key="F1" %}
102
+
103
+
See above.
104
+
When this tool is selected, the mouse is used to navigate in the image.
105
+
106
+
### Painting labels - {% include key key="F2" %}
107
+
108
+
When the paint tool is selected, left clicking in the image will paint the label currently selected in the image, as if you had a brush.
109
+
You can select a label in the side bar, or create a new label to create a new spot.
110
+
The select label tool described below is used to select a label at a given pixel.
111
+
112
+
You can change the diameter of the brush with the slider that appears right of the toolbar.
113
+
The default key shortcuts to do so are {% include key key="Q" %} / {% include key key="E" %} and {% include key key="Shift|Q" %} / {% include key key="Shift|E" %}
114
+
115
+
The rightmost list allows changing the paint mode.
116
+
There are three of them: _Replace, Add, Preserve_.
117
+
The selected modes and brush size are remembered between use of the editor.
118
+
119
+
#### Paint replace
120
+
121
+
This is the default mode.
122
+
If you paint over an existing label, it is discarded.
108
123
109
-
### Deleting pixels
124
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-Paint-Replace.gif" align="center" %}
110
125
111
-
The fourth button on the top bar is the _Delete_ button.
112
-
Click it to make the delete brush mode active.
113
-
But if you click on the spurious detections, nothing happens.
114
-
This is because the **delete brush only works on the pixels of the label that is currently selected in the left side bar**.
115
-
You need to select the label you want to edit first.
116
-
To do so, you can either
117
-
- {% include key key="Shift|left click" %} on the spot mask in the image panel,
118
-
- click on the _Select_ button on the top toolbar (the sixth button on the left) then click on the spot in the image,
119
-
- or select the label in the left side bar.
126
+
#### Paint add
120
127
121
-
{% include notice icon="note"
122
-
content="*Shift-click* in the image selects the spot at the cursor position." %}
128
+
In TrackMate the spots can be overlapping, and as a consequence, in the editor you can have several labels on one pixel.
129
+
This is the way to edit overlapping spots.
130
+
The _Add_ mode paint labels, and if there is an existing label, it will add the selected one, and not remove the existing one:
123
131
124
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-11.gif" align="center" %}
132
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-Paint-AddMode.gif" align="center" %}
125
133
126
-
Shift-click on each of the spurious detections to select them, and then click on them with the _delete_ brush on to remove them.
127
-
Notice that the corresponding labels in the left side bar are not removed, which is normal.
134
+
This will lead to overlapping spots, as demonstrated in the animation above.
128
135
129
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-12.gif" align="center" %}
136
+
#### Paint preserve
130
137
131
-
### Painting spots
138
+
This mode is the converse of the 'Replace' mode.
139
+
The selected label will be applied only on the pixels that have no label already.
140
+
It will only paint on the background.
141
+
This is useful if you have close objects that you know are not overlapping.
132
142
133
-
We now want to enlarge the largest spot to cover the nucleus.
134
-
First shift-click on it in the image panel to make the spot label active.
135
-
Then click on the _Add_ button in the top bar which is the second button from the left.
136
-
Edit the brush size to about 5 pixels, and paint over the nucleus.
143
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-Paint-PreserveMode.gif" align="center" %}
137
144
138
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-13.gif" align="center" %}
139
145
140
-
### Removing entire spots
146
+
### Deleting pixels - {% include key key="F3" %}
141
147
142
-
You can also remove entire spots from the editor using the _Remove_ mode, which is the third button from the left in the top bar.
143
-
Again, the corresponding label of the spot to remove must be selected in the left side bar.
144
-
Click on the _Remove_ button, select the label in the left side bar and click on the spot you want to remove.
148
+
The delete tool also has several modes, that are made to harness possibly overlapping labels.
145
149
146
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-14.gif" align="center" %}
150
+
#### Delete all labels
147
151
148
-
### Filling holes
152
+
This mode simply remove all labels at once.
153
+
You get the background where you paint.
149
154
150
-
Another way of creating spots is to paint the border and fill the inside.
151
-
After drawing the contour of the nucleus, you can use the _Fill_ button, which is the third button from the left in the top bar.
152
-
Click it, and click inside the contour to fill it.
155
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-Delete-AllLabels.gif" align="center" %}
156
+
157
+
#### Delete selected label
158
+
159
+
With this mode, the brush will only remove the label currently selected, and no touch the others:
160
+
161
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-Delete-SelectedLabel.gif" align="center" %}
162
+
163
+
164
+
### Flood fill - {% include key key="F4" %}
165
+
166
+
This tool allows for painting over a 'segment' of the labeling.
167
+
That is: any connected portion of the labels that have the same labels underneath.
168
+
It is most useful to replace a label or add one.
169
+
There is also two modes for this tool.
170
+
171
+
#### Flood fill replace
172
+
173
+
Similar to the _Paint add_ tool, this leads to replace all the label of a segment with the selected label.
174
+
On the animation below, the red part of the labeling is overwritten with the blue label, leading to a larger spot:
175
+
176
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-FloodFill-Replace.gif" align="center" %}
177
+
178
+
#### Flood fill add
179
+
180
+
This _adds_ a label to a segment that might already have one.
181
+
On the animation below, the red label is added to the blue segment.
182
+
This segment has now two labels, the blue and the red, and it appers in magenta in the editor.
183
+
After returning to TrackMate, this leads to two spots overlapping:
184
+
185
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-FloodFill-Add.gif" align="center" %}
186
+
187
+
### Flood erase - {% include key key="F5" %}
188
+
189
+
This tool removes one or all labels of a segment.
190
+
191
+
#### Flood erase remove all
192
+
193
+
All the labels are removed from the segment.
194
+
The modified pixels are now part of the background.
195
+
196
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-FloodErase-RemoveAll.gif" align="center" %}
197
+
198
+
#### Flood erase selected label
199
+
200
+
Only the currently selected label is removed.
201
+
For instance, on the animation below, the top segment has two labels, red and blue, and appears in magenta.
202
+
The flood erase tool is used to remove the blue label from it, which leaves the red label.
203
+
204
+
{% include img src="/media/plugins/trackmate/spot-editor/TrackMate-Editor-FloodErase-SelectedLabel.gif" align="center" %}
205
+
206
+
207
+
### Select label - {% include key key="F6" %}
208
+
209
+
Click on any pixel to select its associated label.
210
+
If the pixel contains multiple labels, click repeatedly to cycle through them.
153
211
154
-
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-15.gif" align="center" %}
155
212
156
213
### Keyboard shortcuts changing the brush mode and size
157
214
@@ -219,8 +276,7 @@ This respects whether you have a ROI in the image or not.
219
276
220
277
In TrackMate, spots are represented as polygons, as as such they can overlap.
221
278
This is also the case in the spot editor.
222
-
This is the reason why it is necessary to select the spot you want to edit before using the brush.
223
-
279
+
See the _Paint add_ mode above for instance.
224
280
{% include img src="/media/plugins/trackmate/spot-editor/trackmate-spot-editor-tuto-22.gif" align="center" %}
225
281
226
282
### Several spots can have the same label
@@ -251,4 +307,4 @@ Has the same effect as clicking the _Close and send to TrackMate_ button.
0 commit comments