@@ -93,7 +93,7 @@ def load_groundtruth(self, swc_pointer, label_mask):
9393
9494 def load_fragments (self , swc_pointer , gt_graphs ):
9595 """
96- Load fragment graphs (predicted skeletons).
96+ Loads fragment graphs (predicted skeletons).
9797
9898 Parameters
9999 ----------
@@ -129,7 +129,7 @@ def load_fragments(self, swc_pointer, gt_graphs):
129129 # --- Helpers ---
130130 def get_all_node_labels (self , graphs ):
131131 """
132- Get the set of unique node labels across all given graphs.
132+ Gets the set of unique node labels across all given graphs.
133133
134134 Parameters
135135 ----------
@@ -138,7 +138,7 @@ def get_all_node_labels(self, graphs):
138138
139139 Returns
140140 -------
141- labels : Set[int]
141+ node_labels : Set[int]
142142 Unique node labels across all graphs.
143143 """
144144 node_labels = set ()
@@ -149,7 +149,7 @@ def get_all_node_labels(self, graphs):
149149
150150class GraphLoader :
151151 """
152- A class that builds a graphs from SWC files.
152+ A class that builds graphs from SWC files.
153153 """
154154
155155 def __init__ (
@@ -176,8 +176,8 @@ def __init__(
176176 label_mask : ImageReader, optional
177177 Predicted segmentation mask.
178178 selected_ids : Set[int], optional
179- Only SWC files with a name contained in this set are read.
180- Default is None.
179+ Only SWC files with a name contained in this set are read. Default
180+ is None.
181181 use_anisotropy : bool, optional
182182 Indication of whether coordinates in SWC files should be converted
183183 from physical to image coordinates using the given anisotropy.
@@ -210,7 +210,7 @@ def run(self, swc_pointer):
210210
211211 Returns
212212 -------
213- dict
213+ graphs : Dict[str, SkeletonGraph]
214214 Dictionary where the keys are unique identifiers (i.e. filenames
215215 of SWC files) and values are the corresponding SkeletonGraph.
216216 """
@@ -233,7 +233,7 @@ def _build_graphs_from_swcs(self, swc_pointer):
233233
234234 Returns
235235 -------
236- dict
236+ graphs : Dict[str, SkeletonGraph]
237237 Dictionary where the keys are unique identifiers (i.e. SWC
238238 filenames) and values are the corresponding SkeletonGraphs.
239239 """
@@ -243,11 +243,11 @@ def _build_graphs_from_swcs(self, swc_pointer):
243243 pbar = tqdm (total = len (swc_dicts ), desc = "Build Graphs" )
244244
245245 # Main
246- graph_dict = dict ()
246+ graphs = dict ()
247247 if len (swc_dicts ) > 10 ** 4 :
248248 while len (swc_dicts ) > 0 :
249249 swc_dict = swc_dicts .pop ()
250- graph_dict .update (self .to_graph (swc_dict ))
250+ graphs .update (self .to_graph (swc_dict ))
251251 if self .verbose :
252252 pbar .update (1 )
253253 else :
@@ -260,10 +260,10 @@ def _build_graphs_from_swcs(self, swc_pointer):
260260
261261 # Store results
262262 for process in as_completed (processes ):
263- graph_dict .update (process .result ())
263+ graphs .update (process .result ())
264264 if self .verbose :
265265 pbar .update (1 )
266- return graph_dict
266+ return graphs
267267
268268 def to_graph (self , swc_dict ):
269269 """
@@ -278,7 +278,7 @@ def to_graph(self, swc_dict):
278278
279279 Returns
280280 -------
281- SkeletonGraph
281+ Dict[str, SkeletonGraph]
282282 Graph built from an SWC file.
283283 """
284284 # Initialize graph
@@ -304,10 +304,10 @@ def _init_graph(self, swc_dict):
304304 swc_dict : dict
305305 Dictionary whose keys and values are the attribute names and
306306 values from an SWC file.
307-
307+
308308 Returns
309309 -------
310- SkeletonGraph
310+ graph : SkeletonGraph
311311 An initialized LabeledGraph or FragmentGraph instance with voxel
312312 data, filename, and node count set.
313313 """
@@ -399,7 +399,7 @@ def get_patch_labels(self, graph, nodes):
399399
400400 Returns
401401 -------
402- dict
402+ node_to_label : Dict[int, int]
403403 Dictionary that maps node IDs to their respective labels.
404404 """
405405 bbox = graph .get_bbox (nodes )
@@ -578,7 +578,7 @@ def build_labels_graph(self, connections_path):
578578
579579 Returns
580580 -------
581- LabeledGraph
581+ labels_graph : networkx.Graph
582582 Graph with nodes that represent labels and edges are based on the
583583 connections read from the "connections_path".
584584 """
@@ -627,14 +627,14 @@ def get_class(self, label):
627627
628628 Returns
629629 -------
630- List[int] or Set[int]
630+ List[int]
631631 Labels corresponding to the class.
632632 """
633633 return self .inverse_mapping [label ] if self .use_mapping () else [label ]
634634
635635 def use_mapping (self ):
636636 """
637- Check whether mappings have been initialized.
637+ Checks whether mappings have been initialized.
638638
639639 Returns
640640 -------
0 commit comments