Meeting Recap: ImageJ Macro Writing 101

On Tuesday, August 23rd, Ben Smith of UC Berkeley’s Vision Sciences Program took us through a two-hour introductory crash course on how to write macros for ImageJ. The room was packed with people and laptops as we learned the ins-and-outs of the programming language, variables, functions, arrays, and setting up loops.

IMG_5822
Ready to code!

To teach us about terminology and coding, Ben showed us how write a macro from scratch. The goal was to take a set of demo images (of dandelions), and run a high pass filter. We started off by just processing one image at a time, but eventually worked our way up to selecting an input directory and processing all of the files, then saving the output files in a separate directory.

IMG_5823
Sorry for the backlit photo, Ben!

Along the way, Ben shared some valuable tips, such as not needing to recreate the wheel every time. There are already many publicly available macros, and his goal was to try to teach us how to understand code so that we could adapt it to suit our needs.

At the end of the session, we learned a little bit about user interface and introducing things like “waitforUser”, which pauses the macro and allows the user to access ImageJ before continuing on.

Thanks again to Ben for all of his help and teaching us to become budding programmers! If you have any questions, please email Ben.

For those of you who attended the session, here are some resources:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s