Script

Merge AxioVision channels

Publication ID: ICY-S2G2P3

Short Description

This script asks the user for an experiment folder produced by Axiovision and will create a multi-channel tiff file from the separate channel files.

Versions

  • Version 1 • Released on: 2016-01-29 16:06:30
    Download
    Description:

    initial version

    importClass(Packages.icy.file.Saver)
    importClass(Packages.icy.sequence.SequenceUtil)
    importClass(Packages.icy.sequence.Sequence)
    importClass(Packages.icy.file.Loader)
    importClass(Packages.icy.file.FileUtil)
    importClass(Packages.java.io.File)
    importClass(Packages.plugins.tprovoost.scripteditor.uitools.filedialogs.FileDialog)
    
    // select input folder
    inputFolder = FileDialog.openFolder()
    // cancelled
    if (inputFolder == null) throw "Cancelled..."
    
    // retrieve the sub-folders
    paths = FileUtil.getFiles(inputFolder, null, false, true, false);
    
    for(i = 0; i < paths.length; i++)
    {
    	// paths[i] = "/.../0025/
    	if (!FileUtil.isDirectory(paths[i])) continue
    
    	dataName = FileUtil.getFileName(paths[i]); // => 0025
    	println("Processing dataset " + dataName)
    
    	c1 = paths[i] + File.separator + dataName + "_c1.TIF"
    	c2 = paths[i] + File.separator + dataName + "_c2.TIF"
    	c3 = paths[i] + File.separator + dataName + "_c3.TIF"
    
    	channels = []
    	channels[0] = Loader.loadSequence(c1, 0, false)	
    	channels[1] = Loader.loadSequence(c2, 0, false)	
    	channels[2] = Loader.loadSequence(c3, 0, false)	
    
    	merge = SequenceUtil.concatC(channels)
    	newFile = inputFolder + File.separator + dataName + ".tif"
    	Saver.save(merge, new File(newFile));
    }
    println("done.")
    

Leave a Review