Season's greetings,
I see a few postings about this subject in the archive, but didn't see a reply or resolution. People around here like the gamma slider on IDL's xloadct GUI and I'd like to be able to provide a way of doing this in ImageJ as a substitute for IDL. I found a plug-in which creates a black and white LUT with a gamma control (I like how it presents the control as a dynamic gamma correction plot) but a slider would be most familiar to people. Is there already a solution for this? Thanks! ==Leonard E. Sitongia High Altitude Observatory National Center for Atmospheric Research P.O. Box 3000 Boulder CO 80307 USA [hidden email] voice: (303)497-2454 fax: (303)497-1589 |
Hi Leonard,
On Fri, 18 Dec 2009, Leonard Sitongia wrote: > I see a few postings about this subject in the archive, but didn't see a > reply or resolution. People around here like the gamma slider on IDL's > xloadct GUI and I'd like to be able to provide a way of doing this in > ImageJ as a substitute for IDL. I found a plug-in which creates a black > and white LUT with a gamma control (I like how it presents the control > as a dynamic gamma correction plot) but a slider would be most familiar > to people. > > Is there already a solution for this? The easiest I can think of is this little Javascript I wrote in response to your question: -- snip -- importClass(Packages.ij.WindowManager) importClass(Packages.ij.gui.GenericDialog) importClass(Packages.ij.process.ImageProcessor) importClass(Packages.java.awt.event.AdjustmentListener) var image = WindowManager.getCurrentImage(); if (image != null) { var ip = image.getProcessor(); ip.snapshot(); var dialog = GenericDialog("Gamma (1.0)"); dialog.addSlider("gamma", 1, 500, 100); dialog.getNumericFields().lastElement().setVisible(false); var scrollbar = dialog.getSliders().lastElement(); dialog.add(scrollbar); var listener = new AdjustmentListener ({ adjustmentValueChanged : function(event) { var value = scrollbar.getValue() / 100.0; dialog.setTitle("Gamma (" + value + ")"); ip.reset(); ip.snapshot(); ip.gamma(value); image.updateAndDraw(); } }); scrollbar.addAdjustmentListener(listener); dialog.showDialog(); if (dialog.wasCanceled()) { ip.reset(); image.updateAndDraw(); } } -- snap -- In ImageJ, you can copy-paste this into the window you get after Plugins>New>JavaScript. In Fiji, you can paste it into the script editor (File>New>Script, then Language>Javascript), you will even get syntax highlighting with that. Ciao, Johannes |
In reply to this post by Leonard Sitongia
On Dec 18, 2009, at 11:13 AM, Leonard Sitongia wrote:
> Season's greetings, > > I see a few postings about this subject in the archive, but didn't see a reply or resolution. People around here like the gamma slider on IDL's xloadct GUI and I'd like to be able to provide a way of doing this in ImageJ as a substitute for IDL. I found a plug-in which creates a black and white LUT with a gamma control (I like how it presents the control as a dynamic gamma correction plot) but a slider would be most familiar to people. > > Is there already a solution for this? The Process>Math>Gamma command in the 1.43n daily build uses a slider. -wayne |
On Dec 20, 2009, at 11:08 PM, Wayne Rasband wrote:
> The Process>Math>Gamma command in the 1.43n daily build uses a slider. Excellent! Along with the Preview button, this is what I was looking for. Thanks, Wayne! ==Leonard E. Sitongia High Altitude Observatory National Center for Atmospheric Research P.O. Box 3000 Boulder CO 80307 USA [hidden email] voice: (303)497-2454 fax: (303)497-1589 |
Free forum by Nabble | Edit this page |