-
-
Save anonymous/3a6b662b80db622a872c701d2b85db68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scanip_api import * | |
app = App.GetInstance() | |
class ThinObjectSmoother(Command): | |
def __init__(self, dilate, smooth, erode): | |
Command.__init__(self) | |
self.doc = App.GetDocument() | |
self.dilate = dilate | |
self.smooth = smooth | |
self.erode = erode | |
def GetName(self): | |
return "Special Smooth" | |
def OnNativeDelete(self): | |
self.doc.ReleaseCommand(self) | |
def Do(self): | |
App.GetDocument().ApplyDilateFilter(Doc.TargetMask, self.dilate, 0) | |
App.GetDocument().ApplyRecursiveGaussianFilter(Doc.TargetMask, True, Sigma(self.smooth)) | |
App.GetDocument().ApplyErodeFilter(Doc.TargetMask, self.erode, 0) | |
return True | |
class ThinObjectSmootherUserAction(UserAction): | |
def __init__(self, tab, group, name): | |
UserAction.__init__(self, tab, group, name) | |
def OnActivated(self): | |
App.GetDocument().SubmitCommand(ThinObjectSmoother(4, 4.5, 3)) | |
app.AddUserAction(ThinObjectSmootherUserAction( | |
"Image processing", | |
"Smoothing", | |
"Rib smoothing" | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment