# Calculating the area-weighted intensity of pixels intersected by the ROI

Tags: #<Tag:0x00007fa3051cb628> #<Tag:0x00007fa3051cb4e8> #<Tag:0x00007fa3051cb3a8> #<Tag:0x00007fa3051cb268>

#1

I have this time stack of 177 frames and I want to measure the average intensity of each ROI in each frame, as shown in the image

.

My only concern is there are some pixels that get intersected by the ROI, and that pixel would lie in 2 different ROIs.

My question is, when I use the multi-measure tool from the ROI manager, how does this tool deal with that pixel? does it make an area weighted average of the intensity? or does it decide on which ROI should this pixel fall in, based on where the majority of its area is?
If itās the latter, is there a way to do an area-weighted intensity measurement?

#2

Good day,

maybe your concept of pixels is wrong: Pixels donāt have a spatial extension, they are ideal points.

The problem may be seen in the definition of ROIs though ā¦

Regards

Herbie

#3

Could you clarify more? what is the problem with the ROIs?

#4

I guess Herbie is indicating that although ROIs can be (or at least, could be in the past, the command mentioned here seems to have vanished from version 1.52d) placed with sub-pixel precision/resolution, the actual measurement is using an entire pixel. At least, that is my conclusion after a brief test.

You might investigate this by having a tiny black image (e.g. 5x5 pixels), set a 3x3 ROI to value 255, draw a ROI that selects only a part of the area you painted 255 and then use āselection>interpolateā with a 0.1 pixel precision, then measure the resulting area.
From the results you can deduce that/if a pixel is either taken into account entirely or excluded entirely. From the measurement, you then can conclude that there is (no) interpolation. The javascript mentioned in the links above might prove different.

#5

As Eljonco, Iām not perfectly up-to-date about ROI definitions in ImageJ.

If ROIs are treated exactly like those drawn in your sample image, I see no problem at all, because pixels are ideal points and cases where a ROI-line passes exactly through such a point are rare and can be treated easily.
Interpolation may be applied but isnāt absolutely necessary.

If ROIs are in fact meanders but treated as lines, things may look differently ā¦

Finally, I agree with Eljonco that simple examples may give helpful experimental insights.

HTH

Herbie

#6

Hi Mohamed,

in contrast to programs like Photoshop, in ImageJ a pixel can be only inside or outside a ROI, nothing in between. You canāt have āsoftā boundaries for a ROI. The only way to get roughly what you want is increasing the image size (number of pixels) in x & y (Image>Adjust>Size; use bilinear interpolation). The larger the size factor, the closer it will be to what you would get with ācutting through the squaresā of the original pixels. In your case, I guess that a size factor of 4 would already provide a reasonable result.

Michael