-
Notifications
You must be signed in to change notification settings - Fork 11
Python Binding ISSFilter
Anders Kaestner edited this page Jul 17, 2019
·
15 revisions
Return to Python bindings manual
The inverse scale space filter is a powerful denoising filter that is able to remove much of the noise without blurring the edges. More information about the filter and its tuning can be found in the kip tool manual.
The filter operates in-place on 3D images only. This means the result is returned in the input image.
- init() - Constructor
- entropies() - Returns a vector with the entropy of each filter iteration.
- errors() - Returns a vector with the error of each filter iteration
- initialImageType() - Returns the type of the initial image using the eInitialImageType enum.
- regularizationType() - Returns the regularization type.
-
process(img, tau, plambda, palpha, N, saveIterations, itPath)
- img: numpy.ndarray[float32] - the image to be filtered. The operation is in-place, i.e. the result will be returned in this image.
- tau: float=0.125 - time increment of the solver.
- plambda: float=1.0 - regularisation parameter lambda.
- palpha: float=0.25 - regularisation parameter alpha.
- N: int=10 - number of iterations
- saveIterations: bool=False - switch to save the iteration images, the mid slice will only be saved. Note this feature is currently not active.
- itPath: str='iteration_####.tif' - base name of the saved images.
- setInitialImageType(arg0: advancedfilters::eInitialImageType) - Sets the type of the initial image using the eInitialImageType enum.
- setRegularizationType)(self: advancedfilters.ISSfilter3D, arg0: advancedfilters::eRegularizationType) - Sets the regularization type using eRegularizationType enum.
-
eInitialImageType - Selects the u_0 for the filter processing
- InitialImageOriginal = eInitialImageType.InitialImageOriginal (default)
- InitialImageZero = eInitialImageType.InitialImageZero
-
eRegularizationType - Selects the type of regularization.
- RegularizationTV1 = eRegularizationType.RegularizationTV1 (experimental)
- RegularizationTV2 = eRegularizationType.RegularizationTV2 (default)
import numpy as np
import skimage.io as io
import math
import advancedfilters as af
iss=af.ISSfilter3D()
img=io.imread('../../UnitTests/data/frame0000_100x100x100.tif').astype('float32')
# Normalising the image helps as it will result in the same parameter set
m=img.mean()
s=img.std()
img=(img-m)/s
# making a copy to allow comparison (the filter operates in-place)
imgp=img.copy()
iss.setInitialImageType(af.InitialImageOriginal)
N=10
iss.process(imgp, tau=0.1,N=25,plambda=0.04, palpha=0.01)
plt.subplot(2,2,1)
plt.imshow(img[50])
plt.subplot(2,2,2)
plt.imshow(imgp[50])
plt.subplot(2,2,3)
plt.imshow(img[50]-imgp[50])
plt.subplot(2,2,4)
plt.plot(iss.errors())
plt.savefig('issresults.png')
Executing this code should produce a plot like this