Dilation and ROIs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Dilation and ROIs

Jeremy Adler
I have a slightly surprising result when dilating within a ROI.
My expectation was that any processing within the ROI would not extend outside the ROI and that pixels outside the ROI would have no influence on the processing within the ROI.

1) The dilation of pixels) within the ROI (outside starts empty) stays within the ROI, which is fine, except when the edge of the ROI is one pixel away from the edge of the window, when the dilation extends and sets pixels outside the ROI, those on the right and bottom, but oddly not the top or left.

2) Pixels in the ROI are affected by pixels outside the ROI - a pixel just outside the ROI causes the adjacent pixel in the ROI to be dilated.

3) Non Binary, Pixels outside the ROI also affect pixels inside the ROI - seen with Process/Filters/Mean








--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Dilation and ROIs

Michael Schmid
Hi Jeremy,

pixels outside a ROI *should* affect the result of a filter operation. E.g., the mean is taken over all pixels within a certain radius, whether inside the ROI or not. If you use the 'mean' filter for smoothing the image, and the ROI is a very narrow, there would be almost no smoothing when restricting the operation to take the mean only for pixels inside the ROI (averaging over only very few pixels).

With the current behavior, you can also filter an image inside a ROI, take an identical image and filter everything in the remaining area (Edit>Selection>Make Inverse), and then combine the two filtered ROIs. It will be the same as filtering the full image.

I guess that this behavior is the same for all image processing programs.

---

Concerning 1), it would be bug if 'dilate' sets pixels outside the ROI. I have tried this, but I did not see a bug.  Could it be that you have a ROI that does not consist of rectangular parts (e.g. circle, polygon with lines at an angle), and the finite accuracy of showing the lines makes a pixel appear outside even if it is inside? (You can use 'fill' or 'clear' to see which pixels are inside and which are outside).

If you can confirm the bug, it would be helpful if you could post a small sample image, including the ROI. Please also report the 'Binary Options' leading to the incorrect behavior (the 'dilate' operation depends on what you set there).


Michael
________________________________________________________________
On May 9, 2014, at 09:52, Jeremy Adler wrote:

> I have a slightly surprising result when dilating within a ROI.
> My expectation was that any processing within the ROI would not extend outside the ROI and that pixels outside the ROI would have no influence on the processing within the ROI.
>
> 1) The dilation of pixels) within the ROI (outside starts empty) stays within the ROI, which is fine, except when the edge of the ROI is one pixel away from the edge of the window, when the dilation extends and sets pixels outside the ROI, those on the right and bottom, but oddly not the top or left.
>
> 2) Pixels in the ROI are affected by pixels outside the ROI - a pixel just outside the ROI causes the adjacent pixel in the ROI to be dilated.
>
> 3) Non Binary, Pixels outside the ROI also affect pixels inside the ROI - seen with Process/Filters/Mean
>
>
>
>
>
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html