Skip to content

Commit c273c85

Browse files
committed
Fix: Variable name matches function
1 parent 740caaa commit c273c85

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

flamingo_tools/segmentation/postprocessing.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def graph_connected_components(coords: dict, min_edge_distance: float, min_compo
324324
325325
Args:
326326
coords: Dictionary containing label IDs as keys and their position as value.
327-
min_edge_distance: Minimal edge distance between graph nodes to create an edge between nodes.
327+
min_edge_distance: Maximal edge distance between graph nodes to create an edge between nodes.
328328
min_component_length: Minimal length of nodes of connected component. Filtered out if lower.
329329
330330
Returns:
@@ -372,7 +372,7 @@ def components_sgn(
372372
keyword: Keyword of the dataframe column for erosion.
373373
threshold_erode: Threshold of column value after erosion step with spatial statistics.
374374
min_component_length: Minimal length for filtering out connected components.
375-
min_edge_distance: Minimal distance in micrometer between points to create edges for connected components.
375+
min_edge_distance: Maximal distance in micrometer between points to create edges for connected components.
376376
iterations_erode: Number of iterations for erosion, normally determined automatically.
377377
postprocess_threshold: Post-process graph connected components by searching for points closer than threshold.
378378
postprocess_components: Post-process specific graph connected components ([0] for largest component only).
@@ -460,7 +460,7 @@ def label_components_sgn(
460460
min_size: Minimal number of pixels for filtering small instances.
461461
threshold_erode: Threshold of column value after erosion step with spatial statistics.
462462
min_component_length: Minimal length for filtering out connected components.
463-
min_edge_distance: Minimal distance in micrometer between points to create edges for connected components.
463+
min_edge_distance: Maximal distance in micrometer between points to create edges for connected components.
464464
iterations_erode: Number of iterations for erosion, normally determined automatically.
465465
postprocess_threshold: Post-process graph connected components by searching for points closer than threshold.
466466
postprocess_components: Post-process specific graph connected components ([0] for largest component only).
@@ -506,7 +506,7 @@ def postprocess_sgn_seg(
506506
min_size: Minimal number of pixels for filtering small instances.
507507
threshold_erode: Threshold of column value after erosion step with spatial statistics.
508508
min_component_length: Minimal length for filtering out connected components.
509-
min_edge_distance: Minimal distance in micrometer between points to create edges for connected components.
509+
min_edge_distance: Maximal distance in micrometer between points to create edges for connected components.
510510
iterations_erode: Number of iterations for erosion, normally determined automatically.
511511
512512
Returns:
@@ -532,7 +532,7 @@ def components_ihc(
532532
Args:
533533
table: Dataframe of segmentation table.
534534
min_component_length: Minimal length for filtering out connected components.
535-
min_edge_distance: Minimal distance in micrometer between points to create edges for connected components.
535+
min_edge_distance: Maximal distance in micrometer between points to create edges for connected components.
536536
537537
Returns:
538538
Subgraph components as lists of label_ids of dataframe.
@@ -559,7 +559,7 @@ def label_components_ihc(
559559
table: Dataframe of segmentation table.
560560
min_size: Minimal number of pixels for filtering small instances.
561561
min_component_length: Minimal length for filtering out connected components.
562-
min_edge_distance: Minimal distance in micrometer between points to create edges for connected components.
562+
min_edge_distance: Maximal distance in micrometer between points to create edges for connected components.
563563
564564
Returns:
565565
List of component label for each point in dataframe. 0 - background, then in descending order of size
@@ -600,7 +600,7 @@ def postprocess_ihc_seg(
600600
table: Dataframe of segmentation table.
601601
min_size: Minimal number of pixels for filtering small instances.
602602
min_component_length: Minimal length for filtering out connected components.
603-
min_edge_distance: Minimal distance in micrometer between points to create edges for connected components.
603+
min_edge_distance: Maximal distance in micrometer between points to create edges for connected components.
604604
605605
Returns:
606606
Dataframe with component labels.

reproducibility/postprocess_sgn/SGN_v1_postprocess.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{
1313
"cochlea": "M_LR_000144_L",
1414
"image_channel": "PV_resized",
15-
"min_edge_distance": 70,
15+
"max_edge_distance": 70,
1616
"iterations_erode": 1,
1717
"unet_version": "v1"
1818
},

reproducibility/postprocess_sgn/repro_postprocess_sgn_v1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def repro_postprocess_sgn_v1(
1818
min_size = 1000
1919
default_threshold_erode = None
2020
default_min_length = 50
21-
default_min_edge_distance = 30
21+
default_max_edge_distance = 30
2222
default_iterations_erode = None
2323

2424
with open(ddict, 'r') as myfile:
@@ -36,18 +36,18 @@ def repro_postprocess_sgn_v1(
3636

3737
threshold_erode = dic["threshold_erode"] if "threshold_erode" in dic else default_threshold_erode
3838
min_component_length = dic["min_component_length"] if "min_component_length" in dic else default_min_length
39-
min_edge_distance = dic["min_edge_distance"] if "min_edge_distance" in dic else default_min_edge_distance
39+
max_edge_distance = dic["max_edge_distance"] if "max_edge_distance" in dic else default_max_edge_distance
4040
iterations_erode = dic["iterations_erode"] if "iterations_erode" in dic else default_iterations_erode
4141

4242
print("threshold_erode", threshold_erode)
4343
print("min_component_length", min_component_length)
44-
print("min_edge", min_edge_distance)
44+
print("max_edge", max_edge_distance)
4545
print("iterations_erode", iterations_erode)
4646

4747
tsv_table = postprocess_sgn_seg(table, min_size=min_size,
4848
threshold_erode=threshold_erode,
4949
min_component_length=min_component_length,
50-
min_edge_distance=min_edge_distance,
50+
max_edge_distance=max_edge_distance,
5151
iterations_erode=iterations_erode)
5252

5353
largest_comp = len(tsv_table[tsv_table["component_labels"] == 1])

scripts/prediction/postprocess_seg.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def main():
3737
help="Threshold for spatial statistics.")
3838
parser.add_argument("--min_component_length", type=int, default=50,
3939
help="Minimal length for filtering out connected components.")
40-
parser.add_argument("--min_edge_dist", type=float, default=30,
41-
help="Minimal distance in micrometer between points to create edges for connected components.")
40+
parser.add_argument("--max_edge_dist", type=float, default=30,
41+
help="Maximal distance in micrometer between points to create edges for connected components.")
4242
parser.add_argument("--iterations_erode", type=int, default=None,
4343
help="Number of iterations for erosion, normally determined automatically.")
4444

@@ -126,7 +126,7 @@ def create_spatial_statistics_dict(functions, keyword, options, threshold):
126126
if seg_path is None:
127127
post_table = postprocess_sgn_seg(
128128
tsv_table.copy(), min_size=args.min_size, threshold_erode=args.threshold,
129-
min_component_length=args.min_component_length, min_edge_distance=args.min_edge_dist,
129+
min_component_length=args.min_component_length, max_edge_distance=args.max_edge_dist,
130130
iterations_erode=args.iterations_erode,
131131
)
132132

0 commit comments

Comments
 (0)