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

Convert Type

by tprovoost / Thomas Provoost

Convert a sequence from a type to another.

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
importClass(Packages.icy.sequence.SequenceUtil)
/*
- 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)

// 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 = SequenceUtil.convertToType(seq, 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 : E8H3B1