def run(imagefile, useBF=True, series=0, filtertype='MEDIAN', filterradius='5'): #log.log(LogLevel.INFO, 'Image Filename : ' + imagefile) log.info('Image Filename : ' + imagefile) # get basic image metainfo metainfo = get_metadata(imagefile, imageID=series) for k, v in metainfo.items(): #log.log(LogLevel.INFO, str(k) + ' : ' + str(v)) log.info(str(k) + ' : ' + str(v)) if not useBF: # using IJ static method imp = IJ.openImage(imagefile) if useBF: # initialize the importer options for BioFormats options = ImporterOptions() options.setOpenAllSeries(True) options.setShowOMEXML(False) options.setConcatenate(True) options.setAutoscale(True) options.setId(imagefile) options.setStitchTiles(True) # open the ImgPlus imps = BF.openImagePlus(options) imp = imps[series] # apply the filter if filtertype != 'NONE': # apply filter #log.log(LogLevel.INFO, 'Apply Filter : ' + filtertype) #log.log(LogLevel.INFO, 'Filter Radius : ' + str(filterradius)) log.info('Apply Filter : ' + filtertype) log.info('Filter Radius : ' + str(filterradius)) # apply the filter based on the chosen type imp = apply_filter(imp, radius=filterradius, filtertype=filtertype) if filtertype == 'NONE': #log.log(LogLevel.INFO, 'No filter selected. Do nothing.') log.info('No filter selected. Do nothing.') return imp
def readbf(imagefile, metainfo, setflatres=False, readpylevel=0, setconcat=False, openallseries=True, showomexml=False, autoscale=True, stitchtiles=True): # initialize the importer options options = ImporterOptions() options.setOpenAllSeries(openallseries) options.setShowOMEXML(showomexml) options.setConcatenate(setconcat) options.setAutoscale(autoscale) options.setId(imagefile) options.setStitchTiles(stitchtiles) # in case of concat=True all series set number of series = 1 # and set pyramidlevel = 0 (1st level) since there will be only one # unless setflatres = True --> read pyramid levels series = metainfo['SeriesCount_BF'] if setconcat and setflatres: series = 1 readpylevel = 0 metainfo['Pyramid Level Output'] = readpylevel # open the ImgPlus imps = BF.openImagePlus(options) # read image data using the specified pyramid level imp, slices, width, height, pylevel = ImageTools.getImageSeries(imps, series=readpylevel) metainfo['Output Slices'] = slices metainfo['Output SizeX'] = width metainfo['Output SizeY'] = height return imp, metainfo
def run(imagefile, useBF=True, series=0): log.info('Image Filename : ' + imagefile) if not useBF: # using IJ static method imp = IJ.openImage(imagefile) if useBF: # initialize the importer options options = ImporterOptions() options.setOpenAllSeries(True) options.setShowOMEXML(False) options.setConcatenate(True) options.setAutoscale(True) options.setId(imagefile) # open the ImgPlus imps = BF.openImagePlus(options) imp = imps[series] # apply the filter if FILTERTYPE != 'NONE': # apply filter log.info('Apply Filter : ' + FILTERTYPE) log.info('Filter Radius : ' + str(FILTER_RADIUS)) # apply the filter based on the choosen type imp = apply_filter(imp, radius=FILTER_RADIUS, filtertype=FILTERTYPE) if FILTERTYPE == 'NONE': log.info('No filter selected. Do nothing.') return imp