Package sc.fiji.snt.tracing.auto
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 regioncontour- Boundary contour polygonradius- Estimated soma radius (equivalent radius from area) in voxelsthreshold- Threshold used for detectionzSlice- Z-slice where soma was detected (0-indexed), or -1 if 2DspacingUnits- 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
ConstructorsConstructorDescriptionSomaResult(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 aSomaResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlong[]center()Returns the value of thecenterrecord component.double[]centroid()Returns the value of thecentroidrecord component.contour()Returns the value of thecontourrecord component.ij.gui.OvalRoiCreates a circular ROI using the estimated radius.ij.gui.PolygonRoiCreates a polygon ROI from the contour.ij.gui.PointRoiCreates a point ROI at the soma center.final booleanIndicates whether some other object is "equal to" this one.doublegetArea()Returns the soma area in voxels squared.intReturns the center X coordinate in voxels.intReturns the center Y coordinate in voxels.intReturns the center Z coordinate in voxels, or 0 if 2D.doubleReturns the estimated soma diameter in voxels.booleanChecks if a valid contour was extracted.final inthashCode()Returns a hash code value for this object.booleanReturns true if spacing units are defined.net.imglib2.img.Img<net.imglib2.type.logic.BitType> mask()Returns the value of themaskrecord component.doubleradius()Returns the value of theradiusrecord component.Returns the value of thespacingUnitsrecord component.doubleReturns the value of thethresholdrecord component.toPath(double[] spacing) Creates a single-node Path representing the soma.ij.gui.RoiCreates an ImageJ ROI of the specified type.ij.gui.RoitoRoiAtDetectedZ(String outputType) Creates an ImageJ ROI using the stored Z-slice position.toString()Returns a string representation of this record class.intzSlice()Returns the value of thezSlicerecord component.
-
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 aSomaResultrecord class.- Parameters:
center- the value for thecenterrecord componentcentroid- the value for thecentroidrecord componentmask- the value for themaskrecord componentcontour- the value for thecontourrecord componentradius- the value for theradiusrecord componentthreshold- the value for thethresholdrecord componentzSlice- the value for thezSlicerecord componentspacingUnits- the value for thespacingUnitsrecord component
-
-
Method Details
-
hasContour
public boolean hasContour()Checks if a valid contour was extracted.- Returns:
- true if contour has at least 3 points
-
toRoi
Creates an ImageJ ROI of the specified type.- Parameters:
outputType- one ofSomaUtils.OUTPUT_POINT,SomaUtils.OUTPUT_CONTOUR,SomaUtils.OUTPUT_CIRCLE- Returns:
- the ROI, never null (falls back to point if requested type unavailable)
-
toRoiAtDetectedZ
Creates an ImageJ ROI using the stored Z-slice position.- Parameters:
outputType- one ofSomaUtils.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
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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
center
public long[] center()Returns the value of thecenterrecord component.- Returns:
- the value of the
centerrecord component
-
centroid
public double[] centroid()Returns the value of thecentroidrecord component.- Returns:
- the value of the
centroidrecord component
-
mask
public net.imglib2.img.Img<net.imglib2.type.logic.BitType> mask()Returns the value of themaskrecord component.- Returns:
- the value of the
maskrecord component
-
contour
Returns the value of thecontourrecord component.- Returns:
- the value of the
contourrecord component
-
radius
public double radius()Returns the value of theradiusrecord component.- Returns:
- the value of the
radiusrecord component
-
threshold
public double threshold()Returns the value of thethresholdrecord component.- Returns:
- the value of the
thresholdrecord component
-
zSlice
public int zSlice()Returns the value of thezSlicerecord component.- Returns:
- the value of the
zSlicerecord component
-
spacingUnits
Returns the value of thespacingUnitsrecord component.- Returns:
- the value of the
spacingUnitsrecord component
-