How to get info of value and count of the cursor in Histogram Plot?


While I open an image and apply Analyze Menu -> Histogram, it pop-up a Histogram window. I notice that it shows both live value and count of the moving cursor in the bottom window. Here I have two requirement:

  1. How to get info of value and count of the cursor?
  2. After calculating to generate new index via the value and count, how to add a new field to display it in the Histogram plot window?


Hey @Nemo

So - to be honest - I really do not quite understand what your problem is exactly or what you are wanting in terms of functionality that you cannot find in ImageJ. Would you be able to clarify with some images/examples??

All I can say… to at least point you in a direction that could potentially help, you should take a look at BAR for ImageJ/Fiji written by @tferr. It is a package that contains great tools and routines for image processing. Read more about it - it has some great functionality that goes beyond the ‘basics’ in ImageJ.

eta :slight_smile:


Hi Eta,

Thank you for the kindly help and message. It’s my first time to ask for assistance in the forum. I felt sorry that my question was not quite clear. Your suggestion to take a look at BAR is really helpful. I will follow your advice. Although I am not a programmer, I really like imageJ and enjoy using it to process some images. I used to read Built-in Macro Functions and write some little macros.

Presently, I am doing the hotpixel characterization on ccd camera with imageJ. I would like to write a macro function to connect the image and histogram interactively. More detail of my thought is that when moving the mouse in histogram window, it will highlight those pixels, in image window, with grey value larger than the value in histogram window. I have tried some built-in macro like Plot.getValues(xpoints, ypoints), getCursorLoc(x, y, z, modifiers), and getPixel(x, y) etc. However, all of them don’t meet my requirement. Recently, I surf on the website and find Creating a histogram image (custom data). It seems to write more “hard” codes to make it. If so, it would be a “big” trouble to me. If there are some reference or tutorial, it would be helpful to me.

Anyway, any help, suggestion, advice is great and helpful to me. Thanks all your kindly helps.

Best regards,


Hey @Nemo

Well - I’m glad you came to the Forum then with your questions - you are always welcome! :slight_smile:

So. I am a developer-in-training… so perhaps not the best person to answer your questions for coding such functionality. If I were you - I would start examining the source code for ImageJ1 and the source code of BAR on GitHub. These would be the best places to start… and perhaps more experienced programmers can give you some assistance.

Once you do a little more homework - and if you still need more help - post a new thread here on the Forum with your code as well as your specific questions.

Sorry I cannot help you better at the moment…



Hi @etarena

You are so kindly and so welcome. And I feel that the Forum is really a great resource for learning and sharing.

Your advice is persuasive. I think it should be a good time to learn more further knowledge in imageJ and scripting. It’s always great to “play” with them. Hehehe…I have to do some homework to put my idea into practice. Hope it won’t spend lots of time. In the meanwhile, I would post my code for further discussion and sharing.

Thanks for your warm helps. And wish you have a nice day. Thanks!!