@@ -113,8 +113,48 @@ def evaluate(
113113
114114# --- Evaluator ---
115115class Evaluator :
116+ """
117+ A class that evaluates neuron reconstruction quality by computing a set of
118+ skeleton-based metrics.
119+
120+ Attributes
121+ ----------
122+ output_dir : str
123+ Directory where evaluation results will be saved.
124+ results_filename : str
125+ Filename (without extension) for the CSV report.
126+ verbose : bool
127+ Indication of whether to display progress bars and printout results.
128+ metrics : dict
129+ Core evaluation metrics mapping metric names to metric objects:
130+ - "# Splits": SplitCountMetric
131+ - "# Merges": MergeCountMetric
132+ - "% Split Edges": SplitEdgePercentMetric
133+ - "% Omit Edges": OmitEdgePercentMetric
134+ - "% Merged Edges": MergedEdgePercentMetric
135+ - "ERL": ERLMetric
136+ derived_metrics : dict
137+ Derived metrics computed from core metrics:
138+ - "Normalized ERL": NormalizedERLMetric
139+ - "Edge Accuracy": EdgeAccuracyMetric
140+ - "Split Rate": SplitRateMetric
141+ - "Merge Rate": MergeRateMetric
142+ """
116143
117144 def __init__ (self , output_dir , results_filename , verbose = True ):
145+ """
146+ Instantiates an Evaluator object.
147+
148+ Parameters
149+ ----------
150+ output_dir : str
151+ Directory where evaluation results will be saved.
152+ results_filename : str
153+ Filename (without extension) for the CSV report.
154+ verbose : bool, optional
155+ Indication of whether to display progress bars and printout
156+ results. Default is True.
157+ """
118158 # Instance attributes
119159 self .output_dir = output_dir
120160 self .results_filename = results_filename
@@ -140,6 +180,19 @@ def __init__(self, output_dir, results_filename, verbose=True):
140180
141181 # --- Core Routines ---
142182 def run (self , gt_graphs , fragment_graphs = None ):
183+ """
184+ Computes evaluation metrics for neuron reconstructions and saves a CSV
185+ report.
186+
187+ Parameters
188+ ----------
189+ gt_graphs : Dict[str, LabeledGraph]
190+ Graphs to be evaluated.
191+ fragment_graphs : Dict[str, FragmentsGraph], optional
192+ Graphs built from skeletons obtained from a segmentation. This
193+ parameter is required to compute the metric "# Merges". Default
194+ is None.
195+ """
143196 # Printout step
144197 if self .verbose :
145198 print ("\n (3) Compute Metrics" )
@@ -221,7 +274,8 @@ def report_summary(self, results):
221274 util .update_txt (path , f" # Merges: { n_merges } " , self .verbose )
222275
223276 # --- Writers ---
224- def save_fragments (self ):
277+ def save_fragments (self , gt_graphs , fragment_graphs ):
278+ assert fragment_graphs is not None
225279 pass
226280
227281 def save_merge_results (self , gt_graphs , fragment_graphs , output_dir ):
@@ -234,7 +288,7 @@ def save_merge_results(self, gt_graphs, fragment_graphs, output_dir):
234288 gt_graphs : Dict[str, LabeledGraph]
235289 Graphs built from ground truth SWC files.
236290 fragment_graphs : Dict[str, FragmentsGraph]
237- Graphs built from skeletons obtained from a predicted segmentation.
291+ Graphs built from skeletons obtained from a segmentation.
238292 output_dir : str
239293 Directory that results are written to.
240294 """
0 commit comments