Skip to content
Snippets Groups Projects

3d removal of background

Merged s204159 requested to merge 3d_removal into main
1 file
+ 24
0
Compare changes
  • Side-by-side
  • Inline
+ 24
0
import qim3d
import qim3d.processing.filters as filters
def remove_background(vol, **kwargs):
"""
Remove background from a volume using a median filter followed by a tophat filter.
Args:
vol: The volume to remove background from.
**kwargs: Additional keyword arguments for the tophat filter.
Returns:
vol: The volume with background removed.
"""
# Create a pipeline with a median filter and a tophat filter
pipeline = filter.Pipeline(
filters.Median(),
filters.Tophat(**kwargs)
)
# Apply the pipeline to the volume
return pipeline(vol)
\ No newline at end of file
Loading