import os imgDir = os.environ['IMG_ROOT'] relImg = "/test/suite/" # n.b. 17.56 and 17.57 - this gets it wrong both 24.3889 fName = 'fib620.tif' # fName = 'anaFiveDM.tif' # fName = 'sirionSisBSE.tif' # fName = 'sirionXHD.tif' # fName = 'clumpedAgX.dm3' filePath = imgDir + relImg + fName r = ImageProcessorReader(ChannelSeparator(LociPrefs.makeImageReader())) # print(dir(r)) r.setId(filePath) num = r.getImageCount() width = r.getSizeX() height = r.getSizeY() md = r.getGlobalMetadata() # print(type(md)) # print(num, width, height) stack = ImageStack(width, height) i = 0 ip = r.openProcessors(i)[0] stack.addSlice("1", ip); imp = ImagePlus("foo", stack); r.close() imp.show() IJ.run("Enhance Contrast", "saturated=0.35")
import os from loci.plugins.util import BFVirtualStack, ImageProcessorReader print '---------------------------------------------------------------------------------------' base = '/scratch/imageproc/data/paolo/FluoView_stitching/oib_format/TVA4vglut2_n2_4X_20140126_234209' infile = 'Slide1sec001/Slide1sec001_01.oib' path = os.path.join(base, infile) #print 'file: %s' % path irdr = ImageProcessorReader() irdr.setId(path) bf = BFVirtualStack(path, irdr, False, False, False) print 'Successfully created virtual stack.' width = bf.getWidth() height = bf.getHeight() size = bf.getSize() procreader = bf.getReader() # meta = procreader.getMetadata() # print meta absposx = procreader.getMetadataValue('AbsPositionValueX') absposy = procreader.getMetadataValue('AbsPositionValueY') print 'Dimensions (x, y, size): %s, %s, %s' % (width, height, size) print 'Absolute positions: %s, %s' % (absposx, absposy)