本文整理匯總了Python中XSDataCommon.XSDataImage.copy方法的典型用法代碼示例。如果您正苦於以下問題:Python XSDataImage.copy方法的具體用法?Python XSDataImage.copy怎麽用?Python XSDataImage.copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XSDataCommon.XSDataImage
的用法示例。
在下文中一共展示了XSDataImage.copy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: process
# 需要導入模塊: from XSDataCommon import XSDataImage [as 別名]
# 或者: from XSDataCommon.XSDataImage import copy [as 別名]
#.........這裏部分代碼省略.........
ispybDataCollection = edPluginControlH5ToCBF.dataOutput.ispybDataCollection
elif not os.path.exists(strPathToImage):
self.screen("Waiting for file {0}".format(strPathToImage))
self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName)
xsDataInputMXWaitFile.file = XSDataFile(XSDataString(strPathToImage))
xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize))
xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut))
self.DEBUG("Wait file timeOut set to %f" % self.fMXWaitFileTimeOut)
self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile)
self.edPluginMXWaitFile.executeSynchronous()
if not os.path.exists(strPathToImage):
strError = "Time-out while waiting for image %s" % strPathToImage
self.error(strError)
self.addErrorMessage(strError)
self.setFailure()
else:
# Check if we should run distl.signalStrength
xsDataImageNew = XSDataImage(XSDataString(strPathToImage))
edPluginPluginExecImageQualityIndicator = None
if bDoDistlSignalStrength:
if self.bUseThinClient:
strPluginName = self.strPluginNameThinClient
else:
strPluginName = self.strPluginName
edPluginPluginExecImageQualityIndicator = self.loadPlugin(strPluginName)
self.listPluginExecImageQualityIndicator.append(edPluginPluginExecImageQualityIndicator)
xsDataInputDistlSignalStrength = XSDataInputDistlSignalStrength()
xsDataInputDistlSignalStrength.setReferenceImage(xsDataImageNew)
edPluginPluginExecImageQualityIndicator.setDataInput(xsDataInputDistlSignalStrength)
edPluginPluginExecImageQualityIndicator.execute()
listPluginDistl.append((xsDataImageNew.copy(), edPluginPluginExecImageQualityIndicator))
listBatch.append(xsDataImageNew.copy())
if len(listBatch) == batchSize:
edPluginControlDozor = self.loadPlugin(self.strPluginNameControlDozor)
xsDataInputControlDozor = XSDataInputControlDozor()
for image in listBatch:
xsDataInputControlDozor.addImage(XSDataFile(image.path))
xsDataInputControlDozor.batchSize = XSDataInteger(batchSize)
edPluginControlDozor.dataInput = xsDataInputControlDozor
edPluginControlDozor.execute()
listPluginDozor.append((edPluginControlDozor, listBatch))
listBatch = []
if len(listBatch) > 0:
# Process the remaining images...
edPluginControlDozor = self.loadPlugin(self.strPluginNameControlDozor)
xsDataInputControlDozor = XSDataInputControlDozor()
for image in listBatch:
xsDataInputControlDozor.addImage(XSDataFile(image.path))
xsDataInputControlDozor.batchSize = XSDataInteger(batchSize)
edPluginControlDozor.dataInput = xsDataInputControlDozor
edPluginControlDozor.execute()
listPluginDozor.append([edPluginControlDozor, listBatch])
listIndexing = []
# Synchronize all image quality indicator plugins and upload to ISPyB
xsDataInputStoreListOfImageQualityIndicators = XSDataInputStoreListOfImageQualityIndicators()
for (xsDataImage, edPluginPluginExecImageQualityIndicator) in listPluginDistl:
xsDataImageQualityIndicators = XSDataImageQualityIndicators()
xsDataImageQualityIndicators.image = xsDataImage.copy()
if edPluginPluginExecImageQualityIndicator is not None:
edPluginPluginExecImageQualityIndicator.synchronize()
if edPluginPluginExecImageQualityIndicator.dataOutput.imageQualityIndicators is not None:
xsDataImageQualityIndicators = XSDataImageQualityIndicators.parseString(\
示例2: process
# 需要導入模塊: from XSDataCommon import XSDataImage [as 別名]
# 或者: from XSDataCommon.XSDataImage import copy [as 別名]
def process(self, _edPlugin=None):
"""
Executes the execution plugins
"""
EDPluginControl.process(self, _edPlugin)
self.DEBUG("EDPluginControlImageQualityIndicatorsv1_5.process")
EDUtilsParallel.initializeNbThread()
# Check batch size
if self.dataInput.batchSize is None:
batchSize = 1
else:
batchSize = self.dataInput.batchSize.value
self.screen("Image quality indicators batch size: {0}".format(batchSize))
# Check if we should do distlSignalStrength:
bDoDistlSignalStrength = True
if self.dataInput.doDistlSignalStrength is not None:
if not self.dataInput.doDistlSignalStrength.value:
bDoDistlSignalStrength = False
# Check if we should do indexing:
bDoIndexing = False
if self.dataInput.doIndexing is not None:
if self.dataInput.doIndexing.value:
bDoIndexing = True
# Check if fast mesh (for HDF5)
isFastMesh = False
if self.dataInput.fastMesh:
isFastMesh = self.dataInput.fastMesh.value
# Loop through all the incoming reference images
if len(self.dataInput.image) == 0:
directory = self.dataInput.directory.path.value
template = self.dataInput.template.value
startNo = self.dataInput.startNo.value
endNo = self.dataInput.endNo.value
listXSDataImage = []
for index in range(startNo, endNo + 1):
imageName = template.replace("####", "{0:04d}".format(index))
imagePath = os.path.join(directory, imageName)
xsDataImage = XSDataImage(path=XSDataString(imagePath), number=XSDataInteger(index))
listXSDataImage.append(xsDataImage)
else:
listXSDataImage = self.dataInput.image
xsDataInputMXWaitFile = XSDataInputMXWaitFile()
self.xsDataResultControlImageQualityIndicators = XSDataResultControlImageQualityIndicators()
listPluginDistl = []
listPluginDozor = []
listOfImagesInBatch = []
listOfAllBatches = []
indexBatch = 0
listH5FilePath = []
# Process data in batches
for xsDataImage in listXSDataImage:
listOfImagesInBatch.append(xsDataImage.copy())
if len(listOfImagesInBatch) == batchSize:
listOfAllBatches.append(listOfImagesInBatch)
listOfImagesInBatch = []
if len(listOfImagesInBatch) > 0:
listOfAllBatches.append(listOfImagesInBatch)
listOfImagesInBatch = []
# Loop over batches
for listOfImagesInBatch in listOfAllBatches:
# First wait for images
for image in listOfImagesInBatch:
strPathToImage = image.path.value
# If Eiger, just wait for the h5 file
if strPathToImage.endswith(".h5"):
h5MasterFilePath, h5DataFilePath, hdf5ImageNumber = self.getH5FilePath(strPathToImage,
batchSize=batchSize,
isFastMesh=isFastMesh)
# print(h5FilePath)
# print(hdf5ImageNumber)
if not h5DataFilePath in listH5FilePath:
self.screen("ID30a3 Eiger data, waiting for master and data files...")
listH5FilePath.append(h5DataFilePath)
self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName)
xsDataInputMXWaitFile.file = XSDataFile(XSDataString(h5DataFilePath))
xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize))
xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut))
self.screen("Waiting for file {0}".format(h5DataFilePath))
self.DEBUG("Wait file timeOut set to %f" % self.fMXWaitFileTimeOut)
self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile)
self.edPluginMXWaitFile.executeSynchronous()
# hdf5FilePath = strPathToImage.replace(".cbf", ".h5")
time.sleep(1)
if not os.path.exists(h5DataFilePath):
strError = "Time-out while waiting for image %s" % h5DataFilePath
self.error(strError)
self.addErrorMessage(strError)
self.setFailure()
else:
if not os.path.exists(strPathToImage):
# self.screen("Waiting for file {0}".format(strPathToImage))
self.edPluginMXWaitFile = self.loadPlugin(self.strPluginMXWaitFileName)
xsDataInputMXWaitFile.file = XSDataFile(XSDataString(strPathToImage))
xsDataInputMXWaitFile.setSize(XSDataInteger(self.minImageSize))
xsDataInputMXWaitFile.setTimeOut(XSDataTime(self.fMXWaitFileTimeOut))
self.screen("Wait file timeOut set to %.0f s" % self.fMXWaitFileTimeOut)
self.edPluginMXWaitFile.setDataInput(xsDataInputMXWaitFile)
self.edPluginMXWaitFile.executeSynchronous()
if not os.path.exists(strPathToImage):
strError = "Time-out while waiting for image %s" % strPathToImage
#.........這裏部分代碼省略.........