Macro for Segmenting a straight line into equal measurements

Hello! I’m very new to imagej, and I don’t know how to write scripts yet. I’ve been looking for a script that divides a straight line into equal, measured segments, and allows you to plot the profile of that line with the measured segments. I am analyzing images of layered microbial structures, each of the layers are about 1mm thick and I want to be able to do a more in-depth analysis of the layers. Anything helps!


Read this thread. He can help you.
With a image we could also help you.

Tips for posting your first question : Please post a representative, original image file, as well as a brief explanation (avoiding science-specific “jargon” ) and/or an annotated version of the image to better indicate what solution you are after.

Thanks! It’s not exactly what I’m looking for but I’ll give it a try and see if it works! This is the image I’m trying to analyze. As you can see the lines are irregular and of varying thicknesses, so I just need to be able to divide a straight line into approx. “n” 5 mm segments.

You might want to search the forum for ‘tree rings’ and run the demo macro of ‘find peaks’. To get pixel coordinates under a line selection, for manually retrieving pixel values, you can use Roi.getCoordinates(xpoints, ypoints). You will also find explanation of all the other available commands of the ImageJ macro language on that page.

Finally, when using xpoints=newArray(size); ypoints=newArray(size); you have made two arrays of length size then filling them with the coordinates of your points that make up the line, you can use makeSelection(type, xpoints, ypoints) to make a poly-line. Together with the link @Mathew gave, you should have enough building blocks to get the desired results.