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.
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.
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: