0

I'm new to java so please forgive me if this is a stupid question!

I'm writing a plugin relevant to my project to help me learn java/writing plugins for image analysis, and essentially want to restrict the measurements I'm taking to ROIs/Overlays, but am not entirely sure how to go about this.

The first step I have at the moment is creating a float array to store pixel values like so:

float[] pixels = new float[width * height * nChannels * nSlices * nFrames];

(with following steps to accomodate stacks, multiple channels etc.).

So far it's worked well for what I'm trying to do, but I'm not sure how to adapt this to include/work from ROIs rather than the whole image. The plugin is meant to pull out different types of values from control images (e.g. mean, maxima, medians etc).

Any suggestions? Help would be appreciated! Thanks!

1 Answers1

1

Note that without knowing exactly what you're trying to do, it's hard to give specific advice. In general you can use the RoiManager to query available Rois which you would then use to access pixels.

However, seeing manual construction of a float[] to store pixels (instead of an ImagePlus) makes me a bit nervous. Since you are new to Java, I would encourage you to look over the ImageJ wiki, especially this overview of the ImageJ API. It does discuss regions of interest.

You may also find these resources particularly helpful:

  • The mailing lists - for advice on image analysis techniques and plugin design
  • The Fiji Cookbook - which walks you through many plugin examples
  • The ImageJ javadoc - for the technical specification of the API
hineroptera
  • 769
  • 3
  • 10
  • Hi - thanks for your reply! Sorry for the delay in getting back to you - just slipped my mind. The other programmers in my lab tend to convert the pixels into a long array and work from there, but I realised as I read your post (and after reading other resources) that this would overly complicate things. I've done as you suggested and simplified things, and am working through the API (with varying degrees of success). Thanks! – Abdullah Khan May 12 '15 at 14:52