This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at imagej.net.

CIP

CIP (ImageJ/Fiji)
Author Benoit Lombardot
Update site CIP
Maintainer Benoit Lombardot
File CIP update site
Source https://github.com/benoalo/CIP
Initial release January 2018
Category Scripting


CIP:
Figure 1: CIP is a simple toolbox to learn and prototype image analysis workflow in ImageJ. It hides ImageJ complexity while making it easy to combine ImageJ packages for more specific tasks.


CIP : Classic Image Processing

Classic Image Processing (CIP) is an image procesing toolbox which provides functions for scripting in ImageJ. Its principal goal is to facilitate image analysis workflow construction as well as to provide an accessible entry point to learn the programming of such workflow. CIP also has a specific focus on user experience which should appear clearly in the libraries main features:

  • Integration to ImageJ ecosystem: CIP can be easily used in combination other ImageJ1 and ImageJ2 plugins. For instance, it can process seamlessly all usual imageJ image type (ImagePlus, Dataset, ImgPlus, Img) wihtout requiring any conversion.
  • Discoverability of its functionnalities: CIP provides a complete user documentation that explain function usage, details their parameters and provides illustration. In order to allow an intuitive learning, function parameters can be named or made optionnal while similar functions will have similar signatures. For the same reason 2D and 3D images can be processed with the same functions.
  • Simplicity of use: Learning programming is demanding and CIP goal is to hide unecessary difficulty when one starts scripting. For instance CIP requires no class and package import. It Also uses only 3 main data types, Image, Region Table, to simplify data representation. Finally, CIP functions never modifies functions inputs so you always know what is happening to your data.
  • An essential set of tools: CIP gathers the 10% of tools that will get the job done, allowing one to go straight to the tool he needs. The function selected are also well adopted by the community to facilitate exchange and understanding. Finally, CIP provides basic visualisation and measure tools that are needed in every workflow.


Getting started

Installation

If you want to use CIP in ImageJ script editor, simply add the CIP update site to your imageJ installation (instruction to follow an update site) restart imagej, open the script editor and you are good to go. For inspiration, one can look at one of the example scripts.

If one would like to contribute or simply toy with the source code of the library, its source code and the instruction for the project set up in an IDE can be found on the project repository.

Documentation organisation

To build a script with CIP, follow one of the examples below or try one of the repository examples.

To get information on a function follow the link in the function table in the categories section or directly go to one of the category pages: Format, Filter, Math, Segment, Assess.

For information on the parameters, their type, whether they are optionnal or required and more one can consult the Parameters page.


Tools categories

Image analysis workflows require the user to perform stereotypic steps: enhance signal, define and characterize region, visualize and assess results. This recurring process allows to create one function per task and to organize these functions in categories with similar roles, input and output: Format, Filter, Segment, Math, Assess.

CIP generic pipeline.PNG
Figure 2: Many analysis workflow are composed of generic tasks.
  • Format: These functions are used to managed image data, combine them or reduce their dimensionnality. They take one or multiple image as input and return one image as output. These function will generally provide an ouput which size and/or dimensionality can be different from the input
  • Filter: filters act on image graylevel. They creates an output image the same size as the input. Filters are used to remove noise, filter out unwanted background or enhance feature of interest such as spots and lines.
  • Math operations and functions: These category gathers usual mathematical operations such as addition, subtraction or trigonometric functions for instance. They can be used with scalars, images or image and scalar in combination. When use with images the operation are applied pixel wise.
  • Segmentation: Segmentation functions allow to define regions in an image. Applied to an input image they create so called label image that defines the pixel where the object lays. Each region is attributed a particular label, an integer value, that can be used to retrieve the object later. Watershed, thresholding spot and line detection can be found here.
  • Assess: in that category are tools to facilitate data visualisation and measures that will be needed in every pipeline once the image processing is done.

Link to function user documentation are provided in the table below.

Filter Segmentation Format Math Assess Experimental
gauss threshold create add, sub measure track
erosion maxima duplicate mul, div show
dilation watershed slice cos, sin, tan region
opening label project acos, asin, atan toIJ1
closing min, max toIJ2
tophat pow, sqrt spacing
distance floor, ceil, round unit
median log, exp axes
invert sign, abs list
help

Script example

The following script shows how to segment 2d object in an image and visualize them. The workflow is illustrated in the Figure 3.

wiki_examples/2D_nuclei.py

#@ImagePlus img
#@CIP cip

# CIP example: a simple 2d cell measure. can be run with the image 
# 	2D_nuclei.tif available on the CIP repository
# Author: Benoit Lombardot

# crop the image
origin = cip.list(300,200)
size = cip.list(150,150)
img_dup = cip.duplicate(img , origin, size)

# filter and segment the nuclei
img_filt = cip.opening( img_dup , 5 )
img_seg  = cip.watershed( img_filt , 'threshold', 500 , 'hmin', 300)

# measure nuclei size
regions = cip.region(img_seg, 'nuclei')
measures  = cip.measure( regions , 'size')

# visualize intermediary steps
cip.show(img_dup)
cip.show(img_filt)
cip.show(img_seg, 'glasbey')

# visualize results 
cip.show(img_dup)
cip.show( regions, 'color', 'glasbey' )
 # show the region on current image
cip.show(measures)


CIP:
Figure 3: Example a workflow performing the cropping, filtering segmentation and visualisation of a 2D image. Raw data: Platynereis embryo, acquisition: Mette Handberg-Thorsager from Tomancak lab, MPI-CBG, Dresden in collaboration with Keller lab, HHMI - Janelia Research Campus


The following script shows a 3d nuclei segmentation and the measure and displau of nuclei size. The workflow is illustrated in the Figure 4.

wiki_examples/3D_nuclei_segmentation.py

#@ImagePlus img
#@Float blurRadius
#@CIP cip

# CIP example: a simple 3d cell measure. can be run with the image 
# 	3D_nuc_mem_full_DS.tif available on the CIP repository
# Author: Benoit Lombardot

# duplicate the nuclei channel
img_nuc = cip.slice( img , 'dimensions',2 , 'position',0 )

# blurring using the image pixel size
spacing = cip.spacing(img_nuc)
radii = [blurRadius/r for r in spacing]
img_blur = cip.gauss(img_nuc, cip.list(radii) )

# segmentation of the nuclei
threshold = cip.threshold(img_blur, 'moments', 'value')
img_seg = cip.label(img_blur, threshold )

# measure of nuclei size in image unit
regions = cip.region(img_seg, 'nuclei3D_')
measures  = cip.measure( regions , 'size')

# visualize intermediary step and measures
cip.show( img_nuc )
cip.show( img_blur )
cip.show( img_seg, 'glasbey_inverted' )
cip.show( measures )


CIP:
Figure 4: Example a workflow performing the cropping, filtering segmentation and visualisation of a 2D image. Raw data: Platynereis embryo, acquisition: Mette Handberg-Thorsager from Tomancak lab, MPI-CBG, Dresden in collaboration with Keller lab, HHMI - Janelia Research Campus


Development plan

This section provide the main development directions as well as a list of functions that we intend to implement per category

Filter Segmentation Format Math Assess
gradient skeleton concatenate logic operators
laplacian edge comparison operators
hessian
fillholes


Cite

History

  • 2017-12-20 : version 0.1.0 , first public version of CIP is made available on CIP update site. The package is still under development
  • 2018-01-29 : version 0.1.1 , add a help function
  • 2018-05-03 : version 0.1.2 , minimal backcompatible updates of a few functions signatures for consistency. cip.show( handle*, region*, ...) becomes cip.show(region*, handle, ...), if no handle is provided region are shown on the current image. Update parameter name for create, slice and show function.
  • 2018-05-28 : version 0.2.0 , tracking, watershed and maxima update
    • add an experimental cip.track function allowing to track regions in a list of labelmap. it uses trackmate LapTracker below the hood thus allowing splitting, merging and discontinous tracks. resulting track can be visualized with cip.show both in trackscheme or hyperstack viewer.
    • cip.watershed(img, threshold, ...) labeling is more consistant, each connected component (region) has a distinct label and region with height inferior to hMin are no displayed. This feature was added with ImgAlgo-0.1.1.jar
    • the multiscale maxima detection was debugged and now give consistant results. It works in 2d/3d and takes into account data anisotropy. As an experiment it is possible to return multiscale maxima detection as a list of measures. multiscale maxima debugging also occured in ImgAlgo-0.1.2.jar update.
    • corresponding documentation is on the work
  • 2018-06-11 : version 0.2.1 correct a regression that prevented the visualisation of 3d regions
  • 2018-06-19 : version 0.2.2 bug corrections
    • correct a bug in median measure
    • cip.project(...): change outputType parameter name to output
    • cip.project(...): correct a bug preventing to use output='both'