Skip to content

Commit 95511d2

Browse files
authored
Merge pull request #333 from trackmate-sc/editor-overlay
New editing modes for the TrackMate segmentation editor
2 parents 20a8621 + 814ca89 commit 95511d2

7 files changed

Lines changed: 605 additions & 169 deletions

File tree

pom.xml

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
35
<modelVersion>4.0.0</modelVersion>
46

57
<parent>
@@ -57,57 +59,87 @@
5759
<contributor>
5860
<name>Nick Perry</name>
5961
<url>https://imagej.net/people/nickp</url>
60-
<roles><role>founder</role></roles>
61-
<properties><id>nickp</id></properties>
62+
<roles>
63+
<role>founder</role>
64+
</roles>
65+
<properties>
66+
<id>nickp</id>
67+
</properties>
6268
</contributor>
6369
<contributor>
6470
<name>Johannes Schindelin</name>
6571
<url>https://imagej.net/people/dscho</url>
66-
<roles><role>founder</role></roles>
67-
<properties><id>dscho</id></properties>
72+
<roles>
73+
<role>founder</role>
74+
</roles>
75+
<properties>
76+
<id>dscho</id>
77+
</properties>
78+
</contributor>
79+
<contributor>
80+
<name>Gary Baker</name>
6881
</contributor>
69-
<contributor><name>Gary Baker</name></contributor>
7082
<contributor>
7183
<name>Albert Cardona</name>
7284
<url>https://imagej.net/people/acardona</url>
73-
<properties><id>acardona</id></properties>
85+
<properties>
86+
<id>acardona</id>
87+
</properties>
7488
</contributor>
7589
<contributor>
7690
<name>Barry DeZonia</name>
7791
<url>https://imagej.net/people/bdezonia</url>
78-
<properties><id>bdezonia</id></properties>
92+
<properties>
93+
<id>bdezonia</id>
94+
</properties>
7995
</contributor>
8096
<contributor>
8197
<name>Stefan Helfrich</name>
8298
<url>https://imagej.net/people/stelfrich</url>
83-
<properties><id>stelfrich</id></properties>
99+
<properties>
100+
<id>stelfrich</id>
101+
</properties>
84102
</contributor>
85103
<contributor>
86104
<name>Mark Hiner</name>
87105
<url>https://imagej.net/people/hinerm</url>
88-
<properties><id>hinerm</id></properties>
106+
<properties>
107+
<id>hinerm</id>
108+
</properties>
89109
</contributor>
90110
<contributor>
91111
<name>Hadrien Mary</name>
92112
<url>https://imagej.net/people/hadim</url>
93-
<properties><id>hadim</id></properties>
113+
<properties>
114+
<id>hadim</id>
115+
</properties>
94116
</contributor>
95117
<contributor>
96118
<name>Tobias Pietzsch</name>
97119
<url>https://imagej.net/peoplel/pietzsch</url>
98-
<properties><id>tpietzsch</id></properties>
120+
<properties>
121+
<id>tpietzsch</id>
122+
</properties>
123+
</contributor>
124+
<contributor>
125+
<name>Barak Naveh</name>
126+
</contributor>
127+
<contributor>
128+
<name>Chen Ye</name>
99129
</contributor>
100-
<contributor><name>Barak Naveh</name></contributor>
101-
<contributor><name>Chen Ye</name></contributor>
102130
<contributor>
103131
<name>Robert Haase</name>
104132
<url>https://imagej.net/people/haesleinhuepf</url>
105-
<properties><id>haesleinhuepf</id></properties>
133+
<properties>
134+
<id>haesleinhuepf</id>
135+
</properties>
106136
</contributor>
107137
<contributor>
108138
<name>Jan Eglinger</name>
109139
<url>https://imagej.net/people/imagejan</url>
110-
<properties><id>imagejan</id></properties>
140+
<properties>
141+
<id>imagejan</id>
142+
</properties>
111143
</contributor>
112144
</contributors>
113145

@@ -142,14 +174,23 @@
142174
<!-- NB: Deploy releases to the SciJava Maven repository. -->
143175
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
144176

145-
<!-- NB: Use ImgLib2 style code formatting (https://github.com/scijava/scijava-coding-style) -->
177+
<!-- NB: Use ImgLib2 style code formatting
178+
(https://github.com/scijava/scijava-coding-style) -->
146179
<scijava.coding-style>imglib2</scijava.coding-style>
147180

148181
<fontchooser.version>2.5.2</fontchooser.version>
149182
<javaGeom.version>0.11.1</javaGeom.version>
183+
<imglib2.version>8.0.0</imglib2.version>
184+
<bigdataviewer-core.version>10.6.7</bigdataviewer-core.version>
150185
</properties>
151186

152187
<dependencies>
188+
189+
<dependency>
190+
<groupId>org.slf4j</groupId>
191+
<artifactId>slf4j-simple</artifactId>
192+
</dependency>
193+
153194
<!-- Fiji dependencies -->
154195
<dependency>
155196
<groupId>sc.fiji</groupId>
@@ -171,6 +212,10 @@
171212
</dependency>
172213

173214
<!-- ImgLib2 dependencies -->
215+
<dependency>
216+
<groupId>sc.fiji</groupId>
217+
<artifactId>bigdataviewer-core</artifactId>
218+
</dependency>
174219
<dependency>
175220
<groupId>net.imglib2</groupId>
176221
<artifactId>imglib2</artifactId>

src/main/java/fiji/plugin/trackmate/gui/editor/LabkitLauncher.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* it under the terms of the GNU General Public License as
99
* published by the Free Software Foundation, either version 3 of the
1010
* License, or (at your option) any later version.
11-
*
11+
*
1212
* This program is distributed in the hope that it will be useful,
1313
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1414
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1515
* GNU General Public License for more details.
16-
*
16+
*
1717
* You should have received a copy of the GNU General Public
1818
* License along with this program. If not, see
1919
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -37,6 +37,7 @@
3737
import org.scijava.ui.behaviour.util.AbstractNamedAction;
3838

3939
import fiji.plugin.trackmate.Model;
40+
import fiji.plugin.trackmate.SelectionModel;
4041
import fiji.plugin.trackmate.Settings;
4142
import fiji.plugin.trackmate.TrackMate;
4243
import fiji.plugin.trackmate.detection.DetectionUtils;
@@ -48,7 +49,9 @@
4849
import fiji.plugin.trackmate.io.TmXmlReader;
4950
import fiji.plugin.trackmate.util.EverythingDisablerAndReenabler;
5051
import fiji.plugin.trackmate.util.TMUtils;
52+
import fiji.plugin.trackmate.visualization.TrackMateModelView;
5153
import fiji.plugin.trackmate.visualization.ViewUtils;
54+
import fiji.plugin.trackmate.visualization.hyperstack.HyperStackDisplayer;
5255
import ij.ImagePlus;
5356
import net.imagej.axis.Axes;
5457
import net.imagej.axis.CalibratedAxis;
@@ -207,7 +210,8 @@ public void run()
207210

208211
public static void main( final String[] args )
209212
{
210-
final String filename = "samples/MAX_Merged.xml";
213+
// final String filename = "samples/MAX_Merged.xml";
214+
final String filename = "samples/221031_Stat_Stage55_561nm_part1Conf_crop_f4.xml";
211215
final TmXmlReader reader = new TmXmlReader( new File( filename ) );
212216
if ( !reader.isReadingOk() )
213217
{
@@ -220,7 +224,14 @@ public static void main( final String[] args )
220224
final Settings settings = reader.readSettings( imp );
221225
final DisplaySettings ds = reader.getDisplaySettings();
222226
final TrackMate trackmate = new TrackMate( model, settings );
227+
final SelectionModel selectionModel = new SelectionModel( model );
223228

224-
LabkitLauncher.launch( trackmate, ds, 0 );
229+
// Main view.
230+
final TrackMateModelView displayer = new HyperStackDisplayer( model, selectionModel, settings.imp, ds );
231+
displayer.render();
232+
imp.setSlice( 7 );
233+
234+
// Editor
235+
LabkitLauncher.launch( trackmate, ds, 6 );
225236
}
226237
}

src/main/java/fiji/plugin/trackmate/gui/editor/labkit/component/TMBasicLabelingComponent.java

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* it under the terms of the GNU General Public License as
99
* published by the Free Software Foundation, either version 3 of the
1010
* License, or (at your option) any later version.
11-
*
11+
*
1212
* This program is distributed in the hope that it will be useful,
1313
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1414
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1515
* GNU General Public License for more details.
16-
*
16+
*
1717
* You should have received a copy of the GNU General Public
1818
* License along with this program. If not, see
1919
* <http://www.gnu.org/licenses/gpl-3.0.html>.
@@ -26,7 +26,6 @@
2626

2727
import java.awt.Adjustable;
2828
import java.awt.BorderLayout;
29-
import java.awt.Component;
3029
import java.awt.Window;
3130
import java.awt.event.ActionEvent;
3231
import java.awt.event.WindowAdapter;
@@ -57,10 +56,11 @@
5756
import bdv.viewer.NavigationActions;
5857
import bdv.viewer.ViewerPanel;
5958
import fiji.plugin.trackmate.detection.DetectionUtils;
59+
import fiji.plugin.trackmate.gui.editor.labkit.component.TMFloodFillController.FloodEraseMode;
60+
import fiji.plugin.trackmate.gui.editor.labkit.component.TMFloodFillController.FloodFillMode;
6061
import net.miginfocom.swing.MigLayout;
6162
import sc.fiji.labkit.ui.bdv.BdvAutoContrast;
6263
import sc.fiji.labkit.ui.bdv.BdvLayer;
63-
import sc.fiji.labkit.ui.brush.PlanarModeController;
6464
import sc.fiji.labkit.ui.labeling.Label;
6565
import sc.fiji.labkit.ui.labeling.LabelsLayer;
6666
import sc.fiji.labkit.ui.models.Holder;
@@ -187,28 +187,19 @@ private void initLabelsLayer()
187187

188188
private JPanel initToolsPanel()
189189
{
190-
final PlanarModeController planarModeController = new PlanarModeController( bdvHandle, model, zSlider );
191190
this.brushController = new TMLabelBrushController( bdvHandle, model );
192191
this.floodFillController = new TMFloodFillController( bdvHandle, model );
193192
this.selectLabelController = new TMSelectLabelController( bdvHandle, model );
194193

195-
this.toolsPanel = new TMLabelToolsPanel( brushController, floodFillController, selectLabelController, planarModeController );
194+
this.toolsPanel = new TMLabelToolsPanel( brushController, floodFillController, selectLabelController );
196195
// Hide the zSlider toggle button if we are 2D
197196
final boolean is2D = DetectionUtils.is2D( model.imageForSegmentation().get() );
198197
if ( is2D )
199-
{
200198
zSlider.setVisible( false );
201-
final Component c = toolsPanel.getComponent( toolsPanel.getComponentCount() - 1 );
202-
toolsPanel.remove( c );
203-
}
204199

205-
// To edit TrackMate spots, the overlapping mode is always enabled.
206-
floodFillController.setOverlapping( true );
207-
brushController.setOverlapping( true );
208-
// Remove the checkbox from the option panel
209-
final JPanel c = ( JPanel ) toolsPanel.getComponent( toolsPanel.getComponentCount() - 1 );
210-
// The overlapping mode toggle button
211-
c.remove( c.getComponent( 0 ) );
200+
// To edit TrackMate spots, fill and erase replace existing labels.
201+
floodFillController.setFloodEraseMode( FloodEraseMode.REMOVE_ALL );
202+
floodFillController.setFloodFillMode( FloodFillMode.REPLACE );
212203

213204
return toolsPanel;
214205
}

0 commit comments

Comments
 (0)