Skip to content

Draft PR that targets the work done towards TrackMate v9 #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 216 commits into
base: v8-new
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
780c8d2
Add ImageJ-Mesh and ImageJ-Mesh-IO as dependencies.
tinevez Apr 13, 2023
00a1f66
WIP: make objects that TrackMate can handle out of 3D masks.
tinevez Apr 13, 2023
001b705
WIP: Iterative intersection with a plane.
tinevez Apr 14, 2023
23e4742
Unother attempt, using an edge and a face map.
tinevez Apr 14, 2023
2dbb6db
We actually don't need the vertex list. The edge list is sufficient.
tinevez Apr 14, 2023
75621db
Temporary couple to SNAPSHOT version of the mesh library.
tinevez Apr 16, 2023
0467ad7
Rework the demo of mesh intersection.
tinevez Apr 16, 2023
030fa56
A simple data structure to store a 3D mesh in a Spot object.
tinevez Apr 17, 2023
fd59285
Spot objects may have a SpotMesh.
tinevez Apr 17, 2023
12056e0
Utility method for SpotRoi: generate XY coordinates
tinevez Apr 17, 2023
f3973a9
MaskUtils have method to create spots with meshes for 3D masks and la…
tinevez Apr 17, 2023
253f4fa
Mask, label and threshold detectors support creating 3D meshes for th…
tinevez Apr 17, 2023
40da4d4
Paint 3D meshes in the HyperStackViewer.
tinevez Apr 17, 2023
2242010
Outdated interactive tests.
tinevez Apr 17, 2023
8004c62
Fix javadoc.
tinevez Apr 17, 2023
318c6b5
Temporary store meshes in absolute physical coordinates.
tinevez Apr 17, 2023
d2832fc
Moller-Trumbore algorithm for the intersection of a ray with a triangle.
tinevez Apr 18, 2023
8f8ddf4
Non working version of a pixel iterator.
tinevez Apr 18, 2023
de5fd85
Utility to export meshes to STL for debugging.
tinevez Apr 18, 2023
e817cdc
Make some debugging utilities package visible.
tinevez Apr 18, 2023
8159c7e
Utility to sort Trove arrays.
tinevez Apr 19, 2023
68fa1a3
Demo simple mesh.
tinevez Apr 19, 2023
0137c38
Fix back to master branch in the imagej-mesh.
tinevez Apr 19, 2023
15b4aeb
Update the demo with Toby + JY ideas.
tinevez Apr 19, 2023
1013191
Yeaaahh! Working version of a pixel iterator.
tinevez Apr 19, 2023
12865a4
Move mesh utility classes to a dedicated package.
tinevez Apr 20, 2023
2076d76
An imglib2 cursor that iterates over the pixels inside a mesh.
tinevez Apr 20, 2023
d3ebde2
Update the interactive demo.
tinevez Apr 20, 2023
aa80c44
Expose mesh volume and radius routines.
tinevez Apr 20, 2023
3c82df6
Implement quality measurement on the 3D object.
tinevez Apr 20, 2023
403d974
Common SpotShape interface for the 2D and 3D different shape objects.
tinevez Apr 20, 2023
8eb861b
Iterable for a spot mesh.
tinevez Apr 20, 2023
369a707
Add methods to SpotUtil to return suitable iterables in 2D and 3D.
tinevez Apr 20, 2023
6f3b274
Generalize contrast and SNR feature analyzer to 3D with mesh.
tinevez Apr 20, 2023
6672aa1
Add a TODO for ellipse fit feature.
tinevez Apr 20, 2023
f4098f9
Temporary couple to imagej-mesh-io 0.1.3-SNAPSHOT.
tinevez Apr 21, 2023
6ab9362
Serialization and deserialization of spot meshes to file.
tinevez Apr 21, 2023
d517566
Read all spot meshes in one pass.
tinevez Apr 21, 2023
ab5b2ed
Recompute face normals after loading mesh.
tinevez Apr 21, 2023
5d45038
More utility methods to sort Trove arrays.
tinevez Apr 22, 2023
6e5997f
WIP: Rework the Z-slicing of meshes.
tinevez Apr 22, 2023
47f43fd
Tweak interactive tests.
tinevez Apr 22, 2023
7c2f9f0
Trying to work with the in-development mesh Z-slicer
tinevez Apr 27, 2023
37771bf
When possible use the mearching cube on grayscale to generate meshes.
tinevez Apr 27, 2023
e83d8bf
Utility mother class to paint things.
tinevez Apr 27, 2023
2415b76
Rework painting meshes a bit.
tinevez Apr 27, 2023
dc800f5
Update interactive tests.
tinevez Apr 27, 2023
656318b
Fix skipping painting of meshes if out of window.
tinevez Apr 27, 2023
4fa2d5d
Do not include meshes smaller than 10 pixels.
tinevez Apr 28, 2023
2d7dd0f
Tweak painting of meshes.
tinevez Apr 28, 2023
163aaff
Update interactive tests.
tinevez Apr 28, 2023
b2d7b10
Update mesh painter to the new ZSlicer.
tinevez Apr 29, 2023
97d2590
Update interactive tests.
tinevez Apr 29, 2023
3559707
Rework spot mesh iteration.
tinevez May 2, 2023
f17e7d6
Remove unused classes.
tinevez May 2, 2023
6b32a17
Update mesh demos.
tinevez May 2, 2023
54adac9
Meshes are stored centered at (0,0,0)
tinevez May 2, 2023
1db8ee8
Create a proper mask from the input before using the mask detector.
tinevez May 2, 2023
071e52d
Unify and use the TrackMatePainter hierarchy.
tinevez May 2, 2023
8eda123
Mesh slices can be painted filled.
tinevez May 3, 2023
302e185
Code style changes.
tinevez May 3, 2023
b5fb784
Precompute and store a cache of Z-slices for meshes.
tinevez May 4, 2023
6c82e96
Rework a bit the painting of spots.
tinevez May 4, 2023
153d20b
Can manually scale meshes in size.
tinevez May 4, 2023
e5c3c32
Use ImgLib2 Cast util to wrap an ImagePlus in an ImgPlus.
tinevez May 4, 2023
5f33d99
Fix mistake with mesh cursor.
tinevez May 4, 2023
18f33a4
Paint not-filled mesh with polygons, not shapes.
tinevez May 4, 2023
f73a125
Forgot to commit SpotMesh changes, storing its center.
tinevez May 4, 2023
a1113d9
Support making single spots with possibly hollow meshes.
tinevez May 4, 2023
bdc6647
Demo of the hollow mesh support in TrackMate.
tinevez May 4, 2023
d9a7902
Update demo.
tinevez May 4, 2023
2426759
Refactor a bit the MaskUtil class, which is becoming too long.
tinevez May 5, 2023
3d517a5
Recompute the Z-slices when changing the radius.
tinevez May 5, 2023
c78f358
Rename 2D morphology analyzers.
tinevez May 5, 2023
a94e548
Add flag for detectors that can return 3D shape,
tinevez May 5, 2023
49eb3c4
Add ops as a dependency.
tinevez May 5, 2023
e90b6d0
Add VOLUME as a dimension.
tinevez May 5, 2023
f0d4b91
Add basic 3D shape analyzers.
tinevez May 5, 2023
10a4e1b
Remove unused class.
tinevez May 6, 2023
b7a46f5
WIP: Ellipsoid fitter.
tinevez May 6, 2023
f0a5683
toString method for the ellipsoid fit.
tinevez May 7, 2023
13fd7ab
JUnit test for the ellipsoid fitter.
tinevez May 7, 2023
b6aad7f
Javadoc for the EllipsoidFitter
tinevez May 7, 2023
52508d2
Shape measurement via ellipsoid fit for 3D mesh.
tinevez May 7, 2023
63f5fb5
Spot is now an interface, with 3 derived class.
tinevez May 8, 2023
0cd3bd5
Fix some javadoc errors.
tinevez May 8, 2023
ed2a378
Implement RealInterval methods in SpotRoi and SpotMesh.
tinevez May 8, 2023
155a03e
Remove unused interfaces.
tinevez May 8, 2023
e419e09
Fix spot meshes not abiding to ROI origin.
tinevez May 11, 2023
da0ac40
Abide to Z ROI settings in the preview.
tinevez May 11, 2023
c88d205
Rework the SpotRoi class.
tinevez May 12, 2023
80dc86f
After tracking, set spot color by track index, if spot coloring is de…
tinevez May 12, 2023
a6a7052
Rework the SpotMesh class.
tinevez May 12, 2023
e95a5e1
WIP: An action to export all the meshes in a model to a PLY file series.
tinevez May 12, 2023
6a19754
Fix loading of SpotMeshes.
tinevez May 13, 2023
194d684
Properly read 3d morphology analyzers declarations.
tinevez May 13, 2023
44a0757
Put back default coloring after clearing tracks in the UI if needed.
tinevez May 13, 2023
a16e924
Fix meshh series exporter.
tinevez May 13, 2023
befc61e
Make a utility method public.
tinevez May 13, 2023
efeb82f
Rework the 2D and 3D detection utils.
tinevez May 13, 2023
05faa5e
Don't crash the MeshSeriesExporter if the image name is weird.
tinevez May 15, 2023
26b9a4b
Add ui-behaviour as a dependency.
tinevez May 9, 2023
db419fc
Two new icons.
tinevez May 9, 2023
99679c0
FeatureTable, taken from mastodon, to display a list of togglable items.
tinevez May 9, 2023
c0bd31f
A UI tool to build a selection of feature analyzers and save it to disk.
tinevez May 9, 2023
351cec0
Use proper methods in the analyzer selection class.
tinevez May 10, 2023
61bb815
Use the user feature analyzers selection when using the plugin.
tinevez May 10, 2023
b16035c
Make the feature analyzer selector a IJ2 command.
tinevez May 10, 2023
d42805d
Also abides to user spot analyser selection after detection step.
tinevez May 10, 2023
8a22ca9
Minor tweak of javadoc and error reporting.
tinevez May 18, 2023
58a4bf0
Convenience class to run 2D+Z segmentation algos in 3D.
tinevez May 18, 2023
a6f3f15
Fix bug in analyzer selection.
tinevez Sep 11, 2023
6eeab85
The GUI honors the user selection when computing spot features.
tinevez Sep 11, 2023
233752a
Use again the custom 2D iteration routine for SpotRoi.
tinevez Sep 11, 2023
947e757
Tweak javadoc.
tinevez Sep 11, 2023
b815623
Only propose visible analyzers in the selection to the user.
tinevez Sep 11, 2023
cc01a4d
Make sure the user selection of analyzers are added in priority order.
tinevez Sep 11, 2023
c2332c5
Spot is now an interface, with 3 derived class.
tinevez May 8, 2023
3150382
simplify TMUtils.rawWraps
tinevez Sep 11, 2023
9d25349
WIP show meshes in bvv. requires 'mesh' branch of bvv
tpietzsch Apr 18, 2023
7726b11
Add jogl deps.
tinevez May 21, 2023
dcf1d48
Minor tweak of Tobias example.
tinevez May 21, 2023
55abcb4
WIP: A new viewer for TrackMate based on the BVV.
tinevez May 22, 2023
08b729d
Copy of Tobias 'StupidMesh'.
tinevez May 23, 2023
40e06cc
The BVV view abides to the spot color settings.
tinevez May 23, 2023
1e1987b
Icosahedron spheres.
tinevez May 23, 2023
9757319
Show spots without meshes as icosahedron spheres.
tinevez May 23, 2023
7703844
Don't crash when loading faulty meshes.
tinevez May 24, 2023
a3a30bb
Fix OverlapTracker not working if the first frame was devoid of visib…
tinevez May 24, 2023
cc53108
Put a test drive in a try/catch block so that we can get exceptions.
tinevez Jun 2, 2023
5957cd4
Minor tweak of the demo.
tinevez May 30, 2023
09e8cda
Reflect model edits in the TrackMate-BVV.
tinevez Jun 2, 2023
a8b584f
TrackMate BVV can focus view on selected spot.
tinevez Jun 2, 2023
11289f2
Basic support of selection highlighting in the BVV.
tinevez Jun 2, 2023
562439f
Add a button to launch a 3D view on the GUI.
tinevez Jun 3, 2023
7fdbb86
Tweak error messages.
tinevez Jun 6, 2023
614dcc6
WIP: rework the 2d + z processor.
tinevez Jun 6, 2023
253bc0b
Fix a very serious and a very stupid mistake with the move() methods …
tinevez Jun 7, 2023
3849748
Make the meshToSpot method public.
tinevez Jun 7, 2023
187df78
WIP: on Process2DZ, assign quality, work well with ROIs.
tinevez Jun 7, 2023
a6e4c3a
Disable GUI when launching BVV.
tinevez Jun 8, 2023
d2ec241
Simplify StupidMesh.
tinevez Jun 9, 2023
0a5a1df
Exposes the BvvHandler of a TrackMate BVV view.
tinevez Jun 9, 2023
87c7232
Set frame title of TrackMate BVV views.
tinevez Jun 9, 2023
ea5570d
Position the BVV window more or less next to the GUI.
tinevez Jun 9, 2023
2315edf
Better return signature for mesh to spot mesh method.
tinevez Jun 9, 2023
ff15fdf
Make sure we have a SpotMesh built with all normals computed.
tinevez Jun 9, 2023
fb4c6ef
Tweak the Process2DZ detector.
tinevez Jun 9, 2023
dfce42c
Update to non-SNAPSHOT version of bigvolumeviewer.
tinevez Jul 3, 2023
0f57b81
WIP: Trying to implement transparency of meshes.
tinevez Jul 3, 2023
12f3197
Fix cast error
tinevez Sep 11, 2023
b333e0b
Spot is now an interface, with 3 derived class.
tinevez May 8, 2023
98dab61
Rework the 2D and 3D detection utils.
tinevez May 13, 2023
0054802
WIP show meshes in bvv. requires 'mesh' branch of bvv
tpietzsch Apr 18, 2023
a0a42e5
Depend on imglib2-mesh preview, not on net-imagej-mesh.
tinevez Sep 1, 2023
651adec
Use the scale method of the spot interface.
tinevez Sep 12, 2023
e73d18a
Don't hide exceptions when launching the BVV.
tinevez Sep 12, 2023
b3a2ac9
Try to do without deprecated method.
tinevez Sep 12, 2023
1f6f4c9
Remove debug main method.
tinevez Sep 12, 2023
1e708cf
Use the new imglib2-mesh master branch in the imglib2 org.
tinevez Sep 19, 2023
b91de5d
Abide to recent changes in imglib2-mesh.
tinevez Oct 8, 2023
01521af
Fix all javadoc warnings.
tinevez Oct 8, 2023
8afcd98
Fix mistake in calling the translateScale mesh method.
tinevez Oct 8, 2023
ff0f231
Make the mesh of a SpotMesh setable.
tinevez Nov 17, 2023
ca4ba56
Return the actual BufferMesh class when we expose the mesh of a SpotM…
tinevez Nov 17, 2023
7b48c94
Display the default element in the enum combobox of StyleElements.
tinevez Nov 17, 2023
ec2e641
An action to smooth meshes with Tuabin smoothing.
tinevez Nov 17, 2023
6e9bcc4
Multithread the mesh smoother.
tinevez Nov 19, 2023
c8649a2
Improve smoothing action.
tinevez Nov 20, 2023
cdd61ed
Mesh smoother can run on all visible spots or only on selection.
tinevez Nov 20, 2023
119f52a
Tweak the mesh smoother panel.
tinevez Nov 20, 2023
e9cb9e8
Tell the user when we update meshes and features after smoothing meshes.
tinevez Nov 20, 2023
51a0a1c
Add a toString method to MeshSmootherModel.
tinevez Nov 20, 2023
7aafab8
Add a 'basic' setting panel to the mesh smoother.
tinevez Nov 20, 2023
5cc7e23
The mesh smoother uses the numThreads from the trackmate instance.
tinevez Nov 22, 2023
b7ee1cc
WIP: Smooth mask or label before generating mesh to smooth it.
tinevez Nov 22, 2023
1ea4a17
WIP: Implement smoothing in threshold and mask detectors.
tinevez Nov 22, 2023
bbd0402
Optionally check for the presence of a parameter in a settings map.
tinevez Nov 23, 2023
d084ee6
Tweak the slider panels.
tinevez Nov 23, 2023
5cb71e1
fix the PanelSmoothContour.
tinevez Nov 23, 2023
0e01f05
Implement smoothing of images before segmentation.
tinevez Nov 23, 2023
ebcf92a
Implement the smoothing scale in the threshold, mask and label detect…
tinevez Nov 23, 2023
8c86b2c
setFont() for the slider panels.
tinevez Nov 28, 2023
397118f
Fix incorrect documentation.
tinevez Nov 29, 2023
896a599
Fix compile error due to casting error.
tinevez Dec 4, 2023
2c75352
Move the shader files to the resources folder.
tinevez Dec 4, 2023
ae88c1c
Handle whether we have or have not channels with the Process2DZ.
tinevez Feb 5, 2024
d27684e
Fix handling of ROIs in Process2DZ with multiple channels.
tinevez Feb 5, 2024
620e411
WIP show meshes in bvv. requires 'mesh' branch of bvv
tpietzsch Apr 18, 2023
808180a
Add a button to launch LabKit in the configure views panel of the wiz…
tinevez Sep 1, 2023
c719758
Rework and improve the import method of the spot editor.
tinevez Sep 2, 2023
15244f5
Try to fix LegacyService error.
tinevez Sep 19, 2023
b45c0f4
Fix reimporting labels with large IDs in 2D.
tinevez Sep 22, 2023
7237c3e
Don't go out of bounds when measuring spot quality in 2D.
tinevez Oct 5, 2023
c03037f
Fix the legacy error issue?
tinevez Oct 8, 2023
20f387d
The quality image in from2DThresholdWithROI is of RealType.
tinevez Dec 4, 2023
9967eda
All labeling methods now use the double[] origin to reposition spots.
tinevez Dec 4, 2023
b86e005
Update license blurbs.
tinevez Feb 8, 2024
2ae0900
Temporarily disable enforcer checks.
tinevez Feb 8, 2024
924110f
The Process2DZ detector is cancelable.
tinevez Mar 28, 2024
30eeacb
Keep imagej-legacy out of the dependency tree
ctrueden Mar 28, 2024
8e9dab7
POM: fix the dependencies
ctrueden Mar 28, 2024
6d00df8
Fix Javadoc errors
ctrueden Mar 28, 2024
300c8fd
A utility widget to specify a threshold on a probability value.
tinevez May 1, 2024
c2dc229
Fix minor Eclipse warnings.
tinevez May 1, 2024
0a5ff0c
Clamp slider widget values.
tinevez May 21, 2024
dd48ba4
Add required methods in SpotRoiUtils.
tinevez Jul 22, 2024
e16313b
Remove unnecessary suppressWarning.
tinevez Jul 22, 2024
eb3b80a
Don't crash if the saved tracker is unknown to us.
tinevez Jul 22, 2024
8601f67
Fixed one more bug with the labkit importer.
tinevez Jul 22, 2024
f36e3cc
Add a methods to return the map of label to spots in a labeling image.
tinevez Jul 23, 2024
88ac6e3
Support editing in 3D in the LabKit editor.
tinevez Jul 23, 2024
6300aec
Minor typo.
tinevez Jul 23, 2024
5e66f8a
Add the smoothing scale param to the 2D labeling methods as well.
tinevez Jul 23, 2024
22b3802
Remove unused methods.
tinevez Jul 23, 2024
93161a4
Update devel TrackMate major version number to 9.
tinevez Apr 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>sc.fiji</groupId>
<artifactId>TrackMate</artifactId>
<version>8.0.0-SNAPSHOT</version>
<version>9.0.0-SNAPSHOT</version>

<name>TrackMate</name>
<description>TrackMate plugin for Fiji.</description>
Expand Down Expand Up @@ -134,6 +134,7 @@
</ciManagement>

<properties>
<enforcer.skip>true</enforcer.skip>
<package-name>fiji.plugin.trackmate</package-name>
<license.licenseName>gpl_v3</license.licenseName>
<license.copyrightOwners>TrackMate developers.</license.copyrightOwners>
Expand All @@ -158,6 +159,12 @@
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>labkit-ui</artifactId>
<exclusions>
<exclusion>
<groupId>net.imagej</groupId>
<artifactId>imagej-legacy</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- ImageJ dependencies -->
Expand All @@ -169,6 +176,37 @@
<groupId>net.imagej</groupId>
<artifactId>imagej-common</artifactId>
</dependency>
<dependency>
<groupId>net.imglib2</groupId>
<artifactId>imglib2-mesh</artifactId>
</dependency>
<dependency>
<groupId>net.imagej</groupId>
<artifactId>imagej-ops</artifactId>
</dependency>
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>bigvolumeviewer</artifactId>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<classifier>${scijava.natives.classifier.gluegen}</classifier>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<classifier>${scijava.natives.classifier.jogl}</classifier>
</dependency>


<!-- ImgLib2 dependencies -->
<dependency>
Expand Down Expand Up @@ -205,8 +243,16 @@
<groupId>org.scijava</groupId>
<artifactId>scijava-listeners</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>ui-behaviour</artifactId>
</dependency>

<!-- Other dependencies -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.github.vlsi.mxgraph</groupId>
<artifactId>jgraphx</artifactId>
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/fiji/plugin/trackmate/Dimension.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ public enum Dimension
POSITION,
VELOCITY,
LENGTH,
AREA, TIME, ANGLE, RATE, // count per frames
ANGLE_RATE, STRING; // for non-numeric features
AREA,
VOLUME,
TIME,
ANGLE,
RATE, // count per frames
ANGLE_RATE,
STRING; // for non-numeric features

/*
* We separated length and position so that x,y,z are plotted on a different
Expand Down
60 changes: 39 additions & 21 deletions src/main/java/fiji/plugin/trackmate/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public class Model
*/
private int updateLevel = 0;

private final HashSet< Spot > spotsAdded = new HashSet< >();
private final HashSet< Spot > spotsAdded = new HashSet<>();

private final HashSet< Spot > spotsRemoved = new HashSet< >();
private final HashSet< Spot > spotsRemoved = new HashSet<>();

private final HashSet< Spot > spotsMoved = new HashSet< >();
private final HashSet< Spot > spotsMoved = new HashSet<>();

private final HashSet< Spot > spotsUpdated = new HashSet< >();
private final HashSet< Spot > spotsUpdated = new HashSet<>();

/**
* The event cache. During a transaction, some modifications might trigger
Expand All @@ -96,15 +96,15 @@ public class Model
* the event ID in this cache in the meantime. The event cache contains only
* the int IDs of the events listed in {@link ModelChangeEvent}, namely
* <ul>
* <li> {@link ModelChangeEvent#SPOTS_COMPUTED}
* <li> {@link ModelChangeEvent#TRACKS_COMPUTED}
* <li> {@link ModelChangeEvent#TRACKS_VISIBILITY_CHANGED}
* <li>{@link ModelChangeEvent#SPOTS_COMPUTED}
* <li>{@link ModelChangeEvent#TRACKS_COMPUTED}
* <li>{@link ModelChangeEvent#TRACKS_VISIBILITY_CHANGED}
* </ul>
* The {@link ModelChangeEvent#MODEL_MODIFIED} cannot be cached this way,
* for it needs to be configured with modification spot and edge targets, so
* it uses a different system (see {@link #flushUpdate()}).
*/
private final HashSet< Integer > eventCache = new HashSet< >();
private final HashSet< Integer > eventCache = new HashSet<>();

// OTHERS

Expand All @@ -120,7 +120,7 @@ public class Model
/**
* The list of listeners listening to model content change.
*/
Set< ModelChangeListener > modelChangeListeners = new LinkedHashSet< >();
Set< ModelChangeListener > modelChangeListeners = new LinkedHashSet<>();

/*
* CONSTRUCTOR
Expand All @@ -130,6 +130,7 @@ public Model()
{
featureModel = createFeatureModel();
trackModel = createTrackModel();
addModelChangeListener( new SpotMeshSliceCacheInvalidator() );
}

/*
Expand All @@ -154,7 +155,7 @@ protected TrackModel createTrackModel()
* <p>
* Subclassers can override this method to have the model work with their
* own subclass of {@link FeatureModel}.
*
*
* @return a new instance of {@link FeatureModel}.
*/
protected FeatureModel createFeatureModel()
Expand Down Expand Up @@ -321,7 +322,7 @@ public void clearTracks( final boolean doNotify )

/**
* Returns the {@link TrackModel} that manages the tracks for this model.
*
*
* @return the track model.
*/
public TrackModel getTrackModel()
Expand Down Expand Up @@ -447,7 +448,7 @@ public void notifyFeaturesComputed()
/**
* Set the logger that will receive the messages from the processes
* occurring within this trackmate.
*
*
* @param logger
* the {@link Logger} to use.
*/
Expand All @@ -458,7 +459,7 @@ public void setLogger( final Logger logger )

/**
* Return the logger currently set for this model.
*
*
* @return the {@link Logger} used.
*/
public Logger getLogger()
Expand Down Expand Up @@ -544,7 +545,7 @@ public synchronized Spot moveSpotFrom( final Spot spotToMove, final Integer from
* model.endUpdate();
* }
* </pre>
*
*
* @param spotToAdd
* the spot to add.
* @param toFrame
Expand Down Expand Up @@ -593,8 +594,9 @@ public synchronized Spot removeSpot( final Spot spotToRemove )
if ( DEBUG )
System.out.println( "[TrackMateModel] Removing spot " + spotToRemove + " from frame " + fromFrame );

trackModel.removeSpot( spotToRemove );
// changes to edges will be caught automatically by the TrackGraphModel
trackModel.removeSpot( spotToRemove );
// changes to edges will be caught automatically by the
// TrackGraphModel
return spotToRemove;
}
if ( DEBUG )
Expand Down Expand Up @@ -626,7 +628,7 @@ public synchronized Spot removeSpot( final Spot spotToRemove )
public synchronized void updateFeatures( final Spot spotToUpdate )
{
spotsUpdated.add( spotToUpdate ); // Enlist for feature update when
// transaction is marked as finished
// transaction is marked as finished
final Set< DefaultWeightedEdge > touchingEdges = trackModel.edgesOf( spotToUpdate );
if ( null != touchingEdges )
{
Expand Down Expand Up @@ -766,7 +768,7 @@ public synchronized boolean setTrackVisibility( final Integer trackID, final boo
* The copy is made of the same spot objects but on a different graph, that
* can be safely edited. The copy does not include the feature values for
* edges and tracks, but the features are declared.
*
*
* @return a new model.
*/
public Model copy()
Expand Down Expand Up @@ -810,7 +812,7 @@ public Model copy()
featureModel.getTrackFeatureShortNames(),
featureModel.getTrackFeatureDimensions(),
featureModel.getTrackFeatureIsInt() );

// Feature values are not copied.
return copy;
}
Expand Down Expand Up @@ -841,7 +843,7 @@ private void flushUpdate()
final int nEdgesToSignal = trackModel.edgesAdded.size() + trackModel.edgesRemoved.size() + trackModel.edgesModified.size();

// Do we have tracks to update?
final HashSet< Integer > tracksToUpdate = new HashSet< >( trackModel.tracksUpdated );
final HashSet< Integer > tracksToUpdate = new HashSet<>( trackModel.tracksUpdated );

// We also want to update the tracks that have edges that were modified
for ( final DefaultWeightedEdge modifiedEdge : trackModel.edgesModified )
Expand All @@ -853,7 +855,7 @@ private void flushUpdate()
final int nSpotsToUpdate = spotsAdded.size() + spotsMoved.size() + spotsUpdated.size();
if ( nSpotsToUpdate > 0 )
{
final HashSet< Spot > spotsToUpdate = new HashSet< >( nSpotsToUpdate );
final HashSet< Spot > spotsToUpdate = new HashSet<>( nSpotsToUpdate );
spotsToUpdate.addAll( spotsAdded );
spotsToUpdate.addAll( spotsMoved );
spotsToUpdate.addAll( spotsUpdated );
Expand Down Expand Up @@ -958,4 +960,20 @@ private void flushUpdate()
}
}

private static class SpotMeshSliceCacheInvalidator implements ModelChangeListener
{

@Override
public void modelChanged( final ModelChangeEvent event )
{
if ( event.getEventID() != ModelChangeEvent.MODEL_MODIFIED )
return;

event.getSpots()
.stream()
.filter( s -> event.getSpotFlag( s ) == ModelChangeEvent.FLAG_SPOT_MODIFIED )
.filter( s -> ( s instanceof SpotMesh ) )
.forEach( s -> ( ( SpotMesh ) s ).resetZSliceCache() );
}
}
}
20 changes: 17 additions & 3 deletions src/main/java/fiji/plugin/trackmate/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
import fiji.plugin.trackmate.features.spot.SpotAnalyzerFactoryBase;
import fiji.plugin.trackmate.features.track.TrackAnalyzer;
import fiji.plugin.trackmate.providers.EdgeAnalyzerProvider;
import fiji.plugin.trackmate.providers.Spot2DMorphologyAnalyzerProvider;
import fiji.plugin.trackmate.providers.Spot3DMorphologyAnalyzerProvider;
import fiji.plugin.trackmate.providers.SpotAnalyzerProvider;
import fiji.plugin.trackmate.providers.SpotMorphologyAnalyzerProvider;
import fiji.plugin.trackmate.providers.TrackAnalyzerProvider;
import fiji.plugin.trackmate.tracking.SpotTrackerFactory;
import ij.ImagePlus;
Expand Down Expand Up @@ -270,7 +271,7 @@ public int getYend()
* copied, as well as filters, etc. The exception are analyzers: all the
* analyzers that are found at runtime are added, regardless of the content
* of the instance to copy.
*
*
* @param newImp
* the image to copy the settings for.
* @return a new settings object.
Expand Down Expand Up @@ -531,24 +532,37 @@ public String getErrorMessage()
*/
public void addAllAnalyzers()
{
// Base spot analyzers.
final SpotAnalyzerProvider spotAnalyzerProvider = new SpotAnalyzerProvider( imp == null ? 1 : imp.getNChannels() );
final List< String > spotAnalyzerKeys = spotAnalyzerProvider.getKeys();
for ( final String key : spotAnalyzerKeys )
addSpotAnalyzerFactory( spotAnalyzerProvider.getFactory( key ) );

// Shall we add 2D morphology analyzers?
if ( imp != null && DetectionUtils.is2D( imp ) && detectorFactory != null && detectorFactory.has2Dsegmentation() )
{
final SpotMorphologyAnalyzerProvider spotMorphologyAnalyzerProvider = new SpotMorphologyAnalyzerProvider( imp.getNChannels() );
final Spot2DMorphologyAnalyzerProvider spotMorphologyAnalyzerProvider = new Spot2DMorphologyAnalyzerProvider( imp.getNChannels() );
final List< String > spotMorphologyAnaylyzerKeys = spotMorphologyAnalyzerProvider.getKeys();
for ( final String key : spotMorphologyAnaylyzerKeys )
addSpotAnalyzerFactory( spotMorphologyAnalyzerProvider.getFactory( key ) );
}

// Shall we add 3D morphology analyzers?
if ( imp != null && !DetectionUtils.is2D( imp ) && detectorFactory != null && detectorFactory.has3Dsegmentation() )
{
final Spot3DMorphologyAnalyzerProvider spotMorphologyAnalyzerProvider = new Spot3DMorphologyAnalyzerProvider( imp.getNChannels() );
final List< String > spotMorphologyAnaylyzerKeys = spotMorphologyAnalyzerProvider.getKeys();
for ( final String key : spotMorphologyAnaylyzerKeys )
addSpotAnalyzerFactory( spotMorphologyAnalyzerProvider.getFactory( key ) );
}

// Edge analyzers.
final EdgeAnalyzerProvider edgeAnalyzerProvider = new EdgeAnalyzerProvider();
final List< String > edgeAnalyzerKeys = edgeAnalyzerProvider.getKeys();
for ( final String key : edgeAnalyzerKeys )
addEdgeAnalyzer( edgeAnalyzerProvider.getFactory( key ) );

// Track analyzers.
final TrackAnalyzerProvider trackAnalyzerProvider = new TrackAnalyzerProvider();
final List< String > trackAnalyzerKeys = trackAnalyzerProvider.getKeys();
for ( final String key : trackAnalyzerKeys )
Expand Down
Loading