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

Convert image type

by fab / Fabrice de Chaumont

Converts the image type

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
/*
- DataType contains all Types:
	* BYTE / UBYTE - Integer 8-bit
	* SHORT / USHORT - Integer 16 bit
	* INT / UINT - Integer 32-bit 
	* FLOAT - Decimal 32-bit
	* DOUBLE - Decimal 64-bit
- Use Unsigned versions (with the 'U' preceeding the type) by default
*/
importClass(Packages.icy.type.DataType)
importClass(Packages.icy.sequence.Sequence)
importClass(Packages.icy.gui.main.MainInterface)

// Get the focused Sequence, raise an exception if none.
seq = getSequence()
if (seq == null) throw "> Please open a sequence first <\n"

type = seq.getDataType_()
println("Current Type: " + type.toLongString())

// convert the sequence and get the result in another one
// the second parameter is for scaling the values.
seqConverted = seq.convertToType(DataType.USHORT, true)

type = seqConverted.getDataType_()
println("New Type: " + type.toLongString())

// Add the sequence in the GUI
gui.addSequence(seqConverted)

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



Icy script publication Id : A2G7W7