You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More and more functions work on labeled images in the codebase. Currently, these are
show_label_image
label_image_skeleton
thicken_skeleton
label_image_apply_mask
some methods of the Analysis class could also come here
in the analysis module and
Segmentation.save_image
Segmentation.save_array
in the segmentation module.
It is time to collect them in a class. We will call this class LabeledImage1 and it should have, at first thought, the following methods:
__init__(self, label_image)
find_skeleton
thicken_skeleton
apply_mask(self, mask, value)
change_label(self, old_labels, new_labels)
show(self, color='random', labels=False)2
save_png(self, filename)
save_numpy(self, filename)
_validate(label_image)
__str__(self)
and with the following data members:
n_label
Once the class has been created, deprecate the old functions and also mention this class creation principal as an example under the "Do not overuse classes" bullet point of the program design.
1 MATLAB calls it "label image". However, the word "label" is also a verb and we want to avoid the misunderstanding that we perform labeling as done in computer vision. We also prefer "labeled" to "labelled" as American English is used in the rest of CristalX. 2 Other values for the color parameter:
More and more functions work on labeled images in the codebase. Currently, these are
show_label_image
label_image_skeleton
thicken_skeleton
label_image_apply_mask
Analysis
class could also come herein the analysis module and
Segmentation.save_image
Segmentation.save_array
in the segmentation module.
It is time to collect them in a class. We will call this class
LabeledImage
1 and it should have, at first thought, the following methods:__init__
(self, label_image)find_skeleton
thicken_skeleton
apply_mask(self, mask, value)
change_label(self, old_labels, new_labels)
show(self, color='random', labels=False)
2save_png(self, filename)
save_numpy(self, filename)
_validate(label_image)
__str__(self)
and with the following data members:
n_label
Once the class has been created, deprecate the old functions and also mention this class creation principal as an example under the "Do not overuse classes" bullet point of the program design.
1 MATLAB calls it "label image". However, the word "label" is also a verb and we want to avoid the misunderstanding that we perform labeling as done in computer vision. We also prefer "labeled" to "labelled" as American English is used in the rest of CristalX.
2 Other values for the
color
parameter:'seeded_random'
, see Random colors for grains, but with a given seed #45'optimal'
, see Distinguishable colors for nearby labels in a label image #9The text was updated successfully, but these errors were encountered: