Skip to content
Snippets Groups Projects
Commit 408c9dad authored by Constantin Pape's avatar Constantin Pape
Browse files

Skip invalid labels in morphology computation instead of placeholder features

parent dd94a972
No related branches found
No related tags found
No related merge requests found
...@@ -198,7 +198,6 @@ def intensity_row_features(raw, mask): ...@@ -198,7 +198,6 @@ def intensity_row_features(raw, mask):
def morphology_features_for_label_range(table, ds, ds_raw, def morphology_features_for_label_range(table, ds, ds_raw,
scale_factor_seg, scale_factor_raw, scale_factor_seg, scale_factor_raw,
label_begin, label_end): label_begin, label_end):
n_features = 4 if ds_raw is None else 6
label_range = np.logical_and(table['label_id'] >= label_begin, table['label_id'] < label_end) label_range = np.logical_and(table['label_id'] >= label_begin, table['label_id'] < label_end)
sub_table = table.loc[label_range, :] sub_table = table.loc[label_range, :]
stats = [] stats = []
...@@ -213,8 +212,7 @@ def morphology_features_for_label_range(table, ds, ds_raw, ...@@ -213,8 +212,7 @@ def morphology_features_for_label_range(table, ds, ds_raw,
# foreground in the mask # foreground in the mask
seg_mask = seg == label_id seg_mask = seg == label_id
if seg_mask.sum() == 0: if seg_mask.sum() == 0:
result = [float(label_id)] + [0.] * n_features # if the seg mask is empty, we simply skip this label-id
stats.append(result)
continue continue
# compute the morphology features from the segmentation mask # compute the morphology features from the segmentation mask
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment