Abdullah Khan
Abdullah Khan

Reputation: 1

How to incorporate ROIs into an imageJ plugin?

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!

Upvotes: 0

Views: 111

Answers (1)

hineroptera
hineroptera

Reputation: 769

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

Upvotes: 1

Related Questions