Пример #1
0
    def postProcess(self, _edObject=None):
        EDPluginExec.postProcess(self)
        self.DEBUG("EDPluginExecShiftImagev1_0.postProcess")
        # Create some output data
        xsDataResult = XSDataResultShiftImage()
        if self.strOutputType is None:
            xsDataResult.setOutputArray(
                EDUtilsArray.arrayToXSData(self.npaImage))
        elif self.strOutputType == "file":
            image = edfimage(data=self.npaImage,
                             header={
                                 "Offset_1": self.tOffset[0],
                                 "Offset_2": self.tOffset[1],
                                 "Max_Offset": self.MAX_OFFSET_VALUE
                             })
            image.write(self.strOutputImage, force_type=self.npaImage.dtype)
            xsdimg = XSDataImageExt(path=XSDataString(self.strOutputImage))
            xsDataResult.outputImage = xsdimg
        elif self.strOutputType == "shared":
            EDShare[self.strOutputImage] = self.npaImage
            xsdimg = XSDataImageExt(shared=XSDataString(self.strOutputImage))
            xsDataResult.outputImage = xsdimg
        elif self.strOutputType == "array":
            xsdimg = XSDataImageExt(
                array=EDUtilsArray.arrayToXSData(self.npaImage))
            xsDataResult.outputImage = xsdimg

        self.setDataOutput(xsDataResult)
        self.npaImage = None
Пример #2
0
 def testExecute(self):
     """
     """
     self.run()
     plugin = self.getPlugin()
     strExpectedOutput = self.readAndParseFile(
         self.getReferenceDataOutputFile())
     EDVerbose.DEBUG("Checking obtained result...")
     xsDataResultReference = XSDataResultShiftImage.parseString(
         strExpectedOutput)
     xsDataResultObtained = plugin.getDataOutput()
     EDAssert.strAlmostEqual(xsDataResultReference.marshal(),
                             xsDataResultObtained.marshal(),
                             _fRelError=0.0,
                             _fAbsError=0.3,
                             _strComment="XML out are the same")
Пример #3
0
 def postProcess(self, _edObject=None):
     EDPluginExec.postProcess(self)
     EDVerbose.DEBUG("EDPluginExecShiftImagev1_0.postProcess")
     # Create some output data
     xsDataResult = XSDataResultShiftImage()
     if self.strOutputImage is None:
         #ArrayOutput
         xsDataResult.setOutputArray(
             EDUtilsArray.arrayToXSData(self.npaImage))
     else:
         image = edfimage(data=self.npaImage,
                          header={
                              "Offset_1": self.tOffset[0],
                              "Offset_2": self.tOffset[1]
                          })
         image.write(self.strOutputImage, force_type=self.npaImage.dtype)
         xsdimg = XSDataImageExt(path=XSDataString(self.strOutputImage))
         xsDataResult.setOutputImage(xsdimg)
     self.setDataOutput(xsDataResult)