Contributed Nodes

These are modules that are not central to the functioning of MorphoCut, but are nevertheless useful in its application context.

EcoTaxa

Read and write EcoTaxa archives.

EcoTaxa is a web application dedicated to the visual exploration and the taxonomic annotation of images that illustrate the beauty of planktonic biodiversity.”

morphocut.contrib.ecotaxa.EcotaxaReader(archive_fn, img_rank=1)[source]

Stream Read an archive of images and metadata that is importable to EcoTaxa.

Parameters
  • archive_fn (str, Variable) – Location of the archive file.

  • img_rank (int, Variable, or a tuple thereof, optional) – One or more image ranks.

Returns

(image, meta) – A tuple of image(s) and metadata.

To read multiple image ranks, provide a tuple of ints as img_rank. The first output will then be a tuple of images.

The TSV file needs at least an img_file_name column that provides the name of the image file. Other columns are read from meta.

The TSV file MAY contain a row of types after the header ("[f]" for numeric columns, "[t]" else).

Example

with Pipeline() as p:
    image, meta = EcotaxaReader("path/to/archive.zip")
p.transform_stream()
morphocut.contrib.ecotaxa.EcotaxaWriter(archive_fn, fnames_images, meta, meta_fn='ecotaxa_export.tsv', store_types=True)[source]

Create an archive of images and metadata that is importable to EcoTaxa.

Parameters
  • archive_fn (str) – Location of the output file.

  • fnames_images (Tuple, Variable, or a list thereof) – Tuple of (filename, image) or a list of such tuples. filename is the name in the archive. image is a NumPy array. The file extension has to be one of ".jpg", ".png" or ".gif" to meet the specifications of EcoTaxa.

  • meta (Mapping or Variable) – Metadata to store in the TSV file.

  • meta_fn (str, optional) – TSV file. Must start with ecotaxa.

  • store_types (bool, optional) – Whether to add a row with types after the header. Defaults to True, according to EcoTaxa’s specifications.

If multiple images are provided, image and image_name must be tuples of the same length.

The TSV file will have the following columns by default:

  • img_file_name: Name of the image file (including extension)

  • img_rank: Rank of image to be displayed. Starts at 1.

Other columns are read from meta.

Example

with Pipeline() as pipeline:
    image_fn = ...
    image = ImageReader(image_fn)
    meta = ... # Calculate some meta-data
    EcotaxaWriter("path/to/archive.zip", (image_fn, image), meta)
pipeline.transform_stream()

ZooProcess

Feature calculation like in ZooProcess.

Zooprocess is a suite of routines in ImageJ macro language for Plankton image analysis.

morphocut.contrib.zooprocess.CalculateZooProcessFeatures(regionprops, meta=None, prefix=None)[source]

Calculate descriptive features similar to ZooProcess using skimage.measure.regionprops().

Parameters
  • regionprops (RegionProperties or Variable) – RegionProperties instance returned by FindRegions.

  • meta (dict or Variable, optional) – Meta-data dictionary to update.

  • prefix (str or Variable, optional) – Prefix for all keys.

Example

with Pipeline() as p:
    image = ...
    mask = ...

    regionprops = FindRegions(mask, image)

    features = CalculateZooProcessFeatures(regionprops)
morphocut.contrib.zooprocess.regionprop2zooprocess(prop)[source]

Calculate zooprocess features from skimage regionprops.

Notes

  • date/time specify the time of the sampling, not of the processing.