Need help or advice ? Come to the Icy club ! - Every Wenesday morning from 9h30 to 12h30 - Francois Jacob Building - Main hall - Pasteur
Register

Add Black Channel

by tprovoost / Thomas Provoost

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.

version 1 (last version):

download to use and modify in Icy. How do I use scripts ? A Problem ? ask the community.
Changelog for this version: 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)

This script has no documentation. A Problem ? ask the community.



Icy script publication Id : A5O4H2