Files
dev/script/image/image2.py
2018-04-17 12:05:48 +02:00

31 lines
1.0 KiB
Python
Executable File

###################################################################################################
# Demonstrate creation of an image filters and new source based on filter.
# Also demonstrate creation of image histogram and use of overlays.
###################################################################################################
import ch.psi.pshell.imaging.Filter as Filter
from ch.psi.pshell.imaging.Utils import *
from ch.psi.pshell.imaging.Overlays import *
import ch.psi.pshell.imaging.Pen as Pen
import net.imglib2.script.bufferedimage.BufferedImageImg as BufferedImageImg
class MyFilter(Filter):
def process(self, image, data):
im = BufferedImageImg(image)
global last
image = grayscale(image)
i=None
if last is not None:
i = sub(image,last, False)
i = rescale(i,100.0, 0, True)
i = add(i, last, True)
i = rescale(i,10.0, 0, True)
last = image
return i
#Setting the filter to a source
img.setFilter(MyFilter())