Skip to content

Commit dafed72

Browse files
ctruedenclaude
authored andcommitted
Document deviations and limits of the new segment and threshold ops
Record the watershed line conventions versus image.watershed and hWatershed, the clean-room origin and size limit of graph cut, the clean-room origin of the level set ops, and the size limit of RATS; rewrap overlong javadoc lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e936d27 commit dafed72

8 files changed

Lines changed: 41 additions & 17 deletions

File tree

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/graphCut/DefaultGraphCut.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
* fit. For other data terms, pass cost images to the
6767
* {@code segment.graphCut} op which takes them.
6868
* </p>
69+
* <p>
70+
* Implemented from the papers; the code of the Fiji Graph_Cut plugin was not
71+
* consulted. The graph is held in flat arrays, so the image is limited to
72+
* about 2<sup>31</sup> / (number of neighbors) pixels.
73+
* </p>
6974
*
7075
* @author Curtis Rueden
7176
* @author Claude Opus 5.5

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/graphCut/GraphCutCosts.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
* a pixel is foreground if and only if its foreground cost is lower than its
5959
* background cost.
6060
* </p>
61+
* <p>
62+
* Implemented from the papers; the code of the Fiji Graph_Cut plugin was not
63+
* consulted. The graph is held in flat arrays, so the image is limited to
64+
* about 2<sup>31</sup> / (number of neighbors) pixels.
65+
* </p>
6166
*
6267
* @author Curtis Rueden
6368
* @author Claude Opus 5.5

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/hwatershed/HWatershed.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
* at least {@code hMin} seed their own segment; lower peaks are merged into the
9191
* segment of their higher neighbor. Pixels below {@code threshold} are
9292
* background, and each segment can be restricted to the top
93-
* {@code peakFlooding} percent of its height above the threshold.
93+
* {@code peakFlooding} percent of its height above the threshold. Touching
94+
* segments are not separated by watershed lines (there is no option for
95+
* them, unlike in {@code segment.compactWatershed}).
9496
* </p>
9597
* <p>
9698
* To segment dark objects, invert the image first.

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/levelset/LevelSetFunction.java‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
* {@code phi_t = g (alpha kappa + c) |grad phi| + beta grad g . grad phi}. The
7272
* edge stopping function is {@code g = 1 / (1 + (|grad u_sigma| /
7373
* lambda)^2)}, where {@code u_sigma} is the image rescaled to [0, 1] and
74-
* smoothed by a
75-
* Gaussian of standard deviation {@code sigma} and {@code lambda} is a tenth
74+
* smoothed by a Gaussian of standard deviation {@code sigma} and
75+
* {@code lambda} is a tenth
7676
* of the largest gradient magnitude, so that {@code g} is close to 0 on the
7777
* strongest edges and to 1 in flat regions. The contour expands ({@code c >
7878
* 0}) or shrinks ({@code c < 0}) until it is stopped and attracted by
@@ -88,16 +88,19 @@
8888
* of the unit normals between adjacent pixels for the curvature (which thus
8989
* also removes isolated pixels). The time step is chosen for stability and,
9090
* for Chan-Vese, so that the contour moves by at most half a pixel per
91-
* iteration. Every five iterations, the level-set function is reinitialized to a signed distance function: pixels next
92-
* to the zero level set keep their sub-pixel distance estimate {@code phi /
93-
* |grad phi|}, and all others get the signed distance of the current mask.
91+
* iteration. Every five iterations, the level-set function is reinitialized
92+
* to a signed distance function: pixels next to the zero level set keep
93+
* their sub-pixel distance estimate {@code phi / |grad phi|}, and all others
94+
* get the signed distance of the current mask.
9495
* The evolution stops after {@code maxIterations} iterations, or earlier when,
9596
* between two reinitializations, at most {@code tolerance} times the number of
9697
* inside pixels have changed sides. The computation works in any number of
9798
* dimensions, with anisotropic calibration.
9899
* </p>
99100
* <p>
100-
* Both models are implemented from the cited papers. The level-set framework
101+
* Both models are implemented from the cited papers; the code of the Fiji
102+
* Level Sets plugin was not consulted, and its parameters do not carry over.
103+
* The level-set framework
101104
* is that of S. Osher and J. A. Sethian ("Fronts propagating with
102105
* curvature-dependent speed", <i>J. Comput. Phys.</i> 79(1): 12&ndash;49,
103106
* 1988).

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/levelset/LevelSetSegmentation.java‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
* {@code phi_t = g (alpha kappa + c) |grad phi| + beta grad g . grad phi}. The
7272
* edge stopping function is {@code g = 1 / (1 + (|grad u_sigma| /
7373
* lambda)^2)}, where {@code u_sigma} is the image rescaled to [0, 1] and
74-
* smoothed by a
75-
* Gaussian of standard deviation {@code sigma} and {@code lambda} is a tenth
74+
* smoothed by a Gaussian of standard deviation {@code sigma} and
75+
* {@code lambda} is a tenth
7676
* of the largest gradient magnitude, so that {@code g} is close to 0 on the
7777
* strongest edges and to 1 in flat regions. The contour expands ({@code c >
7878
* 0}) or shrinks ({@code c < 0}) until it is stopped and attracted by
@@ -88,16 +88,19 @@
8888
* of the unit normals between adjacent pixels for the curvature (which thus
8989
* also removes isolated pixels). The time step is chosen for stability and,
9090
* for Chan-Vese, so that the contour moves by at most half a pixel per
91-
* iteration. Every five iterations, the level-set function is reinitialized to a signed distance function: pixels next
92-
* to the zero level set keep their sub-pixel distance estimate {@code phi /
93-
* |grad phi|}, and all others get the signed distance of the current mask.
91+
* iteration. Every five iterations, the level-set function is reinitialized
92+
* to a signed distance function: pixels next to the zero level set keep
93+
* their sub-pixel distance estimate {@code phi / |grad phi|}, and all others
94+
* get the signed distance of the current mask.
9495
* The evolution stops after {@code maxIterations} iterations, or earlier when,
9596
* between two reinitializations, at most {@code tolerance} times the number of
9697
* inside pixels have changed sides. The computation works in any number of
9798
* dimensions, with anisotropic calibration.
9899
* </p>
99100
* <p>
100-
* Both models are implemented from the cited papers. The level-set framework
101+
* Both models are implemented from the cited papers; the code of the Fiji
102+
* Level Sets plugin was not consulted, and its parameters do not carry over.
103+
* The level-set framework
101104
* is that of S. Osher and J. A. Sethian ("Fronts propagating with
102105
* curvature-dependent speed", <i>J. Comput. Phys.</i> 79(1): 12&ndash;49,
103106
* 1988).

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/siox/SioxMasks.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
* with confidence 1 for foreground, 0 for background and 0.5 for unknown
5353
* samples. Unknown samples are classified by comparing their CIELAB color
5454
* to color signatures of the known background and foreground, followed by
55-
* smoothing and connected component filtering. The image may have any number of dimensions; the original
56-
* algorithm is 2D.
55+
* smoothing and connected component filtering. The image may have any number
56+
* of dimensions; the original algorithm is 2D.
5757
* </p>
5858
* <p>
5959
* SIOX is described in G. Friedland, K. Jantz and R. Rojas, "SIOX: Simple

‎scijava-ops-image/src/main/java/org/scijava/ops/image/segment/watershed/CompactWatershed.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@
6262
* Unlike {@code image.watershed}, which decides the label of a pixel only when
6363
* it is flooded, each queued pixel here carries the label (and marker pixel) of
6464
* the region which reached it, which is what makes a distance-dependent
65-
* priority possible.
65+
* priority possible. Also unlike {@code image.watershed}, which labels its
66+
* watershed lines -1 when drawing them and otherwise merges them into a
67+
* neighboring region, the lines are left unlabeled unless a
68+
* {@code watershedLabel} is given; the same holds for
69+
* {@code segment.extendedMinimaWatershed} and
70+
* {@code segment.distanceTransformWatershed}.
6671
* </p>
6772
*
6873
* @author Curtis Rueden

‎scijava-ops-image/src/main/java/org/scijava/ops/image/threshold/rats/RatsSurface.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
* </p>
104104
* <p>
105105
* NaN pixels are ignored: they contribute no edges and no noise samples, and
106-
* are never foreground.
106+
* are never foreground. The image is processed single-threaded in flat
107+
* arrays, so it is limited to 2<sup>31</sup> pixels.
107108
* </p>
108109
* <p>
109110
* This implementation was written from the general description of the

0 commit comments

Comments
 (0)