Skip to content

Commit 93c8169

Browse files
authored
Merge pull request #374 from ctrueden/dev
Realign dev branch with latest master branch
2 parents af3aeb5 + ee6fe6f commit 93c8169

10 files changed

Lines changed: 153 additions & 30 deletions

File tree

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>org.scijava</groupId>
77
<artifactId>pom-scijava</artifactId>
8-
<version>40.0.0</version>
8+
<version>42.0.0</version>
99
</parent>
1010

1111
<groupId>org.mastodon</groupId>
1212
<artifactId>mastodon</artifactId>
13-
<version>1.0.0-beta-35-SNAPSHOT</version>
13+
<version>1.0.0-beta-36-SNAPSHOT</version>
1414

1515
<name>Mastodon</name>
1616
<description>Mastodon – a large-scale tracking and track-editing framework for large, multi-view images.</description>

scripts/MastodonScriptExample.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#@ Context context
2+
3+
from java.io import File
4+
5+
from org.mastodon.mamut import WindowManager
6+
from org.mastodon.mamut.project import MamutProject
7+
from org.mastodon.tracking.mamut.trackmate import TrackMate
8+
from org.mastodon.tracking.mamut.trackmate import Settings
9+
from org.mastodon.tracking.mamut.detection import DoGDetectorMamut
10+
from org.mastodon.tracking.mamut.linking import SimpleSparseLAPLinkerMamut
11+
from org.mastodon.tracking.linking import LinkingUtils
12+
13+
bdv_file = "/Users/tinevez/Development/Mastodon/mastodon/samples/datasethdf5.xml"
14+
project = MamutProject( None, File( bdv_file ) );
15+
16+
# Open the project.
17+
wm = WindowManager( context )
18+
wm.getProjectManager().open( project )
19+
app_model = wm.getAppModel()
20+
21+
# Get Mastodon model.
22+
model = app_model.getModel()
23+
selection_model = app_model.getSelectionModel()
24+
25+
# Get image data.
26+
image_data = app_model.getSharedBdvData()
27+
28+
# Configure TrackMate.
29+
30+
# Detector settings.
31+
detector_settings = {
32+
"MIN_TIMEPOINT" : 0,
33+
"MAX_TIMEPOINT" : 1000,
34+
"SETUP" : 0, # The channel or source in the BDV data.
35+
"RADIUS" : 7., # The cell expected radius.
36+
"THRESHOLD" : 200. # Threshold on quality.
37+
}
38+
39+
# Linker settings. There are too many, so we take the default and edit it.
40+
linker_settings = LinkingUtils.getDefaultLAPSettingsMap()
41+
linker_settings[ "MIN_TIMEPOINT" ] = 0
42+
linker_settings[ "MAX_TIMEPOINT" ] = 1000
43+
linker_settings[ "LINKING_MAX_DISTANCE" ] = 10.
44+
linker_settings[ "ALLOW_GAP_CLOSING" ] = True
45+
linker_settings[ "MAX_FRAME_GAP" ] = 2
46+
47+
# Create the settings objects.
48+
settings = Settings() \
49+
.sources( image_data.getSources() ) \
50+
.detector( DoGDetectorMamut ) \
51+
.detectorSettings( detector_settings ) \
52+
.linker( SimpleSparseLAPLinkerMamut ) \
53+
.linkerSettings( linker_settings )
54+
55+
trackmate = TrackMate( settings, model, selection_model )
56+
57+
# We need to give a context to TrackMate.
58+
trackmate.setContext( context )
59+
60+
# Run TrackMate.
61+
trackmate.run()
62+
if trackmate.isCanceled():
63+
print( "Calculation was canceled. Reason: " + trackmate.getCancelReason() )
64+
elif not trackmate.isSuccessful():
65+
print( "Calculation failed with error message:\n" + trackmate.getErrorMessage() )
66+
else:
67+
print( "Calculation complete." );
68+
69+
wm.createTrackScheme()
70+
wm.createBigDataViewer()
71+
72+
# Compute features.
73+
74+
75+
76+
77+
wm.createTable( False )

src/main/java/org/mastodon/mamut/io/importer/trackmate/CommonTrackMateFeatureDeclarations.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*-
2+
* #%L
3+
* Mastodon
4+
* %%
5+
* Copyright (C) 2014 - 2025 Tobias Pietzsch, Jean-Yves Tinevez
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
* #L%
28+
*/
129
package org.mastodon.mamut.io.importer.trackmate;
230

331
import static org.mastodon.mamut.io.importer.trackmate.TrackMateXMLKeys.FEATURE_ATTRIBUTE;

src/main/java/org/mastodon/mamut/io/loader/util/mobie/OmeZarrMultiscalesAdapter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
public class OmeZarrMultiscalesAdapter implements JsonDeserializer< OmeZarrMultiscales >, JsonSerializer< OmeZarrMultiscales >
4646
{
4747

48-
@SuppressWarnings( "serial" )
4948
@Override
5049
public OmeZarrMultiscales deserialize( final JsonElement json, final Type typeOfT, final JsonDeserializationContext context ) throws JsonParseException
5150
{

src/main/java/org/mastodon/mamut/launcher/NewFromUrlPanel.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
import org.janelia.saalfeldlab.n5.metadata.N5ViewerMultichannelMetadata;
6767
import org.janelia.saalfeldlab.n5.ui.DatasetSelectorDialog;
6868
import org.janelia.saalfeldlab.n5.universe.N5Factory;
69-
import org.janelia.saalfeldlab.n5.universe.N5Factory.StorageFormat;
69+
import org.janelia.saalfeldlab.n5.universe.StorageFormat;
7070
import org.janelia.saalfeldlab.n5.universe.metadata.MultiscaleMetadata;
7171
import org.janelia.saalfeldlab.n5.universe.metadata.N5Metadata;
7272
import org.janelia.saalfeldlab.n5.universe.metadata.N5SingleScaleMetadata;
@@ -404,21 +404,14 @@ public N5Reader apply( final String n5UriOrPath )
404404
String rootPath = null;
405405
if ( n5UriOrPath.contains( "?" ) )
406406
{
407-
try
408-
{
409-
// need to strip off storage format for n5uri to correctly
410-
// remove query;
411-
final Pair< StorageFormat, URI > fmtUri = N5Factory.StorageFormat.parseUri( n5UriOrPath );
412-
final StorageFormat format = fmtUri.getA();
413-
414-
final N5URI n5uri = new N5URI( URI.create( fmtUri.getB().toString() ) );
415-
// add the format prefix back if it was present
416-
rootPath = format == null ? n5uri.getContainerPath() : format.toString().toLowerCase() + ":" + n5uri.getContainerPath();
417-
}
418-
catch ( final URISyntaxException e )
419-
{
420-
messenger.accept( "The URI is not valid or credentials are missing: " + n5UriOrPath );
421-
}
407+
// need to strip off storage format for n5uri to correctly
408+
// remove query;
409+
final Pair< StorageFormat, URI > fmtUri = StorageFormat.parseUri( n5UriOrPath );
410+
final StorageFormat format = fmtUri.getA();
411+
412+
final N5URI n5uri = new N5URI( URI.create( fmtUri.getB().toString() ) );
413+
// add the format prefix back if it was present
414+
rootPath = format == null ? n5uri.getContainerPath() : format.toString().toLowerCase() + ":" + n5uri.getContainerPath();
422415
}
423416

424417
if ( rootPath == null )

src/main/java/org/mastodon/mamut/views/grapher/MamutViewGrapher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.mastodon.ui.coloring.GraphColorGeneratorAdapter;
4444
import org.mastodon.ui.coloring.HasColorBarOverlay;
4545
import org.mastodon.ui.coloring.HasColoringModel;
46-
import org.mastodon.ui.commandfinder.CommandFinder;
4746
import org.mastodon.ui.keymap.KeyConfigContexts;
4847
import org.mastodon.views.context.ContextChooser;
4948
import org.mastodon.views.context.HasContextChooser;

src/main/java/org/mastodon/views/grapher/display/GrapherSidePanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public JButton getBtnPlot()
275275
return btnPlot;
276276
}
277277

278-
public < V, E > void setFeatures(
278+
public void setFeatures(
279279
final Map< FeatureSpec< ?, V >, Feature< V > > vertexFeatures,
280280
final Map< FeatureSpec< ?, E >, Feature< E > > edgeFeatures )
281281
{
@@ -436,6 +436,7 @@ public FeatureProjectionSpec getFeatureProjectionSpec( final String projectionKe
436436
return null;
437437
}
438438

439+
@Override
439440
public ContextChooser< V > getContextChooser()
440441
{
441442
return this.contextChooser;

src/main/java/org/mastodon/views/grapher/display/Plotable.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*-
2+
* #%L
3+
* Mastodon
4+
* %%
5+
* Copyright (C) 2014 - 2025 Tobias Pietzsch, Jean-Yves Tinevez
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
* #L%
28+
*/
129
package org.mastodon.views.grapher.display;
230

331
import org.mastodon.views.grapher.datagraph.ScreenTransform;

src/test/java/org/mastodon/StartMastodonDefaultProject.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public class StartMastodonDefaultProject
3434
public static void main( final String[] args )
3535
{
3636
// final String projectPath = "samples/MaMuT_Parhyale_small.mastodon";
37-
// final String projectPath = "/Users/tinevez/Google Drive/Mastodon/Datasets/Remote/ParhyaleHawaiensis/MaMuT_Parhyale_demo-mamut.mastodon";
38-
final String projectPath = "samples/drosophila_crop_LONG_NAME_LONGLONGLONG_SUPERLONG.mastodon";
37+
final String projectPath = "/Users/tinevez/Library/CloudStorage/GoogleDrive-jeanyves.tinevez@gmail.com/My Drive/Mastodon/Datasets/Remote/BDV/Tribolium/CTC_TRIF_trainingVideo02_jy-GT-done.mastodon";
38+
// final String projectPath = "samples/drosophila_crop_LONG_NAME_LONGLONGLONG_SUPERLONG.mastodon";
3939
// final String projectPath = "samples/drosophila_crop.mastodon";
4040
StartMastodonOnProject.launch( projectPath );
4141
}

src/test/java/org/mastodon/graph/revised/CreateLargeModelExample.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
import java.io.IOException;
3232

33-
import org.mastodon.mamut.ProjectModel;
34-
import org.mastodon.mamut.WindowManager;
3533
import org.mastodon.mamut.io.importer.ModelImporter;
3634
import org.mastodon.mamut.io.project.MamutProject;
3735
import org.mastodon.mamut.model.Link;
@@ -184,11 +182,11 @@ public static void main( final String[] args ) throws IOException
184182
( Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() ) / 1e6d ) );
185183

186184

187-
final Context context = new Context();
188-
final SharedBigDataViewerData imagedata = SharedBigDataViewerData.fromDummyFilename( "x=1000 y=1000 z=100 sx=1 sy=1 sz=10 t=400.dummy" );
189-
final MamutProject project = new MamutProject( "./large_model_example.mastodon" );
190-
final ProjectModel appModel = ProjectModel.create( context, model, imagedata, project );
191-
final WindowManager wm = new WindowManager( appModel );
185+
// final Context context = new Context();
186+
// final SharedBigDataViewerData imagedata = SharedBigDataViewerData.fromDummyFilename( "x=1000 y=1000 z=100 sx=1 sy=1 sz=10 t=400.dummy" );
187+
// final MamutProject project = new MamutProject( "./large_model_example.mastodon" );
188+
// final ProjectModel appModel = ProjectModel.create( context, model, imagedata, project );
189+
// final WindowManager wm = new WindowManager( appModel );
192190

193191
// start = System.currentTimeMillis();
194192
// wm.createBigDataViewer();

0 commit comments

Comments
 (0)