Class MorphologicalSegmentation

java.lang.Object
inra.ijpb.plugins.MorphologicalSegmentation
All Implemented Interfaces:
ij.plugin.PlugIn

public class MorphologicalSegmentation
extends java.lang.Object
implements ij.plugin.PlugIn
Plugin to perform automatic segmentation of 2D and 3D images based on morphological operations, mainly extended minima and watershed transforms. References: [1] Soille, P., Morphological Image Analysis: Principles and Applications, Springer-Verlag, 1999, pp. 170-171.
Author:
Ignacio Arganda-Carreras
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  MorphologicalSegmentation.ResultMode
    enumeration of result modes
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String CREATE_IMAGE
    name of the macro method to show current segmentation result in a new window
    static java.lang.String MERGE_LABELS
    name of the macro method to merge selected labels
    static java.lang.String RUN_SEGMENTATION
    name of the macro method to segment the current image based on the current parameters
    static java.lang.String SET_DISPLAY
    name of the macro method to set the output display format
    static java.lang.String SET_GRADIENT_TYPE
    name of the macro method to set the gradient method
    static java.lang.String SET_INPUT_TYPE
    name of the macro method to set the input image type
    static java.lang.String SET_RADIUS
    name of the macro method to set the gradient radius
    static java.lang.String SHOW_GRADIENT
    name of the macro method to set the flag to show the gradient image
    static java.lang.String SHOW_RESULT_OVERLAY
    name of the macro method to toggle the current overlay
    static java.lang.String SHUFFLE_COLORS
    name of the macro method to shuffle color labels
  • Constructor Summary

    Constructors
    Constructor Description
    MorphologicalSegmentation()  
  • Method Summary

    Modifier and Type Method Description
    static void createResultImage()
    Show current result in a new image
    static void mergeLabels()
    Merge labels that are selected either by a freehand or a point ROI.
    static void record​(java.lang.String command, java.lang.String... args)
    Macro-record a specific command.
    void run​(java.lang.String arg0)  
    static void segment​(java.lang.String dynamic, java.lang.String calculateDams, java.lang.String connectivity)
    Segment current image (GUI needs to be running)
    static void segment​(java.lang.String dynamic, java.lang.String calculateDams, java.lang.String connectivity, java.lang.String usePriorityQueue)
    Deprecated.
    the priority queue method is now the only one
    static void setDisplayFormat​(java.lang.String format)
    Set the display format in the GUI
    static void setGradientRadius​(java.lang.String radius)
    Set the gradient radius
    static void setGradientType​(java.lang.String method)
    Set the gradient method to use
    static void setInputImageType​(java.lang.String type)
    Set input image type
    static void setShowGradient​(java.lang.String bool)
    Set GUI to show gradient image in the main canvas
    static void shuffleColors()
    Shuffle LUT of current display image.
    static void toggleOverlay()
    Toggle current result overlay image

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RUN_SEGMENTATION

      public static java.lang.String RUN_SEGMENTATION
      name of the macro method to segment the current image based on the current parameters
    • SHOW_RESULT_OVERLAY

      public static java.lang.String SHOW_RESULT_OVERLAY
      name of the macro method to toggle the current overlay
    • CREATE_IMAGE

      public static java.lang.String CREATE_IMAGE
      name of the macro method to show current segmentation result in a new window
    • SET_INPUT_TYPE

      public static java.lang.String SET_INPUT_TYPE
      name of the macro method to set the input image type
    • SHOW_GRADIENT

      public static java.lang.String SHOW_GRADIENT
      name of the macro method to set the flag to show the gradient image
    • SET_DISPLAY

      public static java.lang.String SET_DISPLAY
      name of the macro method to set the output display format
    • SET_RADIUS

      public static java.lang.String SET_RADIUS
      name of the macro method to set the gradient radius
    • SET_GRADIENT_TYPE

      public static java.lang.String SET_GRADIENT_TYPE
      name of the macro method to set the gradient method
    • MERGE_LABELS

      public static java.lang.String MERGE_LABELS
      name of the macro method to merge selected labels
    • SHUFFLE_COLORS

      public static java.lang.String SHUFFLE_COLORS
      name of the macro method to shuffle color labels
  • Constructor Details

    • MorphologicalSegmentation

      public MorphologicalSegmentation()
  • Method Details

    • run

      public void run​(java.lang.String arg0)
      Specified by:
      run in interface ij.plugin.PlugIn
    • record

      public static void record​(java.lang.String command, java.lang.String... args)
      Macro-record a specific command. The command names match the static methods that reproduce that part of the code.
      Parameters:
      command - name of the command including package info
      args - set of arguments for the command
    • segment

      public static void segment​(java.lang.String dynamic, java.lang.String calculateDams, java.lang.String connectivity, java.lang.String usePriorityQueue)
      Deprecated.
      the priority queue method is now the only one
      Segment current image (GUI needs to be running)
      Parameters:
      dynamic - string containing dynamic value (format: "dynamic=[integer value]")
      calculateDams - string containing boolean flag to create dams (format: "calculateDams=[boolean])
      connectivity - string containing connectivity value (format: "connectivity=[4 or 8 / 6 or 26])
      usePriorityQueue - string containing boolean flag to use priority queue (format: "usePriorityQueue=[boolean])
    • segment

      public static void segment​(java.lang.String dynamic, java.lang.String calculateDams, java.lang.String connectivity)
      Segment current image (GUI needs to be running)
      Parameters:
      dynamic - string containing dynamic value (format: "dynamic=[integer value]")
      calculateDams - string containing boolean flag to create dams (format: "calculateDams=[boolean])
      connectivity - string containing connectivity value (format: "connectivity=[4 or 8 / 6 or 26])
    • toggleOverlay

      public static void toggleOverlay()
      Toggle current result overlay image
    • mergeLabels

      public static void mergeLabels()
      Merge labels that are selected either by a freehand or a point ROI. Label of value 0 (watershed line) is skipped.
    • shuffleColors

      public static void shuffleColors()
      Shuffle LUT of current display image.
    • createResultImage

      public static void createResultImage()
      Show current result in a new image
    • setInputImageType

      public static void setInputImageType​(java.lang.String type)
      Set input image type
      Parameters:
      type - input image type (border or object)
    • setShowGradient

      public static void setShowGradient​(java.lang.String bool)
      Set GUI to show gradient image in the main canvas
      Parameters:
      bool - true to display gradient image and false to display input image
    • setDisplayFormat

      public static void setDisplayFormat​(java.lang.String format)
      Set the display format in the GUI
      Parameters:
      format - output mode ("Overlaid basins", "Overlaid dams", "Catchment basins", "Watershed lines")
    • setGradientRadius

      public static void setGradientRadius​(java.lang.String radius)
      Set the gradient radius
      Parameters:
      radius - gradient radius size (in pixels)
    • setGradientType

      public static void setGradientType​(java.lang.String method)
      Set the gradient method to use
      Parameters:
      method - name of the gradient method to use