37 lines
1007 B
Python
37 lines
1007 B
Python
import java.awt.Rectangle as Rectangle
|
|
from ijutils import *
|
|
|
|
|
|
def integrate_roi(source, x,y, w, h):
|
|
if source.data is None:
|
|
source.update()
|
|
roi = source.data.getRoi(Rectangle(x,y, w, h))
|
|
return sum(roi.integrateHorizontally(False))
|
|
|
|
|
|
|
|
class ImageRoi(ReadonlyRegisterBase):
|
|
def __init__(self, name, source, x,y, w, h):
|
|
ReadonlyRegisterBase.__init__(self, name)
|
|
self.source=source
|
|
self.roi = x,y, w, h
|
|
|
|
def doRead(self):
|
|
x,y, w, h = self.roi
|
|
return integrate_roi(self.source, x,y, w, h)
|
|
|
|
|
|
|
|
|
|
add_device(ImageRoi("Region1", image, 100, 50, 200, 100), True)
|
|
add_device(ImageRoi("Region2", image, 200, 350, 100, 50), True)
|
|
|
|
|
|
import ch.psi.pshell.data.ProviderCSV as ProviderCSV
|
|
ProviderCSV.setDefaultItemSeparator(" ")
|
|
#tscan((Region1, Region2), 10, 0.1, layout="table", provider = "csv")
|
|
|
|
print integrate_roi(image, 10, 50, 20, 10)
|
|
|
|
#save_image(resized, get_context().setup.expandPath("{images}/out.tif") ,"tiff")
|