Beispiel #1
0
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        self.DEBUG("EDPluginWaitMultiFile.process  global time-out is set to: %s (default value)" % (self.getTimeOut()))
        self.setTimeInit()
################################################################################
# Initialize the accumulator with the query
################################################################################
        xsdiAccumulator = XSDataInputAccumulator()
        xsdQuery = XSDataQuery()
        xsdQuery.setRemoveItems(XSDataBoolean(1))
        xsdQuery.setItem(self.listXsdStrings)
        xsdiAccumulator.setQuery([xsdQuery])
        edPluginAccumulator = self.loadPlugin(self.__strControlledPluginAccumulator)
        edPluginAccumulator.setDataInput(xsdiAccumulator)
        edPluginAccumulator.connectSUCCESS(self.doSuccessAccumulator)
        edPluginAccumulator.connectFAILURE(self.doFailureAccumulator)
        edPluginAccumulator.execute()

        for oneXSDImage in self.listXsdFiles:
            xsdiWaitFile = XSDataInputWaitFile()
            xsdiWaitFile.setExpectedFile(oneXSDImage)
            xsdiWaitFile.setExpectedSize(self.dataInput.expectedSize)
            xsdiWaitFile.setTimeOut(self.dataInput.timeOut)
            edPluginWaitFile = self.loadPlugin(self.__strControlledPluginWaitFile)
            edPluginWaitFile.setDataInput(xsdiWaitFile)
            edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
            edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
            edPluginWaitFile.execute()
 def testCheckParameters(self):
     xsDataInput = XSDataInputWaitFile()
     xsDataInput.setExpectedFile(XSDataFile(XSDataString("toto")))
     xsDataInput.setExpectedSize(XSDataInteger(10))
     edPluginWaitFile = self.createPlugin()
     edPluginWaitFile.setDataInput(xsDataInput)
     edPluginWaitFile.checkParameters()
Beispiel #3
0
 def testCheckParameters(self):
     xsDataInput = XSDataInputWaitFile()
     xsDataInput.setExpectedFile(XSDataFile(XSDataString("toto")))
     xsDataInput.setExpectedSize(XSDataInteger(10))
     edPluginWaitFile = self.createPlugin()
     edPluginWaitFile.setDataInput(xsDataInput)
     edPluginWaitFile.checkParameters()
 def preProcess(self, _edObject=None):
     """
     """
     EDPluginControl.preProcess(self)
     self.DEBUG("EDPluginControlReadImageHeaderv10.preProcess")
     # First determine the type of image
     xsDataInputReadImageHeader = self.getDataInput()
     xsDataFileImage = xsDataInputReadImageHeader.getImage()
     self.strFileImagePath = xsDataFileImage.getPath().getValue()
     # Plugin for waiting for files
     self.edPluginExecWaitFile = self.loadPlugin(self.strPluginExecWaitFile)
     xsDataInputWaitFile = XSDataInputWaitFile()
     xsDataInputWaitFile.setExpectedFile(XSDataFile(XSDataString(self.strFileImagePath)))
     xsDataInputWaitFile.setExpectedSize(XSDataInteger(100000))
     xsDataInputWaitFile.setTimeOut(XSDataTime(self.fWaitFileTimeOut))
     self.edPluginExecWaitFile.setDataInput(xsDataInputWaitFile)
    def process(self, _edObject=None):
        EDPluginControl.process(self)
        EDVerbose.DEBUG("EDPluginControlDiffractionCTv1_2.process")
#===============================================================================
# Wait File
#===============================================================================
        edPluginWaitFile = self.loadPlugin(self.strControlledPluginWait)
        xsdin = XSDataInputWaitFile()
        xsdin.setExpectedFile(self.xsDataFileInputImage)
        xsdin.setExpectedSize(XSDataInteger(self.iImageSize))
        edPluginWaitFile.setDataInput(xsdin)
        edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
        edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
        edPluginWaitFile.executeSynchronous()

#===============================================================================
# #ReadHeader
#===============================================================================

        edPluginReadHeader = self.loadPlugin(self.strControlledPluginReadHeader)
        # Set the input data for the read header plugin
        xsDataInputReadHeader = XSDataInputReadHeader()

        xsDataInputReadHeader.setInputFile(self.xsDataFileInputImage)
        edPluginReadHeader.setDataInput(xsDataInputReadHeader)

        edPluginReadHeader.connectSUCCESS(self.doSuccessReadHeader)
        edPluginReadHeader.connectFAILURE(self.doFailureReadHeader)

        edPluginReadHeader.executeSynchronous()

################################################################################
# Powder Integration
################################################################################

        self.edPluginPowderIntegration.connectSUCCESS(self.doSuccessPowderIntegration)
        self.edPluginPowderIntegration.connectFAILURE(self.doFailurePowderIntegration)
        self.edPluginPowderIntegration.executeSynchronous()


        self.edPluginHDF5MapSpectra.connectSUCCESS(self.doSuccessWriteSinogram)
        self.edPluginHDF5MapSpectra.connectFAILURE(self.doFailureWriteSinogram)
        self.edPluginHDF5MapSpectra.execute()

        self.edPluginExportAsciiPowder.connectSUCCESS(self.doSuccessExportAsciiPowder)
        self.edPluginExportAsciiPowder.connectFAILURE(self.doFailureExportAsciiPowder)
        self.edPluginExportAsciiPowder.execute()
Beispiel #6
0
 def preProcess(self, _edObject=None):
     """
     """
     EDPluginControl.preProcess(self)
     self.DEBUG("EDPluginControlReadImageHeaderv10.preProcess")
     # First determine the type of image
     xsDataInputReadImageHeader = self.getDataInput()
     xsDataFileImage = xsDataInputReadImageHeader.getImage()
     self.strFileImagePath = xsDataFileImage.getPath().getValue()
     # Plugin for waiting for files
     self.edPluginExecWaitFile = self.loadPlugin(self.strPluginExecWaitFile)
     xsDataInputWaitFile = XSDataInputWaitFile()
     xsDataInputWaitFile.setExpectedFile(
         XSDataFile(XSDataString(self.strFileImagePath)))
     xsDataInputWaitFile.setExpectedSize(XSDataInteger(100000))
     xsDataInputWaitFile.setTimeOut(XSDataTime(self.fWaitFileTimeOut))
     self.edPluginExecWaitFile.setDataInput(xsDataInputWaitFile)
 def process(self, _edObject=None):
     EDPluginControl.process(self)
     EDVerbose.DEBUG("EDPluginBioSaxsAsciiExportv1_0.process")
     xsdiWaitFile = XSDataInputWaitFile()
     xsdiWaitFile.setExpectedFile(XSDataFile(self.dataInput.integratedImage.path))
     xsdiWaitFile.setExpectedSize(XSDataInteger(8196))  # size of the header
     self.__edPluginWaitFile.setDataInput(xsdiWaitFile)
     self.__edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
     self.__edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
     self.__edPluginWaitFile.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsGetMetadata.connectSUCCESS(self.doSucessGetMetadata)
         self.__edPluginSaxsGetMetadata.connectFAILURE(self.doFailureGetMetadata)
         self.__edPluginSaxsGetMetadata.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsCurves.connectSUCCESS(self.doSuccessSaxsCurves)
         self.__edPluginSaxsCurves.connectFAILURE(self.doFailureSaxsCurves)
         self.__edPluginSaxsCurves.executeSynchronous()
 def process(self, _edObject=None):
     EDPluginControl.process(self)
     EDVerbose.DEBUG("EDPluginBioSaxsAsciiExportv1_1.process")
     xsdiWaitFile = XSDataInputWaitFile()
     xsdiWaitFile.setExpectedFile(XSDataFile(self.dataInput.integratedImage.path))
     xsdiWaitFile.setExpectedSize(XSDataInteger(8196)) #size of the header
     self.__edPluginWaitFile.setDataInput(xsdiWaitFile)
     self.__edPluginWaitFile.connectSUCCESS(self.doSuccessWaitFile)
     self.__edPluginWaitFile.connectFAILURE(self.doFailureWaitFile)
     self.__edPluginWaitFile.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsGetMetadata.connectSUCCESS(self.doSucessGetMetadata)
         self.__edPluginSaxsGetMetadata.connectFAILURE(self.doFailureGetMetadata)
         self.__edPluginSaxsGetMetadata.executeSynchronous()
     if not self.isFailure():
         self.__edPluginSaxsCurves.connectSUCCESS(self.doSuccessSaxsCurves)
         self.__edPluginSaxsCurves.connectFAILURE(self.doFailureSaxsCurves)
         self.__edPluginSaxsCurves.executeSynchronous()
Beispiel #9
0
 def preProcess(self, _edObject=None):
     EDPluginControl.preProcess(self)
     EDVerbose.DEBUG("EDPluginControlPyarchThumbnailGeneratorv1_0.preProcess")
     # Check that the input image exists and is of the expected type
     strPathToDiffractionImage = self.getDataInput().getDiffractionImage().getPath().getValue()
     strImageFileNameExtension = os.path.splitext(strPathToDiffractionImage)[1]
     if not strImageFileNameExtension in [".img", ".marccd", ".mccd", ".cbf"]:
         print strImageFileNameExtension
         EDVerbose.error("Unknown image file name extension for pyarch thumbnail generator: %s" % strPathToDiffractionImage)
         self.setFailure()
     else:
         # Load the waitFile plugin
         xsDataInputWaitFile = XSDataInputWaitFile()
         xsDataInputWaitFile.setExpectedSize(XSDataInteger(self.__iExpectedSize))
         xsDataInputWaitFile.setExpectedFile(self.getDataInput().getDiffractionImage())
         if self.getDataInput().getWaitForFileTimeOut():
             xsDataInputWaitFile.setTimeOut(self.getDataInput().getWaitForFileTimeOut())
         self.__edPluginWaitFile = EDPluginWaitFile()
         self.__edPluginWaitFile.setDataInput(xsDataInputWaitFile)
         # Load the execution plugin
         self.__edPluginExecThumbnail = self.loadPlugin(self.__strExecThumbnailPluginName)
         xsDataInputExecThumbnail = XSDataInputExecThumbnail()
         xsDataInputExecThumbnail.setInputImagePath(self.getDataInput().getDiffractionImage())
         xsDataInputExecThumbnail.setLevelsInvert(XSDataBoolean(True))
         xsDataInputExecThumbnail.setLevelsMin(XSDataDoubleWithUnit(0.0))
         xsDataDoubleWithUnitLevelsMax = XSDataDoubleWithUnit(99.95)
         xsDataDoubleWithUnitLevelsMax.setUnit(XSDataString("%"))
         xsDataInputExecThumbnail.setLevelsMax(xsDataDoubleWithUnitLevelsMax)
         xsDataInputExecThumbnail.setFilterDilatation([XSDataInteger(4)])
         xsDataInputExecThumbnail.setLevelsColorize(XSDataBoolean(False))
         xsDataInputExecThumbnail.setThumbHeight(XSDataInteger(1024))
         xsDataInputExecThumbnail.setThumbWidth(XSDataInteger(1024))
         xsDataInputExecThumbnail.setKeepRatio(XSDataBoolean(False))
         # Output path
         strImageNameWithoutExt = os.path.basename(os.path.splitext(strPathToDiffractionImage)[0])
         strImageDirname = os.path.dirname(strPathToDiffractionImage)
         if self.getDataInput().getForcedOutputDirectory():
             strForcedOutputDirectory = self.getDataInput().getForcedOutputDirectory().getPath().getValue()
             if not os.access(strForcedOutputDirectory, os.W_OK):
                 EDVerbose.error("Cannot write to forced output directory : %s" % strForcedOutputDirectory)
                 self.setFailure()
             else:
                 self.strOutputPathWithoutExtension = os.path.join(strForcedOutputDirectory, strImageNameWithoutExt)
         else:
             # Try to store in the ESRF pyarch directory
             strOutputDirname = EDHandlerESRFPyarchv1_0.createPyarchFilePath(strImageDirname)
             # Check that output pyarch path exists and is writeable:
             bIsOk = False
             if strOutputDirname:
                 if not os.path.exists(strOutputDirname):
                     # Try to create the directory
                     try:
                         os.makedirs(strOutputDirname)
                         bIsOk = True
                     except BaseException, e:
                         EDVerbose.WARNING("Couldn't create the directory %s" % strOutputDirname)
                 elif os.access(strOutputDirname, os.W_OK):
                     bIsOk = True
             if not bIsOk:
                 EDVerbose.warning("Cannot write to pyarch directory: %s" % strOutputDirname)
                 strOutputDirname = tempfile.mkdtemp("", "EDPluginPyarchThumbnailv10_", "/tmp")
                 EDVerbose.warning("Writing thumbnail images to: %s" % strOutputDirname)
             self.strOutputPathWithoutExtension = os.path.join(strOutputDirname, strImageNameWithoutExt)
         self.strOutputPath = os.path.join(self.strOutputPathWithoutExtension + ".jpeg")
         xsDataInputExecThumbnail.setOutputPath(XSDataFile(XSDataString(self.strOutputPath)))
         self.__edPluginExecThumbnail.setDataInput(xsDataInputExecThumbnail)
    def process(self, _edPlugin=None):
        """
        Executes the execution plugins
        """
        EDPluginControl.process(self, _edPlugin)
        EDVerbose.DEBUG("EDPluginControlImageQualityIndicatorsv1_2.process")
        EDUtilsParallel.initializeNbThread()
        # Check if we should do indexing:
        bDoIndexing = False
        if self.dataInput.doIndexing is not None:
            if self.dataInput.doIndexing.value:
                bDoIndexing = True
        # Loop through all the incoming reference images
        listXSDataImage = self.dataInput.image
        xsDataInputWaitFile = XSDataInputWaitFile()
        self.xsDataResultControlImageQualityIndicators = XSDataResultControlImageQualityIndicators(
        )
        listPlugin = []
        for xsDataImage in listXSDataImage:
            if not os.path.exists(xsDataImage.path.value):
                self.screen("Waiting for image %s" % xsDataImage.path.value)
                self.edPluginWaitFile = self.loadPlugin(
                    self.strPluginWaitFileName)
                xsDataInputWaitFile.expectedFile = XSDataFile(xsDataImage.path)
                xsDataInputWaitFile.setExpectedSize(XSDataInteger(100000))
                xsDataInputWaitFile.setTimeOut(
                    XSDataTime(self.fWaitFileTimeOut))
                self.DEBUG("Wait file timeOut set to %f" %
                           self.fWaitFileTimeOut)
                self.edPluginWaitFile.setDataInput(xsDataInputWaitFile)
                self.edPluginWaitFile.executeSynchronous()
            if not os.path.exists(xsDataImage.path.value):
                strError = "Time-out while waiting for image %s" % xsDataImage.path.value
                self.error(strError)
                self.addErrorMessage(strError)
                self.setFailure()
            else:
                if self.bUseThinClient:
                    strPluginName = self.strPluginNameThinClient
                else:
                    strPluginName = self.strPluginName
                edPluginPluginExecImageQualityIndicator = self.loadPlugin(
                    strPluginName)
                listPlugin.append(edPluginPluginExecImageQualityIndicator)
                self.listPluginExecImageQualityIndicator.append(
                    edPluginPluginExecImageQualityIndicator)
                xsDataInputDistlSignalStrength = XSDataInputDistlSignalStrength(
                )
                xsDataInputDistlSignalStrength.setReferenceImage(xsDataImage)
                edPluginPluginExecImageQualityIndicator.setDataInput(
                    xsDataInputDistlSignalStrength)
                edPluginPluginExecImageQualityIndicator.execute()
        listIndexing = []
        # Synchronize all image quality indicator plugins and upload to ISPyB
        xsDataInputStoreListOfImageQualityIndicators = XSDataInputStoreListOfImageQualityIndicators(
        )
        for edPluginPluginExecImageQualityIndicator in listPlugin:
            edPluginPluginExecImageQualityIndicator.synchronize()
            xsDataImageQualityIndicators = XSDataImageQualityIndicators.parseString( \
                                             edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators.marshal())
            self.xsDataResultControlImageQualityIndicators.addImageQualityIndicators(
                xsDataImageQualityIndicators)
            xsDataISPyBImageQualityIndicators = \
                XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal())
            xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(
                xsDataISPyBImageQualityIndicators)
#        print xsDataInputStoreListOfImageQualityIndicators.marshal()
        self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName)
        self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators
        self.edPluginISPyB.execute()
        #
        if bDoIndexing:
            # Find the 5 most intensive images (TIS):
            listImage = []
            listSorted = sorted(
                self.xsDataResultControlImageQualityIndicators.
                imageQualityIndicators,
                key=lambda imageQualityIndicators: imageQualityIndicators.
                totalIntegratedSignal.value)
            for xsDataResultControlImageQualityIndicator in listSorted[-5:]:
                if xsDataResultControlImageQualityIndicator.goodBraggCandidates.value > 30:
                    xsDataInputReadImageHeader = XSDataInputReadImageHeader()
                    xsDataInputReadImageHeader.image = XSDataFile(
                        xsDataResultControlImageQualityIndicator.image.path)
                    self.edPluginReadImageHeader = self.loadPlugin(
                        self.strPluginReadImageHeaderName)
                    self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader
                    self.edPluginReadImageHeader.executeSynchronous()
                    xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput
                    if xsDataResultReadImageHeader is not None:
                        xsDataSubWedge = xsDataResultReadImageHeader.subWedge
                        self.xsDataCollection = XSDataCollection()
                        self.xsDataCollection.addSubWedge(xsDataSubWedge)
                        xsDataIndexingInput = XSDataIndexingInput()
                        xsDataIndexingInput.setDataCollection(
                            self.xsDataCollection)
                        xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(
                            xsDataIndexingInput)
                        edPluginMOSFLMIndexing = self.loadPlugin(
                            self.strIndexingMOSFLMPluginName)
                        self.listPluginMOSFLM.append([
                            edPluginMOSFLMIndexing,
                            xsDataResultControlImageQualityIndicator
                        ])
                        edPluginMOSFLMIndexing.setDataInput(
                            xsDataMOSFLMIndexingInput)
                        edPluginMOSFLMIndexing.execute()
            for tupleMOSFLM in self.listPluginMOSFLM:
                edPluginMOSFLMIndexing = tupleMOSFLM[0]
                xsDataResultControlImageQualityIndicator = tupleMOSFLM[1]
                edPluginMOSFLMIndexing.synchronize()
                if not edPluginMOSFLMIndexing.isFailure():
                    xsDataMOSFLMOutput = edPluginMOSFLMIndexing.dataOutput
                    xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(
                        xsDataMOSFLMOutput)
                    selectedSolution = xsDataIndexingResult.selectedSolution
                    if selectedSolution is not None:
                        xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution
    def process(self, _edPlugin=None):
        """
        Executes the execution plugins
        """
        EDPluginControl.process(self, _edPlugin)
        EDVerbose.DEBUG("EDPluginControlImageQualityIndicatorsv1_3.process")
        EDUtilsParallel.initializeNbThread()
        # Check if we should do indexing:
        bDoIndexing = False
        if self.dataInput.doIndexing is not None:
            if self.dataInput.doIndexing.value:
                 bDoIndexing = True
        # Loop through all the incoming reference images
        listXSDataImage = self.dataInput.image
        xsDataInputWaitFile = XSDataInputWaitFile()
        self.xsDataResultControlImageQualityIndicators = XSDataResultControlImageQualityIndicators()
        listPlugin = []
        for xsDataImage in listXSDataImage:
            if not os.path.exists(xsDataImage.path.value):
                self.screen("Waiting for image %s" % xsDataImage.path.value)
                self.edPluginWaitFile = self.loadPlugin(self.strPluginWaitFileName)
                xsDataInputWaitFile.expectedFile = XSDataFile(xsDataImage.path)
                xsDataInputWaitFile.setExpectedSize(XSDataInteger(100000))
                xsDataInputWaitFile.setTimeOut(XSDataTime(self.fWaitFileTimeOut))
                self.DEBUG("Wait file timeOut set to %f" % self.fWaitFileTimeOut)
                self.edPluginWaitFile.setDataInput(xsDataInputWaitFile)
                self.edPluginWaitFile.executeSynchronous()
            if not os.path.exists(xsDataImage.path.value):
                strError = "Time-out while waiting for image %s" % xsDataImage.path.value
                self.error(strError)
                self.addErrorMessage(strError)
                self.setFailure()
            else:
                if self.bUseThinClient:
                    strPluginName = self.strPluginNameThinClient
                else:
                    strPluginName = self.strPluginName
                edPluginPluginExecImageQualityIndicator = self.loadPlugin(strPluginName)
                self.listPluginExecImageQualityIndicator.append(edPluginPluginExecImageQualityIndicator)
                xsDataInputDistlSignalStrength = XSDataInputDistlSignalStrength()
                xsDataInputDistlSignalStrength.setReferenceImage(xsDataImage)
                edPluginPluginExecImageQualityIndicator.setDataInput(xsDataInputDistlSignalStrength)
                edPluginPluginExecImageQualityIndicator.execute()
                edPluginControlBackground3D = self.loadPlugin(self.strPluginNameControlBackground3D)
                listPlugin.append([edPluginPluginExecImageQualityIndicator, edPluginControlBackground3D])
                xsDataInputControlBackground3D = XSDataInputControlBackground3D()
                xsDataInputControlBackground3D.addImage(XSDataFile(xsDataImage.path))
                edPluginControlBackground3D.dataInput = xsDataInputControlBackground3D
                edPluginControlBackground3D.execute()
        listIndexing = []
        # Synchronize all image quality indicator plugins and upload to ISPyB
        xsDataInputStoreListOfImageQualityIndicators = XSDataInputStoreListOfImageQualityIndicators()
        for pluginPair in listPlugin:
            edPluginPluginExecImageQualityIndicator = pluginPair[0]
            edPluginControlBackground3D = pluginPair[1]
            edPluginPluginExecImageQualityIndicator.synchronize()
            edPluginControlBackground3D.synchronize()
            xsDataImageQualityIndicators = XSDataImageQualityIndicators.parseString(\
                                             edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators.marshal())
            if edPluginControlBackground3D.dataOutput.imageBackground != []:
                xsDataImageQualityIndicators.background3D_estimate = edPluginControlBackground3D.dataOutput.imageBackground[0].estimate
            self.xsDataResultControlImageQualityIndicators.addImageQualityIndicators(xsDataImageQualityIndicators)
            xsDataISPyBImageQualityIndicators = \
                XSDataISPyBImageQualityIndicators.parseString(xsDataImageQualityIndicators.marshal())
            xsDataInputStoreListOfImageQualityIndicators.addImageQualityIndicators(xsDataISPyBImageQualityIndicators)
#        print xsDataInputStoreListOfImageQualityIndicators.marshal()
        if self.dataInput.doUploadToIspyb is not None and self.dataInput.doUploadToIspyb.value:
            self.edPluginISPyB = self.loadPlugin(self.strISPyBPluginName)
            self.edPluginISPyB.dataInput = xsDataInputStoreListOfImageQualityIndicators
            self.edPluginISPyB.execute()
        #
        if bDoIndexing:
            # Find the 5 most intensive images (TIS):
            listImage = []
            # Check that we have background3D_estimate from all images:
            has_background3D_estimate = True
            for imageQualityIndicators in self.xsDataResultControlImageQualityIndicators.imageQualityIndicators:
                if imageQualityIndicators.background3D_estimate is None:
                    has_background3D_estimate = False
            if has_background3D_estimate:
                listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators,
                                    key=lambda imageQualityIndicators: imageQualityIndicators.background3D_estimate.value)
            else:
                listSorted = sorted(self.xsDataResultControlImageQualityIndicators.imageQualityIndicators,
                                    key=lambda imageQualityIndicators: imageQualityIndicators.totalIntegratedSignal.value)
            for xsDataResultControlImageQualityIndicator in listSorted[-5:]:
                if xsDataResultControlImageQualityIndicator.goodBraggCandidates.value > 30:
                    xsDataInputReadImageHeader = XSDataInputReadImageHeader()
                    xsDataInputReadImageHeader.image = XSDataFile(xsDataResultControlImageQualityIndicator.image.path)
                    self.edPluginReadImageHeader = self.loadPlugin(self.strPluginReadImageHeaderName)
                    self.edPluginReadImageHeader.dataInput = xsDataInputReadImageHeader
                    self.edPluginReadImageHeader.executeSynchronous()
                    xsDataResultReadImageHeader = self.edPluginReadImageHeader.dataOutput
                    if xsDataResultReadImageHeader is not None:
                        xsDataSubWedge = xsDataResultReadImageHeader.subWedge
                        self.xsDataCollection = XSDataCollection()
                        self.xsDataCollection.addSubWedge(xsDataSubWedge)
                        xsDataIndexingInput = XSDataIndexingInput()
                        xsDataIndexingInput.setDataCollection(self.xsDataCollection)
                        xsDataMOSFLMIndexingInput = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIndexing(xsDataIndexingInput)
                        edPluginMOSFLMIndexing = self.loadPlugin(self.strIndexingMOSFLMPluginName)
                        self.listPluginMOSFLM.append([edPluginMOSFLMIndexing, xsDataResultControlImageQualityIndicator])
                        edPluginMOSFLMIndexing.setDataInput(xsDataMOSFLMIndexingInput)
                        edPluginMOSFLMIndexing.execute()
            for tupleMOSFLM in self.listPluginMOSFLM:
                edPluginMOSFLMIndexing = tupleMOSFLM[0]
                xsDataResultControlImageQualityIndicator = tupleMOSFLM[1]
                edPluginMOSFLMIndexing.synchronize()
                if not edPluginMOSFLMIndexing.isFailure():
                    xsDataMOSFLMOutput = edPluginMOSFLMIndexing.dataOutput
                    xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutput)
                    selectedSolution = xsDataIndexingResult.selectedSolution
                    if selectedSolution is not None:
                        xsDataResultControlImageQualityIndicator.selectedIndexingSolution = selectedSolution