Skip to content

Instantly share code, notes, and snippets.

@bogovicj
Last active June 14, 2019 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogovicj/2512688b85a57a62f6260da335408d6b to your computer and use it in GitHub Desktop.
Save bogovicj/2512688b85a57a62f6260da335408d6b to your computer and use it in GitHub Desktop.
#@ OpService ops
#@ UIService ui
#@ Dataset(label="Binary image") image
#@ Integer(label="Width of the structuring element", min=1, value=1) width
/*
* A Fiji script for applying a morphological opening using imageJ ops,
*/
import net.imglib2.type.numeric.integer.*;
import net.imglib2.algorithm.neighborhood.*;
shape = new DiamondShape( width )
result = ops.create().img( image, new UnsignedByteType())
ops.morphology().open( result, image, [ shape ] )
ui.show( result )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment