diff --git a/pom.xml b/pom.xml index 4db071598..12f04e6bc 100644 --- a/pom.xml +++ b/pom.xml @@ -5,12 +5,12 @@ org.scijava pom-scijava - 40.0.0 + 42.0.0 org.mastodon mastodon - 1.0.0-beta-35-SNAPSHOT + 1.0.0-beta-36-SNAPSHOT Mastodon Mastodon – a large-scale tracking and track-editing framework for large, multi-view images. diff --git a/scripts/MastodonScriptExample.py b/scripts/MastodonScriptExample.py new file mode 100755 index 000000000..93728377b --- /dev/null +++ b/scripts/MastodonScriptExample.py @@ -0,0 +1,77 @@ +#@ Context context + +from java.io import File + +from org.mastodon.mamut import WindowManager +from org.mastodon.mamut.project import MamutProject +from org.mastodon.tracking.mamut.trackmate import TrackMate +from org.mastodon.tracking.mamut.trackmate import Settings +from org.mastodon.tracking.mamut.detection import DoGDetectorMamut +from org.mastodon.tracking.mamut.linking import SimpleSparseLAPLinkerMamut +from org.mastodon.tracking.linking import LinkingUtils + +bdv_file = "/Users/tinevez/Development/Mastodon/mastodon/samples/datasethdf5.xml" +project = MamutProject( None, File( bdv_file ) ); + +# Open the project. +wm = WindowManager( context ) +wm.getProjectManager().open( project ) +app_model = wm.getAppModel() + +# Get Mastodon model. +model = app_model.getModel() +selection_model = app_model.getSelectionModel() + +# Get image data. +image_data = app_model.getSharedBdvData() + +# Configure TrackMate. + +# Detector settings. +detector_settings = { + "MIN_TIMEPOINT" : 0, + "MAX_TIMEPOINT" : 1000, + "SETUP" : 0, # The channel or source in the BDV data. + "RADIUS" : 7., # The cell expected radius. + "THRESHOLD" : 200. # Threshold on quality. +} + +# Linker settings. There are too many, so we take the default and edit it. +linker_settings = LinkingUtils.getDefaultLAPSettingsMap() +linker_settings[ "MIN_TIMEPOINT" ] = 0 +linker_settings[ "MAX_TIMEPOINT" ] = 1000 +linker_settings[ "LINKING_MAX_DISTANCE" ] = 10. +linker_settings[ "ALLOW_GAP_CLOSING" ] = True +linker_settings[ "MAX_FRAME_GAP" ] = 2 + +# Create the settings objects. +settings = Settings() \ + .sources( image_data.getSources() ) \ + .detector( DoGDetectorMamut ) \ + .detectorSettings( detector_settings ) \ + .linker( SimpleSparseLAPLinkerMamut ) \ + .linkerSettings( linker_settings ) + +trackmate = TrackMate( settings, model, selection_model ) + +# We need to give a context to TrackMate. +trackmate.setContext( context ) + +# Run TrackMate. +trackmate.run() +if trackmate.isCanceled(): + print( "Calculation was canceled. Reason: " + trackmate.getCancelReason() ) +elif not trackmate.isSuccessful(): + print( "Calculation failed with error message:\n" + trackmate.getErrorMessage() ) +else: + print( "Calculation complete." ); + +wm.createTrackScheme() +wm.createBigDataViewer() + +# Compute features. + + + + +wm.createTable( False ) diff --git a/src/main/java/org/mastodon/mamut/io/importer/trackmate/CommonTrackMateFeatureDeclarations.java b/src/main/java/org/mastodon/mamut/io/importer/trackmate/CommonTrackMateFeatureDeclarations.java index 5aac6f5cc..b2dcb5389 100644 --- a/src/main/java/org/mastodon/mamut/io/importer/trackmate/CommonTrackMateFeatureDeclarations.java +++ b/src/main/java/org/mastodon/mamut/io/importer/trackmate/CommonTrackMateFeatureDeclarations.java @@ -1,3 +1,31 @@ +/*- + * #%L + * Mastodon + * %% + * Copyright (C) 2014 - 2025 Tobias Pietzsch, Jean-Yves Tinevez + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ package org.mastodon.mamut.io.importer.trackmate; import static org.mastodon.mamut.io.importer.trackmate.TrackMateXMLKeys.FEATURE_ATTRIBUTE; diff --git a/src/main/java/org/mastodon/mamut/io/loader/util/mobie/OmeZarrMultiscalesAdapter.java b/src/main/java/org/mastodon/mamut/io/loader/util/mobie/OmeZarrMultiscalesAdapter.java index 3cb0fcd26..91fd7b11c 100644 --- a/src/main/java/org/mastodon/mamut/io/loader/util/mobie/OmeZarrMultiscalesAdapter.java +++ b/src/main/java/org/mastodon/mamut/io/loader/util/mobie/OmeZarrMultiscalesAdapter.java @@ -45,7 +45,6 @@ public class OmeZarrMultiscalesAdapter implements JsonDeserializer< OmeZarrMultiscales >, JsonSerializer< OmeZarrMultiscales > { - @SuppressWarnings( "serial" ) @Override public OmeZarrMultiscales deserialize( final JsonElement json, final Type typeOfT, final JsonDeserializationContext context ) throws JsonParseException { diff --git a/src/main/java/org/mastodon/mamut/launcher/NewFromUrlPanel.java b/src/main/java/org/mastodon/mamut/launcher/NewFromUrlPanel.java index f99b6a26c..2e265716c 100644 --- a/src/main/java/org/mastodon/mamut/launcher/NewFromUrlPanel.java +++ b/src/main/java/org/mastodon/mamut/launcher/NewFromUrlPanel.java @@ -66,7 +66,7 @@ import org.janelia.saalfeldlab.n5.metadata.N5ViewerMultichannelMetadata; import org.janelia.saalfeldlab.n5.ui.DatasetSelectorDialog; import org.janelia.saalfeldlab.n5.universe.N5Factory; -import org.janelia.saalfeldlab.n5.universe.N5Factory.StorageFormat; +import org.janelia.saalfeldlab.n5.universe.StorageFormat; import org.janelia.saalfeldlab.n5.universe.metadata.MultiscaleMetadata; import org.janelia.saalfeldlab.n5.universe.metadata.N5Metadata; import org.janelia.saalfeldlab.n5.universe.metadata.N5SingleScaleMetadata; @@ -404,21 +404,14 @@ public N5Reader apply( final String n5UriOrPath ) String rootPath = null; if ( n5UriOrPath.contains( "?" ) ) { - try - { - // need to strip off storage format for n5uri to correctly - // remove query; - final Pair< StorageFormat, URI > fmtUri = N5Factory.StorageFormat.parseUri( n5UriOrPath ); - final StorageFormat format = fmtUri.getA(); - - final N5URI n5uri = new N5URI( URI.create( fmtUri.getB().toString() ) ); - // add the format prefix back if it was present - rootPath = format == null ? n5uri.getContainerPath() : format.toString().toLowerCase() + ":" + n5uri.getContainerPath(); - } - catch ( final URISyntaxException e ) - { - messenger.accept( "The URI is not valid or credentials are missing: " + n5UriOrPath ); - } + // need to strip off storage format for n5uri to correctly + // remove query; + final Pair< StorageFormat, URI > fmtUri = StorageFormat.parseUri( n5UriOrPath ); + final StorageFormat format = fmtUri.getA(); + + final N5URI n5uri = new N5URI( URI.create( fmtUri.getB().toString() ) ); + // add the format prefix back if it was present + rootPath = format == null ? n5uri.getContainerPath() : format.toString().toLowerCase() + ":" + n5uri.getContainerPath(); } if ( rootPath == null ) diff --git a/src/main/java/org/mastodon/mamut/views/grapher/MamutViewGrapher.java b/src/main/java/org/mastodon/mamut/views/grapher/MamutViewGrapher.java index 14b594c53..9c992e3ed 100644 --- a/src/main/java/org/mastodon/mamut/views/grapher/MamutViewGrapher.java +++ b/src/main/java/org/mastodon/mamut/views/grapher/MamutViewGrapher.java @@ -43,7 +43,6 @@ import org.mastodon.ui.coloring.GraphColorGeneratorAdapter; import org.mastodon.ui.coloring.HasColorBarOverlay; import org.mastodon.ui.coloring.HasColoringModel; -import org.mastodon.ui.commandfinder.CommandFinder; import org.mastodon.ui.keymap.KeyConfigContexts; import org.mastodon.views.context.ContextChooser; import org.mastodon.views.context.HasContextChooser; diff --git a/src/main/java/org/mastodon/views/grapher/display/GrapherSidePanel.java b/src/main/java/org/mastodon/views/grapher/display/GrapherSidePanel.java index 5e5440aeb..5ce4158b6 100644 --- a/src/main/java/org/mastodon/views/grapher/display/GrapherSidePanel.java +++ b/src/main/java/org/mastodon/views/grapher/display/GrapherSidePanel.java @@ -275,7 +275,7 @@ public JButton getBtnPlot() return btnPlot; } - public < V, E > void setFeatures( + public void setFeatures( final Map< FeatureSpec< ?, V >, Feature< V > > vertexFeatures, final Map< FeatureSpec< ?, E >, Feature< E > > edgeFeatures ) { @@ -436,6 +436,7 @@ public FeatureProjectionSpec getFeatureProjectionSpec( final String projectionKe return null; } + @Override public ContextChooser< V > getContextChooser() { return this.contextChooser; diff --git a/src/main/java/org/mastodon/views/grapher/display/Plotable.java b/src/main/java/org/mastodon/views/grapher/display/Plotable.java index a23073969..f77780cb4 100644 --- a/src/main/java/org/mastodon/views/grapher/display/Plotable.java +++ b/src/main/java/org/mastodon/views/grapher/display/Plotable.java @@ -1,3 +1,31 @@ +/*- + * #%L + * Mastodon + * %% + * Copyright (C) 2014 - 2025 Tobias Pietzsch, Jean-Yves Tinevez + * %% + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * #L% + */ package org.mastodon.views.grapher.display; import org.mastodon.views.grapher.datagraph.ScreenTransform; diff --git a/src/test/java/org/mastodon/StartMastodonDefaultProject.java b/src/test/java/org/mastodon/StartMastodonDefaultProject.java index 541b7a434..27b92cacd 100644 --- a/src/test/java/org/mastodon/StartMastodonDefaultProject.java +++ b/src/test/java/org/mastodon/StartMastodonDefaultProject.java @@ -34,8 +34,8 @@ public class StartMastodonDefaultProject public static void main( final String[] args ) { // final String projectPath = "samples/MaMuT_Parhyale_small.mastodon"; -// final String projectPath = "/Users/tinevez/Google Drive/Mastodon/Datasets/Remote/ParhyaleHawaiensis/MaMuT_Parhyale_demo-mamut.mastodon"; - final String projectPath = "samples/drosophila_crop_LONG_NAME_LONGLONGLONG_SUPERLONG.mastodon"; + 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"; +// final String projectPath = "samples/drosophila_crop_LONG_NAME_LONGLONGLONG_SUPERLONG.mastodon"; // final String projectPath = "samples/drosophila_crop.mastodon"; StartMastodonOnProject.launch( projectPath ); } diff --git a/src/test/java/org/mastodon/graph/revised/CreateLargeModelExample.java b/src/test/java/org/mastodon/graph/revised/CreateLargeModelExample.java index c223ad4c0..a73b2676c 100644 --- a/src/test/java/org/mastodon/graph/revised/CreateLargeModelExample.java +++ b/src/test/java/org/mastodon/graph/revised/CreateLargeModelExample.java @@ -30,8 +30,6 @@ import java.io.IOException; -import org.mastodon.mamut.ProjectModel; -import org.mastodon.mamut.WindowManager; import org.mastodon.mamut.io.importer.ModelImporter; import org.mastodon.mamut.io.project.MamutProject; import org.mastodon.mamut.model.Link; @@ -184,11 +182,11 @@ public static void main( final String[] args ) throws IOException ( Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() ) / 1e6d ) ); - final Context context = new Context(); - final SharedBigDataViewerData imagedata = SharedBigDataViewerData.fromDummyFilename( "x=1000 y=1000 z=100 sx=1 sy=1 sz=10 t=400.dummy" ); - final MamutProject project = new MamutProject( "./large_model_example.mastodon" ); - final ProjectModel appModel = ProjectModel.create( context, model, imagedata, project ); - final WindowManager wm = new WindowManager( appModel ); +// final Context context = new Context(); +// final SharedBigDataViewerData imagedata = SharedBigDataViewerData.fromDummyFilename( "x=1000 y=1000 z=100 sx=1 sy=1 sz=10 t=400.dummy" ); +// final MamutProject project = new MamutProject( "./large_model_example.mastodon" ); +// final ProjectModel appModel = ProjectModel.create( context, model, imagedata, project ); +// final WindowManager wm = new WindowManager( appModel ); // start = System.currentTimeMillis(); // wm.createBigDataViewer();