RGB+autozoom

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RGB+autozoom

Albert Cardona
Oliver,

Here's one way to do it in the Jython interpreter, and/or as a Jython script:


def arrange(rgb, color, mag):
        if "red" == color:
                index = 1
        elif "green" == color:
                index = 2
        elif "blue" == color:
                index = 3
        imp = ImagePlus(color + " " + rgb.title,
rgb.stack.getProcessor(index).duplicate())
        imp.show()
        while imp.window.canvas.magnification != mag:
                imp.window.canvas.zoomOut(0,0)
        imp.window.setLocation((index-1) * imp.window.width, 0)

imp = WindowManager.getCurrentImage()
imp = ImagePlus(imp.title, imp.getProcessor().duplicate())
WindowManager.setTempCurrentImage(imp)
Converter().run("RGB Stack")
WindowManager.setTempCurrentImage(None)
arrange(imp, "red", 0.25)
arrange(imp, "green", 0.25)
arrange(imp, "blue", 0.25)


I find this code much more informative and powerful than the macro language.

Be careful that the second or third image may lay beyond the screen if it's
tool large. I didn't put in any safety checking whatsoever.

Albert


--
Albert Cardona
Molecular Cell Developmental Biology
University of California Los Angeles
Tel +1 310 2067376
Programming: http://www.pensament.net/java/
Research: http://www.mcdb.ucla.edu/Research/Hartenstein/
Web design: http://www.pixelets.com