Example #1
0
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        self.DEBUG("EDPluginControlStitchImagev1_0.process")
        for idx1, im1 in enumerate(self.lInputFiles[:-1]):
            for idx2, im2 in enumerate(self.lInputFiles[idx1 + 1:]):
                plugin = self.loadPlugin(self.__strControlledPluginMeasure)
                xsd = XSDataInputMeasureOffset()
                xsd.setImage([
                    XSDataImageExt(XSDataString(im1)),
                    XSDataImageExt(XSDataString(im2))
                ])
                xsd.setIndex(
                    [XSDataInteger(idx1),
                     XSDataInteger(idx2 + idx1 + 1)])
                xsd.setCenter(self.xCenter)
                xsd.setWidth(self.xWidth)
                plugin.setDataInput(xsd)
                plugin.connectSUCCESS(self.doSuccessExecMeasure)
                plugin.connectFAILURE(self.doFailureExecMeasure)
                plugin.execute()
        self.synchronizePlugins()
        d = (self.ndaDistance**2).sum(axis=-1).sum(axis=-1)
        ref = d.argmin()
        self.DEBUG("Offsets= %s\n Sum distances = %s\n using ref=%s " %
                   (self.ndaDistance, d, ref))
        pluginStitch = self.loadPlugin(self.__strControlledPluginStitch)
        xsdIn = XSDataInputStitchOffsetedImage(autoscale=self.xAutoscale,
                                               blending=self.xBlending,
                                               dummyValue=self.xDummy,
                                               outputImage=self.xOutFile,
                                               centerROI=self.xCenter,
                                               widthROI=self.xWidth,
                                               mask=self.xMask)
        xsdImgs = []
        for idx, img in enumerate(self.lInputFiles):
            offsetedImg = OffsetedImage(dummyValue=self.xDummy,
                                        deltaDummy=self.xDeltaDummy)
            offsetedImg.setOffset([
                XSDataDouble(self.ndaDistance[ref, idx, 0]),
                XSDataDouble(self.ndaDistance[ref, idx, 1])
            ])
            offsetedImg.setFile(file=XSDataImageExt(path=XSDataString(
                value=img)))

            xsdImgs.append(offsetedImg)
        xsdIn.setInputImages(xsdImgs)
        pluginStitch.setDataInput(xsdIn)
        pluginStitch.connectSUCCESS(self.doSuccessExecStitch)
        pluginStitch.connectFAILURE(self.doFailureExecStitch)
        pluginStitch.executeSynchronous()
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        self.DEBUG("EDPluginControlStitchImagev1_0.process")
        for idx1, im1 in enumerate(self.lInputFiles[:-1]):
            for idx2, im2 in enumerate(self.lInputFiles[idx1 + 1:]):
                plugin = self.loadPlugin(self.__strControlledPluginMeasure)
                xsd = XSDataInputMeasureOffset()
                xsd.setImage([XSDataImageExt(XSDataString(im1)), XSDataImageExt(XSDataString(im2))])
                xsd.setIndex([XSDataInteger(idx1), XSDataInteger(idx2 + idx1 + 1)])
                xsd.setCenter(self.xCenter)
                xsd.setWidth(self.xWidth)
                plugin.setDataInput(xsd)
                plugin.connectSUCCESS(self.doSuccessExecMeasure)
                plugin.connectFAILURE(self.doFailureExecMeasure)
                plugin.execute()
        self.synchronizePlugins()
        d = (self.ndaDistance ** 2).sum(axis= -1).sum(axis= -1)
        ref = d.argmin()
        self.DEBUG("Offsets= %s\n Sum distances = %s\n using ref=%s " % (self.ndaDistance, d, ref))
        pluginStitch = self.loadPlugin(self.__strControlledPluginStitch)
        xsdIn = XSDataInputStitchOffsetedImage(autoscale=self.xAutoscale,
                                               blending=self.xBlending,
                                               dummyValue=self.xDummy,
                                               outputImage=self.xOutFile,
                                               centerROI=self.xCenter,
                                               widthROI=self.xWidth,
                                               mask=self.xMask)
        xsdImgs = []
        for idx, img in  enumerate(self.lInputFiles):
            offsetedImg = OffsetedImage(dummyValue=self.xDummy, deltaDummy=self.xDeltaDummy)
            offsetedImg.setOffset([XSDataDouble(self.ndaDistance[ref, idx, 0]), XSDataDouble(self.ndaDistance[ref, idx, 1])])
            offsetedImg.setFile(file=XSDataImageExt(path=XSDataString(value=img)))

            xsdImgs.append(offsetedImg)
        xsdIn.setInputImages(xsdImgs)
        pluginStitch.setDataInput(xsdIn)
        pluginStitch.connectSUCCESS(self.doSuccessExecStitch)
        pluginStitch.connectFAILURE(self.doFailureExecStitch)
        pluginStitch.executeSynchronous()
Example #3
0
 def testCheckParameters(self):
     xsDataInput = XSDataInputStitchOffsetedImage()
     xsDataInput.setInputImages([OffsetedImage()])
     edPluginExecStitchOffsetedImage = self.createPlugin()
     edPluginExecStitchOffsetedImage.setDataInput(xsDataInput)
     edPluginExecStitchOffsetedImage.checkParameters()