|
Daniel Hornung wrote:
> Hello,
>
> maybe I'm just to blind, but I can't find a way to convert a HSB stack (2D*c*z)
> back to an RGB color image (2D*z). The result of "Image > Type > RGB Color" is
> just a grayscale image. It works ok with normal 2d images (depth=1) though.
>
> Any hint please?
OK, I wrote my own python script now to convert it back, it seems to work with
all my examples up to now. No error checking yet, it should work on any stack
with HSBHSB...HSB slice order.
Enjoy it if you need it,
Daniel
== hsb2rgb_stack.py ==
def hsb2rgb_stack():
impl = IJ.getImage()
stack = impl.getImageStack()
oldName = impl.getTitle()
width = stack.getWidth()
height = stack.getHeight()
depth = stack.getSize()
newStack = ImageStack(width, height)
for z in xrange(depth/3):
i1 = z*3 + 1
i2 = z*3 + 2
i3 = z*3 + 3
h = stack.getPixels(i1)
s = stack.getPixels(i2)
b = stack.getPixels(i3)
proc = ColorProcessor(width, height)
proc.setHSB(h,s,b)
newStack.addSlice("", proc)
newName = oldName + "_recombined"
ImagePlus(newName, newStack).show()
hsb2rgb_stack()
==
--
Daniel Hornung
Biomedical Physics Group
Max-Planck-Institute for Dynamics and Self-Organization
Bunsenstr. 10
D-37073 Goettingen
(+49) 551 5176 368
|