Short Description

This script creates a sequence with channel 0 and a new black channel. Combined with the painting plugin, the black channel can be used as ground truth.

Versions

  • Version 1 • Released on: 2013-03-11 12:00:36
    Download
    Description:

    initial version

    /*
     * This script creates a sequence with channel 0 and a black channel.
     */
    importClass(Packages.icy.type.DataType)
    importClass(Packages.icy.image.IcyBufferedImage)
    importClass(Packages.icy.sequence.Sequence)
    importClass(Packages.icy.sequence.SequenceUtil)
    
    // get sequence
    seq = getSequence()
    if (seq == null) throw "Please open a sequence first"
    
    // extract channels
    w = seq.getWidth()
    h = seq.getHeight()
    type = seq.getDataType_()
    
    seq0 = SequenceUtil.extractChannel(seq, 0)
    seq1 = new Sequence(new IcyBufferedImage(w, h, 1, type))
    
    for (t = 0; t < seq0.getSizeT() ; t = t + 1) {
    
    	for (z = 0; z < seq0.getSizeZ() ; z = z + 1) {
    
    		// Creates an image of 512x512 with 1 channel of type Unsigned Byte
    		img = new IcyBufferedImage(w, h, 1, type)
    
    		// Add the image in the sequence
    		seq1.addImage(t, img)
    	}
    }
    
    // combine both channels. When combining, it is necessary to 
    // ALWAYS have the same dimensions.
    merged = SequenceUtil.concatC([seq0, seq1])
    
    // add the sequence
    gui.addSequence(merged)
    

Leave a Review