本文整理汇总了Python中PyMca5.PyMcaIO.ArraySave.save2DArrayListAsMonochromaticTiff方法的典型用法代码示例。如果您正苦于以下问题:Python ArraySave.save2DArrayListAsMonochromaticTiff方法的具体用法?Python ArraySave.save2DArrayListAsMonochromaticTiff怎么用?Python ArraySave.save2DArrayListAsMonochromaticTiff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyMca5.PyMcaIO.ArraySave
的用法示例。
在下文中一共展示了ArraySave.save2DArrayListAsMonochromaticTiff方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: saveImageList
# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import save2DArrayListAsMonochromaticTiff [as 别名]
def saveImageList(self, filename, imageList, labels,
csvseparator=None):
if not imageList:
qt.QMessageBox.information(
self,
"No Data",
"Image list is empty.\nNothing to be saved")
return
if filename.lower().endswith(".edf"):
ArraySave.save2DArrayListAsEDF(imageList, filename, labels)
elif filename.lower().endswith(".tif"):
ArraySave.save2DArrayListAsMonochromaticTiff(imageList,
filename,
labels)
elif filename.lower().endswith(".csv"):
assert csvseparator is not None
ArraySave.save2DArrayListAsASCII(imageList, filename, labels,
csv=True,
csvseparator=csvseparator)
else:
ArraySave.save2DArrayListAsASCII(imageList, filename, labels,
csv=False)
示例2: _threadFinished
# 需要导入模块: from PyMca5.PyMcaIO import ArraySave [as 别名]
# 或者: from PyMca5.PyMcaIO.ArraySave import save2DArrayListAsMonochromaticTiff [as 别名]
def _threadFinished(self):
result = self.thread.result
self.thread = None
if type(result) == type((1,)):
#if we receive a tuple there was an error
if len(result):
if result[0] == "Exception":
# somehow this exception is not caught
raise Exception(result[1], result[2])#, result[3])
return
imageNames = result['names']
images = result["images"]
nImages = images.shape[0]
self._widget = StackPluginResultsWindow.StackPluginResultsWindow(\
usetab=False)
self._widget.buildAndConnectImageButtonBox(replace=True,
multiple=True)
qt = StackPluginResultsWindow.qt
self._widget.sigMaskImageWidgetSignal.connect(self.mySlot)
self._widget.setStackPluginResults(images,
image_names=imageNames)
self._showWidget()
# save to output directory
parameters = self.configurationWidget.getParameters()
outputDir = parameters["output_dir"]
if outputDir in [None, ""]:
if DEBUG:
print("Nothing to be saved")
return
if parameters["file_root"] is None:
fileRoot = ""
else:
fileRoot = parameters["file_root"].replace(" ","")
if fileRoot in [None, ""]:
fileRoot = "images"
if not os.path.exists(outputDir):
os.mkdir(outputDir)
imagesDir = os.path.join(outputDir, "IMAGES")
if not os.path.exists(imagesDir):
os.mkdir(imagesDir)
imageList = [None] * (nImages)
fileImageNames = [None] * (nImages)
j = 0
for i in range(nImages):
name = imageNames[i].replace(" ","-")
fileImageNames[j] = name
imageList[j] = images[i]
j += 1
fileName = os.path.join(imagesDir, fileRoot+".edf")
ArraySave.save2DArrayListAsEDF(imageList, fileName,
labels=fileImageNames)
fileName = os.path.join(imagesDir, fileRoot+".csv")
ArraySave.save2DArrayListAsASCII(imageList, fileName, csv=True,
labels=fileImageNames)
if parameters["tiff"]:
i = 0
for i in range(len(fileImageNames)):
label = fileImageNames[i]
mass_fraction = "_" + label
fileName = os.path.join(imagesDir,
fileRoot + mass_fraction + ".tif")
ArraySave.save2DArrayListAsMonochromaticTiff([imageList[i]],
fileName,
labels=[label],
dtype=numpy.float32)