-
Notifications
You must be signed in to change notification settings - Fork 3
Sourcery Starbot ⭐ refactored CsatiZoltan/GrainSegmentation #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,7 @@ class FilterImage(Median): | |
| def load(self, ips): | ||
| super().load(ips) | ||
| ips.data = DuplicateNoGUI.copy(ips, ips.title) # create a copy from the original image | ||
| ips.title = ips.title + '-filtered' # rename original image | ||
| ips.title = f'{ips.title}-filtered' | ||
| return True | ||
|
|
||
| def run(self, ips, snap, img, para = None): | ||
|
|
@@ -75,7 +75,10 @@ def run(self, ips, snap, img, para=None): | |
| storage.segment_mask = segment_mask | ||
| print(np.amax(segment_mask)) | ||
| # The final image is opened on a new tab | ||
| IPy.show_img([color.label2rgb(segment_mask, storage.original_image, kind='avg')], ips.title + '-segmented') | ||
| IPy.show_img( | ||
| [color.label2rgb(segment_mask, storage.original_image, kind='avg')], | ||
| f'{ips.title}-segmented', | ||
| ) | ||
|
Comment on lines
-78
to
+81
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
|
||
|
|
||
| class MergeClusters(RagThreshold): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,10 +117,7 @@ def initial_segmentation(self, *args): | |
| Label image, output of the quick shift algorithm. | ||
| """ | ||
|
|
||
| if args: | ||
| image = args[0] | ||
| else: | ||
| image = self.original_image | ||
| image = args[0] if args else self.original_image | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
| segment_mask = segmentation.quickshift(image) | ||
| if self.__interactive_mode: | ||
| io.imshow(color.label2rgb(segment_mask, self.original_image, kind='avg')) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
FilterImage.loadrefactored with the following changes:use-fstring-for-concatenation)This removes the following comments ( why? ):