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

Generate random colormap

by stef / Stephane Dallongeville

Generate a random colormap for the current active image.

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

// get all opened view
viewers = gui.getViewers()
// get LUT (look up table) from current view
lut = gui.getActiveLUT()

// current view exist ?
if (lut != null)
	// get LUT for first channel
	lutCh = lut.getLutChannel(0)
	// get colormap
	colormap = lutCh.getColorMap()
	// set colormap to RGB type

	// generate rainbow colormap with 256 entries
	colors = ColorUtil.generateRainbow(256)

	// set a random color for each entry of the colormap
	for(i = 0; i < 256; i++)
		colormap.setARGB(i, colors[Random.nextInt(256)])

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

Icy script publication Id : Z3W9E3