Chargement...
 

DevManual

How to create plugins compatible with TANGO ?


Tango uses ImageJ plug-in system to import plug-ins, but ImageJ plug-in cannot directly be used as Tango plug-ins, only a few modifications are needed, allowing TANGO to parametrize them.
The different types of plugins are :

  • Pre-filtering : filtering before segmentation (typically denoising)

input: grayscale image
output: grayscale image

  • Post-filtering : filtering after segmentation (typically morphological filtering)

input: labelled image
output: labelled image

  • Segmentation : detect and label objects in a image

input: grayscale image
output: labelled image

  • Measurements : quantitative measures on objects

input: grayscale & labelled images of a cell
output: numbers

  • Thresholding : compute a threshold

input: grayscale image
output: threshold (number)

  • Sampler : simulation of point patterns


grayscale images can be 8-bit, 16-bit, 32-bit.
labelled images can be 8-bit or 16-bit, preferably 16-bit (to avoid limiting the number of objects)

Requirements for a plugin

TANGO uses the same plugin system as ImageJ, thus to be included in tango, a java class has to:

  • implement an tangoPlugin interface
  • be listed in the plugin.conf file if it is in a .jar archive
  • contain an underscore in the name if it is a single class


Constraints:

  • A plugin should be thread-safe (careful with static variables)
  • It should not display any image, or any text in the log, console nor status bar, unless the verbose mode is on (see below)

Common methods for plugins

The TangoPlugin interfaces impose several methods

public Parameter[] getParameters();
// parameters needed by the plugin

public String getHelp();
// description and credit for the plugin. the String object will be interpreted as html so html tags can be included. 
//It will be displayed when the user mouse of the title of the plugin in the interface.

public void setVerbose(boolean verbose);
//The verbose mode is set to ON when the user tests a processing chain. 
//It allows to display intermediates images, messages in the log to help the user tune the plugin. 
//When the verbose mode is OFF, nothing should be displayed.

public void setMultithread(int nbCPUS);
//Number of CPUs allocated to the plugin in multithread mode.


See the Parameter page for a detailed description of the parameters available in TANGO.

Input and Ouput Format

Tango has its own image format, "ImageHandler", that provide a direct access to the pixel array, and several processing methods.
For compatibility with imageJ, the ImagePlus object associated can be accessed through the method getImagePlus(), and ImageHandler can wrap an ImagePlus through the static method wrap(ImagePlus img)
Most interfaces provide two objects, the input image (ImageHandler) and an object that provide access to the images of other structures.
There are two types of InputImages objects:
InputFieldImages : provides access to raw channel images of all the structures of the expriement for the current processed field;
InputCellImages : provides access to raw channel images of all the structures of the experiments, for the current nucleus.
It also provides the mask of the current nucleus
For measurement plugins, the labelled images may be needed:
SegmentedCellImages : provides access to all labelled images of the current nucleus.

It is possible to prompt the user for a specific structure, using the StructureParameter (see the Parameter page for a detailed explanation)

Pre filtering plugins

These types of plugins are used to filter grayscales images.
Pre-filters must implement the PreFilter interface and post-filters must implement the PostFilter interface.
The specific methods to be implemented are :

// the main run function for pre-filter plugins, with the input image from the structure to process, 
// and other images from other structures
// will return a ImageHandler image (see explanation below)
public ImageHandler runPreFilter(int currentStructureIndex, ImageHandler input, InputImages images);

Post-filtering plugins

These types of plugins are used to filter segmented images.
Post-filters must implement the PostFilter interface.
The specific methods to be implemented are :

// the main run function for post-filter plugins, with the input image from the structure to process, 
// and other images from other structures
// will return a ImageInt image (see explanation below)
public ImageInt runPostFilter(int currentStructureIndex, ImageInt input, InputImages images);

Segmentation plugins

These plugins will detect object in the image and return a labelled image. Two kind of objects are to be considered, the nuclei that will contain other objects of interest like spots. An acquisition filed may contain many nuclei taht are to be analysed separately, and the objects inside these nuclei are to be segmented in their own nucleus. Two types of segmenter are then present in Tango : NucleiSegmenter and SpotSegmenter.

Nuclei segmenter

Nuclei segmenter plugins must implements the following functions :

// the main function with raw image as input corresponding to nucleus, and other input images
public ImageInt runNucleus(int currentStructureIndex, ImageHandler input, InputFieldImages rawImages); 
// return an array of tag, indicating for instance a quality for each detected nucleus
public int[] getTags();

Spots segmenter

Spots segmenter plugins must implements the following functions :

// the main function with raw image as input. 
//The mask of the corresponding nucleus can be accessed from the InputCellImages object through the method getMask()
// returns a image with masks of labelled spots
public ImageInt runSpot(int currentStructureIndex, ImageHandler input, InputCellImages rawImages);
// return the probability map (with values between 0 and 1, for fuzzy segmentation), can be null
 public ImageFloat getProbabilityMap();

Thresholder

These plugin compute a threshold value (double) from a grayscale image.

// the main function with raw image as input and the mask of the corresponding nucleus
// returns a image with masks of labeled spots
public double runThresholder(int currentStructureIndex, ImageHandler input, InputImages images);


Measurements

A measurement plugin is run on a single cell, and will return numeric values, that will be stored in the database.
Thus there is a common method for all measurement plugins, that specifies the returned values of the plugin.

public Parameter[] getKeys();

This methods return several KeyParameter (or GroupKeyParameter).
Those parameters define the type of numeric object return (scalar/ array) and the key associated in the database (user-modifiable)

There are 3 types of measurement in tango

Measurements on objects

Those measurement return a single numeric value per object: e.g: volume of an object.
Thus they have to return arrays with a size equal to the number of objects.
The associated interface is MeasurementObject

public int getStructure(); 
//this method returns the structure that contains the objects of interest.
public HashMap<String, Object[]> getMeasure(InputCellImages rawImages, SegmentedCellImages segmentedImages);
//this method returns array of numeric values with a size equals to the number of objects in the structure. They are mapped with a String that correspond to the key of the measurement ( from the KeyParameter associated)

Measurement on structures

public int[] getStructures(); 
//this method returns the structures that contains the objects of interest.
public HashMap<String, Object> getMeasure(InputCellImages rawImages, SegmentedCellImages segmentedImages);
//this method returns numeric values of different types (see below). They are mapped with a String that correspond to the key of the measurement ( from the KeyParameter associated)


Type of returned keys:
Number : a scalar numeric value
ArrayMisc : a numeric array of any length
ArrayO2O : a numeric array of constrained size:

  • if the two structure are different, and have n1 and n2 objects: n1*n2
  • if there is only one structure with n objects: n*(n-1)/2

This is for a particular kind of measurement on structure, performed between the objects of two structures: e.g : distance between objects.