Page history Edit this page How do I edit this website?

CIP Utilities

This page provides user documentation for the utility functions of the CIP package

One can found additional information on the function parameters (type, optional/required, positional/named) on the parameters documentation page.

To access another category of CIP functions: Format, Filter, Math, Segment, Assess, Experimental.


This function performs measures in image and region and return them as a table.

outputTable = cip.measure( inputImage* ,measures*, unit, prefix )
perform the specified measures on the entire input image.

`outputTable = cip.measure( regions* ,measures*, source, unit, prefix )`  
perform the specified measures for each of the provided region. if provided the source image is used for intensity measure.   <span style="font-size:110%">**Input**</span>  
**inputImage\*** : the image to measure  
**regions\*** : a region or list of regions to be measured.  
**measures\*** : a string or a list of strings taken from {'min', 'max', 'mean', 'stddev', 'median', 'position', 'boundary', 'size'} and representing the measure to be performed  
**source** : a image that will be used to perform the intensity based measure if the input is of type region. if not provided the measure will be done on the input object intensity  
**unit** : is a boolean value indicating to use or not the image pixel size. Default is true.  
**prefix** : is a string that will be set at the beginning of each column header in the output. It can be used for instance to differentiate measures performed on the same object with different source image. Default is an empty string.

outputTable: the measures table. Each column represent one of the requested measure while the first column provides a reference to the measures object. Each row contains the measures performed for a particular object.

regions = cip.region(labelMap)
table = cip.measure(regions, 'size' , 'nuclei' ) table )
In the first line labelMap is the left image in the illustration below. In the second line, ‘size’ is the measure performed, ‘nuclei’ is used to customize region names (see object column in the illustration below). CIP_measure.PNG
The measure function instanciate a toolbox adapted for the object to measure. the toolbox can receive new measures tools to extend the existing measure set.


show display CIP data within IJ1 component: hyperstack viewer, results table and log window. this ensures easy communication and reuse of the data by the rest of imageJ ecosystem.

Signature: image
handle = inputImage* , color )
will display an hyperstack viewer with the name of the image and the requested color luts.

**inputImage\***: the image to display.  
**color**: a string or a list of string representing a Look Up Table available in ImageJ menu. For basic colors using the first letter of the lut is enough ('r' in place of 'red' or 'rgb' in place of \['red','green','blue'\]).

Signature: region region*, handle, color, width, scalar, reset )
will add region contours to the overlay of the image pointed by handle and with the specified properties: color, width, scalars.

**region**: a region or list of regions. this works with bot 2d and 3d regions.  
**handle**: a string with the name of the window where region(s) will be displayed. if no string is provided, region will be shown on the image currently in focus in ImageJ.  
**color**: a string representing a colors or a lut available in imageJ menu. default is 'lila'. Colors have priority on lut of the same name.  
**width**: a scalar representing contour width in point. default is 1.  
**scalars**: a list of scalars representing a region attribute and being used to choose region color in the lut. default is \[1,2,..., n\] where n is the number of region provided as input.  
**reset**: a boolean indication whether or not to reset the overlay. The default is false.

Signature: table
handle = inputTable* , handle, reset)
will display an IJ1 results table with same headers and rows as the input table.

**table**: a table to display.  
**handle**: a string with the name of the results table where the data will be appended.  
**reset**: a boolean indication whether or not to reset the results table. The default is false.

Signature: string
handle = message* )
will display the message in IJ1 log window.

**message** a string to display in the IJ1 log window.

Signature: track (Experimental) TrackmateModel*, image, mode, track style, track depth )
will display tracks detected with trackmate or cip.track in trackscheme or overlaid in an hyperstack viewer.

**TrackMateModel\*** a TrackMate model object returned by cip.track or created with the trackmate api.  
**image** an image on which the track can be displayed, if not provided an empty image the same size as the one used for the tracking will be used.  
**mode** a string in {<u>'image'</u>,'trackscheme','all'}. default is 'image'. When image is chosen tract are displayed in image overlay. With 'trackscheme' the trackscheme ui is used to display the tracks.  
**track style** a string in {<u>'all'</u>,'local','backward','forward','selection'}. 'all' is the default. depending of the value the track are shown entirely ('all'), a few step before('backward') or after ('forward') current time, both before and after ('local').  
**track depth** a scalar defining the number of step draw in 'local', 'backward' and 'forward' track style. Default is 10.

handle: a string with the name of the created results table or image window.

This example demonstrate how to label a gray level image and overlay the contour of the detected region on orignal image.
labelMap = cip.label(img, 'threshold', 500)
regions = cip.region(labelMap)
h = # display img, regions, 'glasbey' ) # overlay the region contour to img
An example script displaying tracks can found here

The show function relies on IJ1 component as a starting point as this is the way data are displayed when downloading a fresh version of Fiji. this also ensure that this data can easily be seen and processed the usual way by any imageJ plugins.


This function is a converter is that IJ1 or IJ2 object and convert them to CIP regions.

region = cip.region( image, name )
will convert an image to a region or a list of region.

image : an image that will be interpreted as a mask if it has boolean type or as a label image otherwise.
name : a string that will be used to name the region. if there are multiple region the name will be appended with a scalar to differentiate the regions.

region: a region if the input is boolean a list of region otherwise.


Is a converter that converts image to ImagePlus and CIP regions to rois.

IJ1_image = cip.gauss( image*)
converts an image (of any type) to an ImagePlus.

`IJ1_roi = cip.gauss( region*)`  
converts a region (of any type) to Rois.

image : the image to convert to IJ1 ImagePlus.
region: a region or a list of region to convert to a list of list of Rois (where each list of Rois represents the 2d contours of a 3D object)

IJ1_image : and ImagePlus version of the input image
IJ1_rois : a list of list of Rois. each of the input region will be represented by a list of Rois where each Roi is the contour of a 2d section through the region.


Converts an image (of any type handled by CIP) to an IJ2 Dataset and a region (of any type handled by CIP) to an Imglib2 IterableRegion.

IJ2_image = cip.toIJ2( image* )
converts an image to an IJ2 Dataset.

`IJ2_region = cip.toIJ2( region* )`  
converts an image to an ImgLib2 IterableRegion.

image* : an image to convert
region*: a region or a list of region to convert

IJ2_image: an image of type Dataset
IJ2_region: a list of Iterable region


Retrieves the pixel size of the input image

pixelSize = cip.spacing( inputImage* )

inputImage* : the image process
pixelSize : a list of scalars representing the input image pixel size along each image dimension


Retrieves the units of the input image

units = cip.unit( inputImage* )

inputImage* : the image to process
units : a list of string representing the input image unit along each image dimension


Retrieves the axes names of the input image

axseName = cip.axes( inputImage* )

inputImage* : the image process
axesName : a list of string representing the input image axes names along each image dimension


utility functions creating a Java list of object from a list of object.

The function was created for a technical reason. In Jython passing a list to CIP function (i.e. a java function) can be wrongly interpreted causing problem down the line. To avoid that list(…) converts a list of object to a java list of object.

a list of scalar = cip.list( scalar1 , scalar2, ... )
a list of scalar = cip.list( [scalar1 , scalar2, ...] )
converts a list of scalar to a java list of scalars

`a list of scalar = cip.list( string1 , string2, ... )`  
`a list of scalar = cip.list( [string1 , string2, ...] )`  
converts a list of string to a java list of string