Help needed creating a segmented line with marks every 20µm


I am new to ImageJ and I am trying to write a macro or tool to place multiple points or marks on a segmented line. I am analyzing axons and i want to measure the diameter every 20µm. Since the axon does not grow straight, a grid is not useful. I want to draw a segmented line along the axon, and every 20µm should be a mark or point. Any help would be great!

Thank you!

here a picture from the web as an example



Perhaps a modification of the code mentioned in this reply to another’s question will do the trick?

Thank you for your answer, i tried the macro and its almost what im looking for! Do you have an idea how to modify the code, so that it would give a mark every 20µm?

Best regards

Instead of drawing short lines… you can draw a point using makePoint(x,y) for example. But I would have to play/modify the code myself to come up with something… but I’ll leave that to you! Here are some helpful links for scripting in Fiji:

The main things are to

  1. Use the Macro Recorder…
  2. Use the Built-In Macro Functions list to search for functions (linked above)
  3. Remember that print(); statements are your friend… if your code isn’t working as you intended… you can double-check variables a different points using print() statements, etc.

Give a try modifying the code yourself… and then post here if you have specific questions. We are here to help.

Hi @maxgoe
I created a macro that does this. You need a calibrated image. A demo is included. Have a look at @etarena suggested pages to see how you can modify this code. Good luck !

1 Like