({{, (RefLink[Threshold, paclet:ref/Threshold])[data] 
thresholds data by replacing values close to zero by zero.}, {, (RefLink[Threshold, paclet:ref/Threshold])[data,tspec]
thresholds data using threshold specification tspec.}, {, (RefLink[Threshold, paclet:ref/Threshold])[image,…]
thresholds an image.}, {, (RefLink[Threshold, paclet:ref/Threshold])[sound,…]
thresholds a sound object.}})

OpenersNotesSection(Spacer1)Details

(RefLink[Threshold, paclet:ref/Threshold]) works with 3D as well as 2D images, and also with data arrays of any rank.

(RefLink[Threshold, paclet:ref/Threshold])[data] is equivalent to (RefLink[Threshold, paclet:ref/Threshold])[data,{"Hard",(10^(-10))}].

The threshold specification tspec can be of the form {tfun,pars}.

Possible tfun names and options include:

In all cases δ is assumed to be a positive number or a thresholding function tfunc to compute δ. Each tfunc[data] should return a positive number.

The parameter conditions for "Firm" are that r is a positive real and p a real number between 0 and 1.

The parameter conditions for "SmoothGarrote" is to have n be a positive machine integer.

The threshold δ can be automatically computed using the following methods:

OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Zero out elements that are very close to 0:

FourierDST[N[{1,0,1,0,1}]]

Threshold[%]

Perform a clustering threshold on an image:

Threshold[,{"Hard","Cluster"}]

Use a "Soft" threshold function:

Threshold[,{"Soft","Cluster"}]

Keep 5 largest data values:

Threshold[Range[10],{"LargestValues",5}]

OpenersExampleSection2(Spacer1)Properties & Relations  (5)

"Hard" thresholding is similar to (RefLink[Chop, paclet:ref/Chop]):

hardThreshold[x_, δ_]:= Chop[x,δ]

Data values with absolute value below threshold δ are set to 0:

Plot[hardThreshold[x,1],{x,-3,3}]

"Soft" thresholding performs a shrinking operation:

softThreshold[x_, δ_]:=  Sign[x]Max[0,(Abs[x]-δ)]

Data values below a certain threshold δ are set to 0; those above δ are "shrunk" by δ:

Plot[softThreshold[x,1],{x,-3,3}]

"Firm" thresholding is a compromise between "Hard" and "Soft" thresholding:

firmThreshold[x_,η_,β_]:= Piecewise[{{0, Abs[x]≤ η},{Sign[x](β(((Abs[x]-η))/(β-η))), η<Abs[x]≤ β},{x, Abs[x]>β}}]

"Firm" thresholding has uniformly smaller variance than "Hard" thresholding:

Plot[firmThreshold[x,1,2],{x,-3,3}]

In the limit  β->∞, "Firm" threshold performs "Soft" thresholding:

Plot[firmThreshold[x,1,10],{x,-3,3}]

In the limit  β->η, "Firm" threshold performs "Hard" thresholding:

Plot[firmThreshold[x,1,1],{x,-3,3},Exclusions->None]

"PiecewiseGarrote" thresholding:

piecewiseGarrote[x_, δ_]:=  Piecewise[{{x-((δ^2)/x),Abs[x]>δ}}]

This is similar to "Firm" thresholding with the advantage of having a single parameter δ:

Plot[piecewiseGarrote[x,1],{x,-3,3}]

"SmoothGarrote" thresholding:

smoothGarrote[x_,δ_,n_]:= ((x^(2n+1))/((δ^(2n))+(x^(2n))))

In the limit n->∞, "SmoothGarrote" goes to "Hard" thresholding:

Plot[{smoothGarrote[x,1,3],smoothGarrote[x,1,10],smoothGarrote[x,1,60]},{x,-3,3}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FindThreshold, paclet:ref/FindThreshold])  ▪  (RefLink[WaveletThreshold, paclet:ref/WaveletThreshold])  ▪  (RefLink[Chop, paclet:ref/Chop])  ▪  (RefLink[Round, paclet:ref/Round])  ▪  (RefLink[Clip, paclet:ref/Clip])  ▪  (RefLink[N, paclet:ref/N])  ▪  (RefLink[Floor, paclet:ref/Floor])  ▪  (RefLink[Binarize, paclet:ref/Binarize])  ▪  (RefLink[DeleteAnomalies, paclet:ref/DeleteAnomalies])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Data Transforms and Smoothing, paclet:guide/DataTransformsAndSmoothing])}, {▪(RefLinkPlain[Basic Image Manipulation, paclet:guide/BasicImageManipulation])}, {▪(RefLinkPlain[Numerical Functions, paclet:guide/NumericalFunctions])}, {▪(RefLinkPlain[Machine Learning, paclet:guide/MachineLearning])}, {▪(RefLinkPlain[Scientific Data Analysis, paclet:guide/ScientificDataAnalysis])}, {▪(RefLinkPlain[Color Processing, paclet:guide/ColorProcessing])}, {▪(RefLinkPlain[Segmentation Analysis, paclet:guide/SegmentationAnalysis])}})}})