Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Image Processing with ImageJ

You're reading from   Image Processing with ImageJ Get familiar with one of the world's most highly regarded Digital Image processors, ImageJ. This tutorial takes you through every aspect of viewing, processing, and analysing 2D, 3D, and 4D images, clearly and comprehensively.

Arrow left icon
Product type Paperback
Published in Sep 2013
Publisher Packt
ISBN-13 9781783283958
Length 140 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Adding a GUI to your macro


Sometimes you may want to try different values for some parameters without having to edit the macro code again and again in order to change the hardcoded variables. The Dialog functions allow you to build your own user interfaces to query the user for information before running the macro. A dialog is built by calling Dialog.create(title) and then adding the different elements that compose the user interface: textboxes for strings/numbers, sliders, selection menus, checkboxes, and radio buttons. Once all the elements are in place, we just need to get the user input and proceed with the processing of the macro.

The following code creates a simple dialog and will allow us to explore the possibilities of the dialog building functions with some additional nicety:

// We are using some relatively new functions, so we have to
// explicitly forbid this macro from running in old ImageJ versions
requires("1.47r");
// Create the main window with its title
Dialog.create("This...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image