ImageJ MacroBlocks Generator

 

This is a system to help you in ImageJ macro writing.

It gives a structure in five parts to your code, provides code for all input/output, and code for some usefull functions.

You will be ask to choose some blocks of functions you need in your ImageJ macro and the generator will produce a code that you can directly paste into a txt file and run as a macro file with ImageJ.

For some blocks (as indicated) you need to adapt the code to your needs, so some basic knowledge of ImageJ macro writting is needed.

The code was done with ImageJ 1.47f, you may find some incompatibility. Please tell me if it is the case.

Fabrice Duprat:duprat@ipmc.cnrs.fr

Visit my web site !

January 2015

 

You can paste your IJMacroblock code sequence to retrieve previous choices ...

(a code sequence is in the last line of the previously generated macro)

 

1- MACRO FILE HEADER

Name of the macro

Date of last modification

Author

Email

ImageJ Version

Short description

INPUT: Describe the image type (one color image, a directory with 16 bits stacks, …) and what the macro is expecting you to do (used objective, …)

OUTPUT: Describe what the macro is producing (graphs, excel file, images, ….)

 

2- INITIALISATION

Windows cleaning (recommended)

Close all opened images

Clear the Results window

Close the Log window

Close the ROI Manager window

Setting parameters

Set some variables and ImageJ parameters (you must adapt the code to your needs)

Input of your parameters

Example of dialog box for parameters imput (you must adapt the code to your needs)

Change the scale according to the choosen objective (need to select the above dialog box and must adapt the code to your needs)

 

3- FILE(S) INPUT

Number of images in each analysis ?

How many image(s) are analysed in each run of the macro

(ex: 2 images if you need to subtract one to another in your analysis)

How to get the images ?

SELECT ABOVE THE NUMBER OF IMAGES AND CLICK ON CHOOSE BUTTON

 

 

 

IMPORTANT: Only for the choices 3 or 4 of "One image" there is a loop to get many files.
You have to choose where the loop is finishing in your code, thus, if you are including or not the following measurements in the loop.

 

 

4- ANALYSIS

 

Prepare your image for analysis

Give hand to adjust threshold and create a mask, save the default threshold values (you must adapt the code to your needs)

Modifying the mask before analysis

Crop the image from a ROI

Select a ROI and subtract its mean value (ex: background subtraction). Beware this code clear the results window.

Make a selection from a complex shape and modify the points

 

Paste your lines of code for analysis from recorder (Plugins/Macros/Record...)

IMPORTANT:

Always replace the used Image1 title by the variable my_title_image1 in the following lines

 

If there is a file input loop, I want to end it here.

(Instead you can choose to end the loop after the measurements conditionning or after exportation, see below)

 

5- MEASUREMENTS

 

5a- CONDITIONNING

 

Extract selected measurements from Results window, store as a table in Log window (you must adapt the code to your needs)

Extract selected measurements from Results window and store it in an array (you must adapt the code to your needs)

 

Copy measurements from arrays into Results window (you must adapt the code to your needs)

Copy measurements from arrays into Log window (you must adapt the code to your needs)

 

If there is a file input loop, I want to end it here.

(Instead you can choose to end the loop after analysis, see above, or after exportation, see below)

 

5b- EXPORTATION

 

Ask too create a new subdirectory in the image directory (you must adapt the code to your needs)

 

Save the Results window as text file

Save the Log window as text file

 

If there is a file input loop, I want to end it here.

(Instead you can choose to end the loop after analysis or after conditionning, see above)