def doSuccessGeneratePrediction(self, _edPlugin=None): self.DEBUG("EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction") self.retrieveSuccessMessages(_edPlugin, "EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction") if (self.__xsDataGeneratePredictionResult is None): self.__xsDataGeneratePredictionResult = XSDataGeneratePredictionResult() xsDataMOSFLMOutputGeneratePrediction = _edPlugin.getDataOutput() xsDataImage = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage() self.__xsDataGeneratePredictionResult.addPredictionImage(XSDataImage.parseString(xsDataImage.marshal()))
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) self.DEBUG("EDPluginControlGeneratePredictionv10.preProcess...") xsDataGeneratePredictionInput = self.getDataInput() xsDataSelectedIndexingSolution = xsDataGeneratePredictionInput.getSelectedIndexingSolution() xsDataExperimentalConditionRefined = xsDataSelectedIndexingSolution.getExperimentalConditionRefined() xsDataCollection = xsDataGeneratePredictionInput.getDataCollection() xsDataSubWedgeList = xsDataCollection.getSubWedge() # List containing instances of all the generate prediction plugins self.__listPluginGeneratePrediction = [] # Loop through all subwedges iIndex = 0 for xsDataSubWedge in xsDataSubWedgeList: xsDataImageList = xsDataSubWedge.getImage() # First find the lowest image number iLowestImageNumber = None for xsDataImage in xsDataImageList: iImageNumber = xsDataImage.getNumber().getValue() if (iLowestImageNumber is None): iLowestImageNumber = iImageNumber elif (iImageNumber < iLowestImageNumber): iLowestImageNumber = iImageNumber # Then loop through all images in a sub wedge for xsDataImage in xsDataImageList: iIndex += 1 edPluginGeneratePrediction = self.loadPlugin(self.__strPluginGeneratePredictionName, "%s-%02d" % (self.__strPluginGeneratePredictionName, iIndex)) xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setSelectedIndexingSolution(XSDataIndexingSolutionSelected.parseString(xsDataSelectedIndexingSolution.marshal())) xsDataCollectionNew = XSDataCollection() xsDataSubWedgeNew = XSDataSubWedge() xsDataSubWedgeNew.addImage(XSDataImage.parseString(xsDataImage.marshal())) xsDataSubWedgeNew.setExperimentalCondition(XSDataExperimentalCondition.parseString(xsDataSubWedge.getExperimentalCondition().marshal())) # We must modify the rotationOscillationStart for the new subwedge xsDataGoniostatNew = xsDataSubWedgeNew.getExperimentalCondition().getGoniostat() fGoniostatRotationAxisStart = xsDataGoniostatNew.getRotationAxisStart().getValue() fGonioStatOscillationRange = xsDataGoniostatNew.getOscillationWidth().getValue() iImageNumber = xsDataImage.getNumber().getValue() fGoniostatRotationAxisStartNew = fGoniostatRotationAxisStart + (iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange xsDataGoniostatNew.setRotationAxisStart(XSDataAngle(fGoniostatRotationAxisStartNew)) # xsDataCollectionNew.addSubWedge(xsDataSubWedgeNew) xsDataGeneratePredictionInput.setDataCollection(xsDataCollectionNew) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataMOSFLMInputGeneratePrediction = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputGeneratePrediction(xsDataGeneratePredictionInput) edPluginGeneratePrediction.setDataInput(xsDataMOSFLMInputGeneratePrediction) self.__listPluginGeneratePrediction.append(edPluginGeneratePrediction)
def generateListXSDataImageReference(_xsDataIndexingInput): listXSDataImageReference = [] xsDataCollection = _xsDataIndexingInput.getDataCollection() xsDataSubWedgeList = xsDataCollection.getSubWedge() xsDataImageFirst = xsDataSubWedgeList[0].getImage()[0] listXSDataImageReference.append(XSDataImage.parseString(xsDataImageFirst.marshal())) 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): listXSDataImageReference.append(XSDataImage.parseString(xsDataImageSecond.marshal())) return listXSDataImageReference
def doSuccessGeneratePrediction(self, _edPlugin=None): EDVerbose.DEBUG( "EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction") self.retrieveSuccessMessages( _edPlugin, "EDPluginControlGeneratePredictionv10.doSuccessGeneratePrediction") if (self.__xsDataGeneratePredictionResult is None): self.__xsDataGeneratePredictionResult = XSDataGeneratePredictionResult( ) xsDataMOSFLMOutputGeneratePrediction = _edPlugin.getDataOutput() xsDataImage = xsDataMOSFLMOutputGeneratePrediction.getPredictionImage() self.__xsDataGeneratePredictionResult.addPredictionImage( XSDataImage.parseString(xsDataImage.marshal()))
def generateImageList(self, _xsDataCollection): """ Make a list of all images in the subwedges """ self.verboseDebug("EDPluginControlIndexingIndicatorsv1_1.generateImageList") listImage = None if (_xsDataCollection is not None): listImage = [] xsDataSubWedgeList = _xsDataCollection.getSubWedge() for xsDataSubWedge in xsDataSubWedgeList: xsDataImageList = xsDataSubWedge.getImage() for xsDataImage in xsDataImageList: listImage.append(XSDataImage.parseString(xsDataImage.marshal())) return listImage
def generateImageList(self, _xsDataCollection): """ Make a list of all images in the subwedges """ self.verboseDebug("EDPluginControlIndexingv10.generateImageList") listImage = None if (_xsDataCollection is not None): listImage = [] xsDataSubWedgeList = _xsDataCollection.getSubWedge() for xsDataSubWedge in xsDataSubWedgeList: xsDataImageList = xsDataSubWedge.getImage() for xsDataImage in xsDataImageList: listImage.append(XSDataImage.parseString(xsDataImage.marshal())) return listImage
def testParseLabelitDistlOutput(self): """ This method test the parsing of the Labelit results in the log file. """ edPluginLabelitDistlv1_1 = self.createPlugin() strPathToLabelitLogText = os.path.join(self.getPluginTestsDataHome(), "labelit.distl_v116.log") strLabelitLogText = self.readAndParseFile(strPathToLabelitLogText) xsDataImageQualityIndicators = edPluginLabelitDistlv1_1.parseLabelitDistlOutput(strLabelitLogText) xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1) xsDataImage1 = XSDataImage.parseString(xmlInput1) xsDataImageQualityIndicators.setImage(xsDataImage1) strLabelitDistlOutputFile = os.path.join(self.getPluginTestsDataHome(), "XSDataImageQualityIndicators_reference.xml") strLabelitDistlOutputXML = self.readAndParseFile(strLabelitDistlOutputFile) from XSDataLabelitv1_1 import XSDataImageQualityIndicators xsDataImageQualityIndicatorsReference = XSDataImageQualityIndicators.parseString(strLabelitDistlOutputXML) EDAssert.equal(xsDataImageQualityIndicatorsReference.marshal(), xsDataImageQualityIndicators.marshal())
def testParseLabelitDistlOutput(self): """ This method test the parsing of the Labelit results in the log file. """ edPluginLabelitDistlv1_1 = self.createPlugin() strPathToLabelitLogText = os.path.join(self.getPluginTestsDataHome(), "labelit.distl_v116.log") strLabelitLogText = self.readAndParseFile(strPathToLabelitLogText) xsDataImageQualityIndicators = edPluginLabelitDistlv1_1.parseLabelitDistlOutput( strLabelitLogText) xmlInput1 = self.readAndParseFile(self.__strReferenceInputFile1) xsDataImage1 = XSDataImage.parseString(xmlInput1) xsDataImageQualityIndicators.setImage(xsDataImage1) strLabelitDistlOutputFile = os.path.join( self.getPluginTestsDataHome(), "XSDataImageQualityIndicators_reference.xml") strLabelitDistlOutputXML = self.readAndParseFile( strLabelitDistlOutputFile) from XSDataLabelitv1_1 import XSDataImageQualityIndicators xsDataImageQualityIndicatorsReference = XSDataImageQualityIndicators.parseString( strLabelitDistlOutputXML) EDAssert.equal(xsDataImageQualityIndicatorsReference.marshal(), xsDataImageQualityIndicators.marshal())
def preProcess(self, _edObject=None): """ Gets the Configuration Parameters, if found, overrides default parameters """ EDPluginControl.preProcess(self, _edObject) EDVerbose.DEBUG("EDPluginControlGeneratePredictionv10.preProcess...") xsDataGeneratePredictionInput = self.getDataInput() xsDataSelectedIndexingSolution = xsDataGeneratePredictionInput.getSelectedIndexingSolution( ) xsDataExperimentalConditionRefined = xsDataSelectedIndexingSolution.getExperimentalConditionRefined( ) xsDataCollection = xsDataGeneratePredictionInput.getDataCollection() xsDataSubWedgeList = xsDataCollection.getSubWedge() # List containing instances of all the generate prediction plugins self.__listPluginGeneratePrediction = [] # Loop through all subwedges iIndex = 0 for xsDataSubWedge in xsDataSubWedgeList: xsDataImageList = xsDataSubWedge.getImage() # First find the lowest image number iLowestImageNumber = None for xsDataImage in xsDataImageList: iImageNumber = xsDataImage.getNumber().getValue() if (iLowestImageNumber is None): iLowestImageNumber = iImageNumber elif (iImageNumber < iLowestImageNumber): iLowestImageNumber = iImageNumber # Then loop through all images in a sub wedge for xsDataImage in xsDataImageList: iIndex += 1 edPluginGeneratePrediction = self.loadPlugin( self.__strPluginGeneratePredictionName, "%s-%02d" % (self.__strPluginGeneratePredictionName, iIndex)) xsDataGeneratePredictionInput = XSDataGeneratePredictionInput() xsDataGeneratePredictionInput.setSelectedIndexingSolution( XSDataIndexingSolutionSelected.parseString( xsDataSelectedIndexingSolution.marshal())) xsDataCollectionNew = XSDataCollection() xsDataSubWedgeNew = XSDataSubWedge() xsDataSubWedgeNew.addImage( XSDataImage.parseString(xsDataImage.marshal())) xsDataSubWedgeNew.setExperimentalCondition( XSDataExperimentalCondition.parseString( xsDataSubWedge.getExperimentalCondition().marshal())) # We must modify the rotationOscillationStart for the new subwedge xsDataGoniostatNew = xsDataSubWedgeNew.getExperimentalCondition( ).getGoniostat() fGoniostatRotationAxisStart = xsDataGoniostatNew.getRotationAxisStart( ).getValue() fGonioStatOscillationRange = xsDataGoniostatNew.getOscillationWidth( ).getValue() iImageNumber = xsDataImage.getNumber().getValue() fGoniostatRotationAxisStartNew = fGoniostatRotationAxisStart + ( iImageNumber - iLowestImageNumber) * fGonioStatOscillationRange xsDataGoniostatNew.setRotationAxisStart( XSDataAngle(fGoniostatRotationAxisStartNew)) # xsDataCollectionNew.addSubWedge(xsDataSubWedgeNew) xsDataGeneratePredictionInput.setDataCollection( xsDataCollectionNew) from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10 xsDataMOSFLMInputGeneratePrediction = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputGeneratePrediction( xsDataGeneratePredictionInput) edPluginGeneratePrediction.setDataInput( xsDataMOSFLMInputGeneratePrediction) self.__listPluginGeneratePrediction.append( edPluginGeneratePrediction)