Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poor signal-to-noise near mask or image boundaries #10

Open
jewettaij opened this issue Jun 29, 2021 · 0 comments
Open

poor signal-to-noise near mask or image boundaries #10

jewettaij opened this issue Jun 29, 2021 · 0 comments

Comments

@jewettaij
Copy link
Owner

jewettaij commented Jun 29, 2021

I've noticed that , when using the "-mask" argument, that the detection of objects near the boundary of the mask is less reliable. I think this is because the detectors are more susceptible to noise near the boundary of a mask. The technical reason for this is explained below.

On 2021-7-08, I posted a commit that significantly reduces this problem, but the problem has not been completely solved.

Workaround

Strategies to get around this problem have been posted in the documentation here (for surface and curve detection), and also here (for blob detection).

If your goal when using the filter_mrc program to generate a new filtered image (rather than detect surfaces or blobs), then you may have better luck running that program initially on the entire image (without the mask). Afterwards, you can set the brightness of the voxels in the new image outside the mask to zero. You can do that using the combine_mrc program. For example:

combine_mrc  filtered_image.rec  "*"  mask.rec  filtered_clipped_image.rec

Explanation and details (feel free to skip)

As a first step to many operations (such as blob detection, ridge detection, or edge detection), a Gaussian blur is applied to the image at the beginning. When applying a Guassian filters on an image, the contribution of the nearby voxels to the brightness at the target voxel is normalized by dividing by the total (Gaussian) weight of the nearby voxels which were eligible to contribute.

If a mask image is supplied by the user, then only voxels in the mask are eligible. If you are near the boundary of the mask, then a small number of voxels are eligible to contribute, and this amplifies the noise (since you are effectively averaging the brightness over fewer nearby voxels). (I can't recall, but I think I normalize tensor-voting results in a similar way. Perhaps I should make this kind of normalization optional. I'm probably trying to be too clever and it's backfiring.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant