From 874c5a7018e6ad3ee2e8c0caaac2bd2b345895bc Mon Sep 17 00:00:00 2001 From: Alexandre Gobbo Date: Wed, 30 Oct 2019 11:39:36 +0100 Subject: [PATCH] Script execution --- script/sim/eiger.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/script/sim/eiger.py b/script/sim/eiger.py index e69de29..6fd6e3f 100644 --- a/script/sim/eiger.py +++ b/script/sim/eiger.py @@ -0,0 +1,36 @@ +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")