Stack to images, but with line selection for plotting and maxima

Hi all,
I am new to ImageJ and I am stuck with my analysis now.
I have gray scale images and managed to do the analysis on each single image by drawing a straight line for my ROI and retrieving the plot profile (of gray scae values) and its maxima/minima by running the macro “Extrema of current line profile” (found here:
However, I would like to run the macro for many (>80) images and this is where I am stucked now.

I made different attempts so far:

  1. using macro “Stack profile Plot” ( -> Plots are created as images thus not accessible for i.e. “Find peaks” (BAR), as plots are required. -> cannot proceed to find local maxima/minima.

  2. Align all images to a stack -> straight line for ROI was drawn on the first slide -> “Stack to Images” ignores the line selection. I would have to draw the ROI (straight line) for each image again.

  3. Drawing a line from “Overlay Brush” on a stack of images (and then use stack to images) will eventually give me every image with the line selection, however the line was not recognized as line selection by the macro “Extrema of current line profile”.

  4. I am aware of the option of Process -> Batch for Batch Processing. But Ifor that, I need each single image with line selection.

How can I solve this problem? I think if I manage to use the “stack to Image” option to save each single image with the line selection, I can proceed with the batch function?

Your help is much appreciated! Thank you!

Dear @medsc,

I think I understand what you want to do, but you are omitting an important information.

Each image has the line in a different location and position, correct?

In this case, the easiest, as you say, is to use the “Batch” mode on a folder each with a .tif image on which you have created the line ROI and resaved the image. ImageJ or Fiji can keep a single ROI (or overlay) in the metadata of a TIF file. When you open it again, it will automatically lodd that ROI, so batch processing is easy.

Another solution, if you really want to use stacks, is to first create the stack, then on each slice draw the line, and add it to the ROI Manager. Then you’d need a macro that goes through each ROI and runs your analysis script. So it’s definitely less convenient but a good practice if you want to start scripting in ImageJ/Fiji :slight_smile:

My suggestion remains the first one with batch processing. It offers a clear cut save point between the manual part of your work (drawing a line in each image, and saving it) and the automatic analysis.

The idea of putting things into a stack makes sense if the images share some sort of relationship. Are the individual images from a time series? Are they different Z positions of a 3D acquisition? If there is little relationship between the images, then working on each image sequentially makes more sense.

Hope this helps. If you’d like more help I suggest you provide some example images with the line profile you wish to analyze. This really helps the forum members understand your problem better and will definitely motivate us helping you find a good solution :slight_smile: