Convert back an hyperstack of "HSB stack" images to a stack of RGB images

Does anyone know how to convert an hyperstack of HSB stack images (obtained by converting a stack of RGB images to HSB using Image>Type>HSB Stack) back to a stack of RGB image in ImageJ? Images>Type>RGB color only works from a simple HSB stack to a single RGB image, not for a stack of several images

This will do for now (to adjust saturation on a stack of RGB images). But it would be nice to have the “RGB Color” command natively understand a stack of HSB images and convert it to a stack of RGB images.

val = 160;

inID = getImageID();
nt = nSlices;

for (n = 1; n <= nt; n++) {
	setSlice(n);
	run("Duplicate...", " ");
	tempID = getImageID();
	run("HSB Stack");
	setSlice(2);
	setMinAndMax(0, val);
	run("Apply LUT", "slice");
	run("RGB Color");
	run("Select All");
	run("Copy");
	selectImage(inID);
	run("Paste");
	selectImage(tempID);
	close();
}

Going from memory here, but isn’t there a hyperstack to stack command? Would that work?

Hi @christlet,
Upgrade to the latest daily build (1.53h30) and you can use Image>Type>RGB Color to convert a hyperstack of HSB stacks to a stack of RGB images. Here is an example:

  run("Fly Brain");
  wait(2000);
  run("HSB Stack");
  Stack.setPosition(3, 28, 1)
  wait(3000);
  run("RGB Color", "slices");
  Stack.setSlice(28);
2 Likes

Sounds great, thanks Wayne!