51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
###################################################################################################
|
|
# Example of using ImageJ functionalities through ijutils.
|
|
###################################################################################################
|
|
|
|
from ijutils import *
|
|
import java.awt.Color as Color
|
|
|
|
import ch.psi.pshell.imaging.Filter as Filter
|
|
from ch.psi.pshell.imaging.Overlays import *
|
|
import ch.psi.pshell.imaging.Pen as Pen
|
|
|
|
|
|
class MyFilter(Filter):
|
|
def process(self, image, data):
|
|
ip = load_image(image)
|
|
(results_puck,output_puck) = detect_pucks(ip)
|
|
(results_samples,output_samples) = detect_samples(ip)
|
|
|
|
#op_const(output_samples, "add", 0)
|
|
|
|
#op_image(output_puck, output_samples, "xor")
|
|
#op_image(ip, output_puck, "xor")
|
|
print "----"
|
|
print output_puck.processor.getLut().getBytes()
|
|
print "***"
|
|
|
|
op_image(output_puck, output_samples, "and")
|
|
r,g,b = [0]*256,[0]*256,[0]*256
|
|
r,g,b = [],[],[]
|
|
for i in range(256):
|
|
r.append(0)
|
|
g.append(0)
|
|
b.append(i)
|
|
set_lut(output_puck, r, g, b)
|
|
|
|
|
|
#op_image(ip, output_puck, "or")
|
|
ip=output_puck
|
|
#invert(output_puck)
|
|
#invert(output_samples)
|
|
#op_const(output_puck, "multiply", 0.5)
|
|
#op_image(output_puck, output_samples, "or")
|
|
#op_image(ip, output_puck, "xor")
|
|
|
|
|
|
return ip.getBufferedImage()
|
|
|
|
#Setting the filter to a source
|
|
img.setFilter(MyFilter())
|
|
|