Python Binding MorphSpotClean - neutronimaging/imagingsuite GitHub Wiki

Return to Python bindings manual

Morph Spot Clean is a powerful outlier removal algorithm based on a morphological fill hole algorithm. The class applies the filter in-place to save memory.

API

Methods

The API contains the following methods

Enums

ia.eMorphDetectionMethod.MorphDetectHoles ia.eMorphDetectionMethod.MorphDetectPeaks ia.eMorphDetectionMethod.MorphDetectBoth

and

ia.eMorphCleanMethod.MorphCleanReplace ia.eMorphCleanMethod.MorphCleanFill

Example

import numpy as np
import skimage.io as io
sys.path.append(os.getenv('IMAGALG_MODULE_PATH'))
import imagalg as ia 
msc.setCleanMethod(ia.eMorphDetectionMethod.MorphDetectBoth, ia.eMorphCleanMethod.MorphCleanReplace)
msc.setLimits(False,-0.1,7.0,100)

fimg=io.imread('../../UnitTests/data/spotprojection_0001.tif').astype('float32')

di=msc.detectionImage(fimg)
assert di.shape == fimg.shape
ci=fimg.copy()
msc.process(ci,0.3,0.01)

# Separate thresholds for peaks and holes
ci=fimg.copy()
msc.process(ci,[0.3,0.2],[0.01,0.0005])