Ejemplo n.º 1
0
def createOutputData( jobs ):
    """ Reads out the meta data.
    """
    failedImages = []
    nJobs = len( jobs )
    for n, j in enumerate( jobs ):
        print( "Job " + str(n+1) + "/" + str( nJobs ) )
        # load every image
        metadata = []
        nImages = len( j.sourceImages )
        nChannels = -1
        for m, img in enumerate( j.sourceImages ):
            print( "\tReading image " + str(m+1) + "/" + str( nImages ) )
            imgPath = os.path.join( j.sourcePath, img )
            options = ImporterOptions()
            options.setId( imgPath )
            options.setSplitChannels( False )
            options.setWindowless( True )
            options.setVirtual( True )
            imps = BF.openImagePlus( options )
            if len(imps) == 0:
                failedImages.append( imgPath )
                print("t\tCould not load image: " + imgPath)
                continue
            # get the meta data
            data = imps[0]
            if nChannels == -1:
                nChannels = data.getNChannels() 
            imgInfo = Info();
            info = imgInfo.getImageInfo( data, data.getChannelProcessor() )
            metadata.append( imgPath )
            metadata.append( info )
        j.outputData = '\n\n>>> next source file >>>\n\n'.join( metadata )
        j.numChannels = nChannels
Ejemplo n.º 2
0
# @File(label="Input file") input
# @File(label="Output folder") output

# Splits multi-point CZI files into multiple TIFFs using Bio-Formats.
#
# Stefan Helfrich (University of Konstaz), 05/09/2016

from ij import IJ
from loci.plugins import BF
from loci.plugins.in import ImporterOptions
import os

srcPath = input.getAbsolutePath()

# using LOCI BioFormats  
settings = ImporterOptions()
settings.setId(srcPath)
settings.setOpenAllSeries(True)
settings.setVirtual(True)
settings.setWindowless(True)

imps = BF.openImagePlus(settings)

for i in range(0, len(imps)):
	currentImp = imps[i]
	filename = os.path.split(srcPath)[1]
	filenameWithoutExtension = os.path.splitext(filename)[0]
	IJ.saveAs(currentImp, "TIFF", output.getAbsolutePath() + "/" + filenameWithoutExtension + "-" + str(i) + ".tif")