def generateXSDataInputLabelit(_xsDataIndexingInput):

        EDFactoryPluginStatic.loadModule("XSDataLabelitv10")
        from XSDataLabelitv10 import XSDataInputLabelit
        xsDataInputLabelit = XSDataInputLabelit()

        xsDataCollection = _xsDataIndexingInput.getDataCollection()
        xsDataSubWedgeList = xsDataCollection.getSubWedge()

        xsDataInputLabelit.addImage(xsDataSubWedgeList[0].getImage()[0])
        fPhiStartFirst = xsDataSubWedgeList[0].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue()

        if (len(xsDataSubWedgeList) > 1):

            xsDataImageSecond = xsDataSubWedgeList[-1].getImage()[0]
            fPhiStartSecond = xsDataSubWedgeList[-1].getExperimentalCondition().getGoniostat().getRotationAxisStart().getValue()

            # Add modulus!            
            if (abs(fPhiStartSecond - fPhiStartFirst) > 4):

                xsDataInputLabelit.addImage(xsDataImageSecond)

        return xsDataInputLabelit
 def testSetDataInput(self):
     """
     This method test the setDataInput method of the Labelit plugin by providing an XML string
     and then retriving an XSDataInputLabelit object.
     """
     edPluginLabelitv10 = self.createPlugin()
     xsPluginItemGood01 = self.getPluginConfiguration(os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml"))
     edPluginLabelitv10.setConfiguration(xsPluginItemGood01)
     edPluginLabelitv10.setScriptExecutable("cat")
     edPluginLabelitv10.configure()
     xmlInput = self.readAndParseFile(self.strReferenceInputFile)
     edPluginLabelitv10.setDataInput(xmlInput)
     xsDataInputLabelitReference = XSDataInputLabelit.parseString(xmlInput)
     xsDataIntegrationv10Input = edPluginLabelitv10.getDataInput()
     EDAssert.equal(xsDataInputLabelitReference.marshal(), xsDataIntegrationv10Input.marshal())
     self.cleanUp(edPluginLabelitv10)
 def testGenerateXSDataInputLabelit(self, _strFileNameXSDataIndexingInput_reference,
                                           _strFileNameXSDataLabelitInput_reference):
     """
     This method is testing the generation of the XSDataInputLabelit object given a XSDataIndexingInput object.
     """
     strPath = os.path.join(self.strDataPath, _strFileNameXSDataIndexingInput_reference)
     strXMLIndexingInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIndexingInput
     xsDataIndexingInput = XSDataIndexingInput.parseString(strXMLIndexingInput)
     from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10
     xsDataInputLabelit = EDHandlerXSDataLabelitv10.generateXSDataInputLabelit(xsDataIndexingInput)
     strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataLabelitInput_reference)
     strXMLInputLabelitReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataLabelitv10")
     from XSDataLabelitv10 import XSDataInputLabelit
     xsDataInputLabelitReference = XSDataInputLabelit.parseString(strXMLInputLabelitReference)
     EDAssert.equal(xsDataInputLabelitReference.marshal(), xsDataInputLabelit.marshal())
 def testSetDataInput(self):
     """
     This method test the setDataInput method of the Labelit plugin by providing an XML string
     and then retriving an XSDataInputLabelit object.
     """
     edPluginLabelitv10 = self.createPlugin()
     xsPluginItemGood01 = self.getPluginConfiguration(
         os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml"))
     edPluginLabelitv10.setConfiguration(xsPluginItemGood01)
     edPluginLabelitv10.setScriptExecutable("cat")
     edPluginLabelitv10.configure()
     xmlInput = self.readAndParseFile(self.strReferenceInputFile)
     edPluginLabelitv10.setDataInput(xmlInput)
     xsDataInputLabelitReference = XSDataInputLabelit.parseString(xmlInput)
     xsDataIntegrationv10Input = edPluginLabelitv10.getDataInput()
     EDAssert.equal(xsDataInputLabelitReference.marshal(),
                    xsDataIntegrationv10Input.marshal())
     self.cleanUp(edPluginLabelitv10)