def savefile(im, imname, plugin, compress='false'): attemptcount = 0 imname = tiffextend(imname) print('Saving ', imname, im.width, im.height) if compress.lower() != 'true': IJ.saveAs(im, "tiff", imname) else: while attemptcount < 5: try: plugin.arg = "outfile=" + imname + " windowless=true compression=LZW saveROI=false" exporter = Exporter(plugin, im) exporter.run() print('Succeeded after attempt ', attemptcount) return except: attemptcount += 1 print('failed 5 times at saving')
def bfexporter(imp, savepath, useLOCI=True): if useLOCI: paramstring = "outfile=[" + savepath + "] windowless=true compression=Uncompressed saveROI=false" plugin = LociExporter() plugin.arg = paramstring exporter = Exporter(plugin, imp) exporter.run() # save as OME-TIFF using BioFormats library using the IJ.run method if not useLOCI: # 2019-04-25: This does not seem to work in headless anymore paramstring = "save=[" + savepath + "] compression=Uncompressed" IJ.run(imp, "Bio-Formats Exporter", paramstring) return paramstring
# run image analysis pipeline filtered_image = run(IMAGEPATH, useBF=True, series=0) # get time at the end and calc duration of processing end = time.clock() log.info('Duration of whole Processing : ' + str(end - start)) ########################################################### start = time.clock() # create the argument string for the BioFormats Exporter and save as OME.TIFF paramstring = "outfile=" + outputimagepath + " " + "windowless=true compression=Uncompressed saveROI=false" plugin = LociExporter() plugin.arg = paramstring exporter = Exporter(plugin, filtered_image) exporter.run() # get time at the end and calc duration of processing end = time.clock() log.info('Duration of saving as OME-TIFF : ' + str(end - start)) # show the image filtered_image.show() # finish log.info('Done.')