Record Class SomaUtils.SomaResult

java.lang.Object
java.lang.Record
sc.fiji.snt.tracing.auto.SomaUtils.SomaResult
Record Components:
center - Soma center in voxel coordinates (from findRoot or seed)
centroid - Mask centroid in voxel coordinates (may differ from center)
mask - Binary mask of soma region
contour - Boundary contour polygon
radius - Estimated soma radius (equivalent radius from area) in voxels
threshold - Threshold used for detection
zSlice - Z-slice where soma was detected (0-indexed), or -1 if 2D
spacingUnits - Spacing units (e.g., "µm", "pixels"), or null if unset
Enclosing class:
SomaUtils

public static record SomaUtils.SomaResult(long[] center, double[] centroid, net.imglib2.img.Img<net.imglib2.type.logic.BitType> mask, Polygon contour, double radius, double threshold, int zSlice, String spacingUnits) extends Record
Container for soma detection results.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SomaResult(long[] center, double[] centroid, net.imglib2.img.Img<net.imglib2.type.logic.BitType> mask, Polygon contour, double radius, double threshold, int zSlice, String spacingUnits)
    Creates an instance of a SomaResult record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    long[]
    Returns the value of the center record component.
    double[]
    Returns the value of the centroid record component.
    Returns the value of the contour record component.
    ij.gui.OvalRoi
    Creates a circular ROI using the estimated radius.
    ij.gui.PolygonRoi
    Creates a polygon ROI from the contour.
    ij.gui.PointRoi
    Creates a point ROI at the soma center.
    final boolean
    Indicates whether some other object is "equal to" this one.
    double
    Returns the soma area in voxels squared.
    int
    Returns the center X coordinate in voxels.
    int
    Returns the center Y coordinate in voxels.
    int
    Returns the center Z coordinate in voxels, or 0 if 2D.
    double
    Returns the estimated soma diameter in voxels.
    boolean
    Checks if a valid contour was extracted.
    final int
    Returns a hash code value for this object.
    boolean
    Returns true if spacing units are defined.
    net.imglib2.img.Img<net.imglib2.type.logic.BitType>
    Returns the value of the mask record component.
    double
    Returns the value of the radius record component.
    Returns the value of the spacingUnits record component.
    double
    Returns the value of the threshold record component.
    toPath(double[] spacing)
    Creates a single-node Path representing the soma.
    ij.gui.Roi
    toRoi(String outputType)
    Creates an ImageJ ROI of the specified type.
    ij.gui.Roi
    Creates an ImageJ ROI using the stored Z-slice position.
    Returns a string representation of this record class.
    int
    Returns the value of the zSlice record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SomaResult

      public SomaResult(long[] center, double[] centroid, net.imglib2.img.Img<net.imglib2.type.logic.BitType> mask, Polygon contour, double radius, double threshold, int zSlice, String spacingUnits)
      Creates an instance of a SomaResult record class.
      Parameters:
      center - the value for the center record component
      centroid - the value for the centroid record component
      mask - the value for the mask record component
      contour - the value for the contour record component
      radius - the value for the radius record component
      threshold - the value for the threshold record component
      zSlice - the value for the zSlice record component
      spacingUnits - the value for the spacingUnits record component
  • Method Details

    • hasContour

      public boolean hasContour()
      Checks if a valid contour was extracted.
      Returns:
      true if contour has at least 3 points
    • toRoi

      public ij.gui.Roi toRoi(String outputType)
      Creates an ImageJ ROI of the specified type.
      Parameters:
      outputType - one of SomaUtils.OUTPUT_POINT, SomaUtils.OUTPUT_CONTOUR, SomaUtils.OUTPUT_CIRCLE
      Returns:
      the ROI, never null (falls back to point if requested type unavailable)
    • toRoiAtDetectedZ

      public ij.gui.Roi toRoiAtDetectedZ(String outputType)
      Creates an ImageJ ROI using the stored Z-slice position.
      Parameters:
      outputType - one of SomaUtils.OUTPUT_POINT, SomaUtils.OUTPUT_CONTOUR, SomaUtils.OUTPUT_CIRCLE
      Returns:
      the ROI with Z position set (1-indexed), or no position if zSlice is -1
    • createPointRoi

      public ij.gui.PointRoi createPointRoi()
      Creates a point ROI at the soma center.
    • createCircleRoi

      public ij.gui.OvalRoi createCircleRoi()
      Creates a circular ROI using the estimated radius.
    • createContourRoi

      public ij.gui.PolygonRoi createContourRoi()
      Creates a polygon ROI from the contour.
      Returns:
      polygon ROI, or null if no valid contour
    • getCenterX

      public int getCenterX()
      Returns the center X coordinate in voxels.
    • getCenterY

      public int getCenterY()
      Returns the center Y coordinate in voxels.
    • getCenterZ

      public int getCenterZ()
      Returns the center Z coordinate in voxels, or 0 if 2D.
    • getDiameter

      public double getDiameter()
      Returns the estimated soma diameter in voxels.
    • getArea

      public double getArea()
      Returns the soma area in voxels squared.
    • toPath

      public Path toPath(double[] spacing)
      Creates a single-node Path representing the soma.
      Parameters:
      spacing - voxel spacing [x, y, z] for physical coordinates, or null for voxels
      Returns:
      a single-node soma path
    • hasSpacingUnits

      public boolean hasSpacingUnits()
      Returns true if spacing units are defined.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • center

      public long[] center()
      Returns the value of the center record component.
      Returns:
      the value of the center record component
    • centroid

      public double[] centroid()
      Returns the value of the centroid record component.
      Returns:
      the value of the centroid record component
    • mask

      public net.imglib2.img.Img<net.imglib2.type.logic.BitType> mask()
      Returns the value of the mask record component.
      Returns:
      the value of the mask record component
    • contour

      public Polygon contour()
      Returns the value of the contour record component.
      Returns:
      the value of the contour record component
    • radius

      public double radius()
      Returns the value of the radius record component.
      Returns:
      the value of the radius record component
    • threshold

      public double threshold()
      Returns the value of the threshold record component.
      Returns:
      the value of the threshold record component
    • zSlice

      public int zSlice()
      Returns the value of the zSlice record component.
      Returns:
      the value of the zSlice record component
    • spacingUnits

      public String spacingUnits()
      Returns the value of the spacingUnits record component.
      Returns:
      the value of the spacingUnits record component