コード例 #1
0
def openCroppedImageUsingBF(filepath,x,y,xw,yw,zs,ze, crop):
  # read in and display ImagePlus(es) with arguments
  options = ImporterOptions()
  options.setColorMode(ImporterOptions.COLOR_MODE_GRAYSCALE)
  if crop:
    options.setCrop(True)
    options.setCropRegion(0, Region(x,y,xw,yw))
    options.setTBegin(0, zs)
    options.setTEnd(0, ze)
  options.setId(filepath)
  imps = BF.openImagePlus(options)
  return imps[0]
コード例 #2
0
def open_czi_series(file_name, series_number, rect=False):
    # see https://downloads.openmicroscopy.org/bio-formats/5.5.1/api/loci/plugins/in/ImporterOptions.html
    options = ImporterOptions()
    options.setId(file_name)
    options.setColorMode(ImporterOptions.COLOR_MODE_GRAYSCALE)
    # select image to open
    options.setOpenAllSeries(False)
    options.setAutoscale(False)
    options.setSeriesOn(series_number, True)
    # default is not to crop
    options.setCrop(False)
    if rect:  # crop if asked for
        options.setCrop(True)
        options.setCropRegion(series_number, Region(rect[0], rect[1], rect[2], rect[3]))
    imps = BF.openImagePlus(options)

    return imps[0]
コード例 #3
0
ファイル: snippet.py プロジェクト: szabo92/gistable
# read in and display ImagePlus object(s)
from loci.plugins import BF
file = "/Users/curtis/data/tubhiswt4D.ome.tif"
imps = BF.openImagePlus(file)
for imp in imps:
    imp.show()

# read in and display ImagePlus(es) with arguments
from loci.common import Region
from loci.plugins.in import ImporterOptions
options = ImporterOptions()
options.setColorMode(ImporterOptions.COLOR_MODE_GRAYSCALE)
options.setCrop(True)
options.setCropRegion(0, Region(15, 25, 50, 70))
options.setId(file)
imps = BF.openImagePlus(options)
for imp in imps:
    imp.show()

# parse metadata
from loci.formats import ImageReader
from loci.formats import MetadataTools
reader = ImageReader()
omeMeta = MetadataTools.createOMEXMLMetadata()
reader.setMetadataStore(omeMeta)
reader.setId(file)
seriesCount = reader.getSeriesCount()
reader.close()

# print out series count from two different places (they should always match!)
from ij import IJ
コード例 #4
0
# from https://gist.githubusercontent.com/ctrueden/6282856/raw/6641abc2ae0fd13c6390ef3880fbeee6188edfef/bio-formats.py
# read in and display ImagePlus object(s)
from loci.plugins import BF
file = "/Users/curtis/data/tubhiswt4D.ome.tif"
imps = BF.openImagePlus(file)
for imp in imps:
    imp.show()

# read in and display ImagePlus(es) with arguments
from loci.common import Region
from loci.plugins.in import ImporterOptions
options = ImporterOptions()
options.setColorMode(ImporterOptions.COLOR_MODE_GRAYSCALE)
options.setCrop(True)
options.setCropRegion(0, Region(15, 25, 50, 70))
options.setId(file)
imps = BF.openImagePlus(options)
for imp in imps:
    imp.show()

# parse metadata
from loci.formats import ImageReader
from loci.formats import MetadataTools
reader = ImageReader()
omeMeta = MetadataTools.createOMEXMLMetadata()
reader.setMetadataStore(omeMeta)
reader.setId(file)
seriesCount = reader.getSeriesCount()
reader.close()

# print out series count from two different places (they should always match!)