Mamut¶
- public class Mamut¶
Main gateway for scripting Mastodon.
This should be the entry point to create a new project or open an existing one via the
open(String)
andnewProject(String)
static methods. Once an instance is obtained this way, a Mastodon project can be manipulated with the instance methods.The gateways used in scripting are called Mamut and TrackMate. We chose these names to underly that this application offer functionalities that are similar to that of the MaMuT and TrackMate software, but improved. Nonetheless, all the code used is from Mastodon and allows only dealing with Mastodon projects.
- Author
Jean-Yves Tinevez
Static methods¶
These methods need to be called on the class object org.mastodon.mamut.Mamut iself. They return an instance that can be used to manipulate the associated Mastodon project.
newProject¶
- public static final Mamut newProject(String bdvFile, Context context)¶
Creates a new Mastodon project analyzing the specified image data.
- Parameters
bdvFile – a path to a BDV XML file. It matters not whether the image data is stored locally or remotely.
context – an existing, non-
null
Context
instance to use to open the project.
- Throws
IOException
– when an error occurs trying to locate and open the file.SpimDataException
– when an error occurs trying to open the image data.FormatException
– when an error occurs with the image file format.
- Returns
a new
Mamut
instance.
newProject¶
- public static final Mamut newProject(String bdvFile)¶
Creates a new Mastodon project analyzing the specified image data.
A new
Context
is created along this call.- Parameters
bdvFile – a path to a BDV XML file. It matters not whether the image data is stored locally or remotely.
- Throws
IOException
– when an error occurs trying to locate and open the file.SpimDataException
– when an error occurs trying to open the image data.FormatException
– when an error occurs with the image file format.
- Returns
a new
Mamut
instance.
open¶
- public static final Mamut open(String mamutProject)¶
Opens an existing Mastodon project and returns a
Mamut
instance that can manipulate it.A new
Context
is created along this call.- Parameters
mamutProject – the path to the Mastodon file.
- Throws
IOException
– when an error occurs trying to locate and open the file.SpimDataException
– when an error occurs trying to open the image data.FormatException
– when an error occurs with the image file format.
- Returns
a new
Mamut
instance.
open¶
- public static final Mamut open(String mamutProject, Context context)¶
Opens an existing Mastodon project and returns a
Mamut
instance that can manipulate it.- Parameters
mamutProject – the path to the Mastodon file.
context – an existing, non-
null
Context
instance to use to open the project.
- Throws
IOException
– when an error occurs trying to locate and open the file.SpimDataException
– when an error occurs trying to open the image data.FormatException
– when an error occurs with the image file format.
- Returns
a new
Mamut
instance.
Methods¶
These methods manipulate a Mastodon project using an instance returned by the static methods above.
clear¶
- public void clear()¶
Clears the content of the data model. Can be undone.
computeFeatures¶
computeFeatures¶
- public void computeFeatures(boolean forceComputeAll, String... featureKeys)¶
Computes the specified features, possible forcing recomputation for all data items, regardless of whether they are in sync or not.
- Parameters
forceComputeAll – if
true
, will force recomputation for all data items. Iffalse
, feature values that are in sync won’t be recomputed.featureKeys – the names of the feature computer to use for computation. It matters not whether the feature is for spots, links, …
createTag¶
createTrackMate¶
- public TrackMateProxy createTrackMate()¶
Creates and returns a new
TrackMateProxy
instance. This instance can then be used to configure tracking on the image analyzed in this currentMamut
instance.It is perfectly possible to create and configure separately several
TrackMateProxy
instances. Tracking results will be combined depending on the instances configuration.- Returns
a new
TrackMateProxy
instance.
deleteSelection¶
- public void deleteSelection()¶
Deletes all the data items (spots and tracks) currently in the selection.
detect¶
- public void detect(double radius, double threshold)¶
Performs detection of spots in the image data with the default detection algorithm (the DoG detector).
- Parameters
radius – the radius of spots to detect, in the physical units of the image data.
threshold – the threshold on quality of detection below which to reject detected spots.
echo¶
- public void echo()¶
Prints the content of the data model as two tables as text in the logger output.
echo¶
- public void echo(int nLines)¶
Prints the first N data items of the content of the data model as two tables as text in the logger output.
- Parameters
nLines – the number of data items to print.
getLogger¶
- public Logger getLogger()¶
Returns the logger instance to use to send messages and errors.
- Returns
the logger instance.
getModel¶
getSelectionModel¶
getWindowManager¶
- public WindowManager getWindowManager()¶
Returns the
WindowManager
gateway used to create views of the data used in thisMamut
instance.- Returns
the
WindowManager
gateway.
info¶
- public void info()¶
Prints a summary information to the logger output.
infoFeatures¶
- public void infoFeatures()¶
Prints summary information on the feature computers known to Mastodon to the logger output.
link¶
- public void link(double maxLinkingDistance, int maxFrameGap)¶
Performs linking of existing spots using the default linking algorithm (the Simple LAP linker).
- Parameters
maxLinkingDistance – the max linking distance (in physical unit) beyond which to forbid linking.
maxFrameGap – the max difference in frames for bridging gaps (missed detections).
redo¶
- public void redo()¶
Redo the last changes. Can be called several times.
resetSelection¶
- public void resetSelection()¶
Clears the current selection.
save¶
- public boolean save()¶
Saves the Mastodon project of this instance to a Mastodon file.
This method will return an error if a Mastodon file for the project has not been specified a first time with the
saveAs(String)
method.- Returns
true
if saving happened without errors. Otherwise an error message is sent to theLogger
instance.
saveAs¶
- public boolean saveAs(String mastodonFile)¶
Saves the Mastodon project of this instance to a new Mastodon file (it is recommended to use the
.mastodon
file extension).The file specified will be reused for every following call to the
save()
method.- Parameters
mastodonFile – a path to a writable file.
- Returns
true
if saving happened without errors. Otherwise an error message is sent to theLogger
instance.
select¶
- public void select(String expression)¶
Sets the current selection from a selection creator expression.
Such an expression can be:
mamut.select( "vertexFeature( 'Track N spots' ) < 10" )
Check the selection creator tutorial to learn how to build such expressions. An error message is sent to the logger is there is a problem with the evaluation of the expression.
- Parameters
expression – a selection creator expression.
setLogger¶
- public void setLogger(Logger logger)¶
Sets the logger instance to use to send messages and errors.
- Parameters
logger – a logger instance.
setTagColor¶
- public void setTagColor(String tagSetName, String label, int R, int G, int B)¶
Sets the color associated with a tag in a tag-set. The color is specified as a RGB triplet from 0 to 255.
- Parameters
tagSetName – the name of the tag-set containing the target tag.
label – the tag to modify the color of.
R – the red value of the RGB triplet.
G – the green value of the RGB triplet.
B – the blue value of the RGB triplet.
undo¶
- public void undo()¶
Undo the last changes. Can be called several times.