Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>40.0.0</version>
<version>42.0.0</version>
</parent>

<groupId>org.mastodon</groupId>
<artifactId>mastodon</artifactId>
<version>1.0.0-beta-35-SNAPSHOT</version>
<version>1.0.0-beta-36-SNAPSHOT</version>

<name>Mastodon</name>
<description>Mastodon – a large-scale tracking and track-editing framework for large, multi-view images.</description>
Expand Down
77 changes: 77 additions & 0 deletions scripts/MastodonScriptExample.py
Original file line number Diff line number Diff line change
@@ -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 )
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
25 changes: 9 additions & 16 deletions src/main/java/org/mastodon/mamut/launcher/NewFromUrlPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -436,6 +436,7 @@ public FeatureProjectionSpec getFeatureProjectionSpec( final String projectionKe
return null;
}

@Override
public ContextChooser< V > getContextChooser()
{
return this.contextChooser;
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/org/mastodon/views/grapher/display/Plotable.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/mastodon/StartMastodonDefaultProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down