How to restrict denoising filters to a segmented region of the VOI


I am working with uCT images of metal lattices trying to quantify bone ingrowth. Due to the presence of metal, there is some noise which makes selection of the bone tissue using the threshold function challenging. There are more than 900 images in each dataset with a lot of spacial complexity so manual tracing or painting is impossible. Applying a median or gaussian filter generally helps but applying them globally also blurs the metal edges introducing more noise within the close vicinity of metal bits.

I am wondering if the denoising filters can be applied to a segmented region. If so, I can threshold the metal and apply the filter to the non-metal regions which I am hoping can help with later thresholding of bone.



There are median and gaussian filters for segments. You can threshold, use island tool to remove small artifacts (remove small islands option), and then use the median filter to create a smoothened labelmap. THen you can use the MaskVolume to extract only what’s inside the segment.

Is that close to what you want to do?

Thank you for your response. When you say ‘there are Gaussian and median filters for segments’, what do you mean exactly? Within which module should I find those? The standard ones I see from the denoising menu do not have that option.
Re the latter part of your suggestion, how do you extract a part of a volume using mask volume? Apologies as I am not that experienced with 3D slicer.
Cheers, R

Most likely classic smoothing and denoising filters cannot remove such complex noise as metal artifacts in CT. However, if you segment a few dozen CTs manually then you can use them to train an nn-UNet or MONAI Auto3DSeg model that should be able to provide an accurate bone segmentation from the noisy images. Depending on complexity of the task and variability of the images, you may need to increase the size of the training data set (e.g., by manually correcting imperfections in the automatic segmentation results), but eventually you will reach a point when automatic segmentation provides results that are good enough for your purposes.

Those are available in the Segment Editor module, during segmentation. Under the effect callled Smoothing.

MaskVolume is also another effect inside the Segment Editor.

Thanks Andras. I am interested in trying that, however, at this point, it is really hard to do that even manually for a few of the datasets especially with no filtering. I am hoping that if I could exclude (subtract) the metal parts from the volumes, and run the median filter afterwards, part of the problem will be solved. Preferrably, I don’t want to replace the metal segment with a black fill if possible - which I now know I can do based on @muratmaga’s suggestion; that will result in its own error when applying the filter as it will use the black filled pixels to filter the margins. Rather, I would like to be able to run the filter in a smart way such that it automatically doesn’t apply it to the metal segment. Is there a way of doing that?

Acquisition is not a factor by the way - I have tried different energy parameters and it won’t get any better.

Thanks very much for your suggestions. I am going to give MaskVolume a try and see whether I can mix it up with Andras’s nn method.