Search code examples
macrosimagej

Can I save scale settings between startups in ImageJ using start-up macros?


I have just recently started using ImageJ (or Fiji so be more specific) to measure the size of diatom shells in microscope photographs. It was pretty straight-forward to set the global scale using a reference photograph of a micrometer scale and then simply use the line tool to measure my diatoms. The only issue is that every time I start the program I have to reset the scale and I would prefer to avoid both the extra hassle, but also the issue of me calibrating a bit differently every time. I found the start-up macro builder and if I could make it set the scale to 164.4 pixels per micrometer I would be one happy hippo. Unfortunately I'm pretty illiterate when it comes to the language of computers. Can someone help me.


Solution

  • You can use the macro recorder (Plugins > Macros > Record...) to get the code needed to achieve that:

    run("Set Scale...", "distance=164.4 known=1 pixel=1 unit=um global");
    

    If you plan to put this into your StartupMacros.txt, be aware that the command requires at least one image to be opened.