How to put filter size for option NeighborhoodSize in adaptthresh function

5 views (last 30 days)
Dear all, I want to use adaptthresh for volume segmentation as method, But I dont know hoe to put the size of filter for NeighborhoodSize
I have code below,
The image data as attached.
clc
clear all
close all
[spect map]=dicomread('I-1312568N1.dcm');
info = dicominfo('I-1312568N1.dcm');
%gp=info.SliceThickness;
spect=(squeeze(spect));%smooth3
aa=size(spect);aa=aa(3);
imshow3D(spect)
T = adaptthresh(spect,0.000000000000001, "NeighborhoodSize","75x75");
BW = imbinarize(spect,T);
figure, imshow3D(BW)
Error using validateThreeDFilterSize
Expected filterSize to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Error in images.internal.validateThreeDFilterSize (line 8)
validateattributes(filterSize_, {'numeric'},...
Error in adaptthresh>validateFilterSize (line 335)
filtSize = images.internal.validateThreeDFilterSize(filtSize);
Error in adaptthresh>parseInputs (line 302)
options.(ParamNames{idx}) = validate(Value,1);
Error in adaptthresh (line 135)
[I,options] = parseInputs(I, args{:});

Accepted Answer

Image Analyst
Image Analyst on 15 Jan 2023
Help says "Size of neighborhood used to compute local statistic around each pixel, specified as a positive odd integer or a 2-element vector of positive odd integers." so you need an odd integer, OR a 2 element vector, like
% Window will be 75 x 75
T = adaptthresh(spect, 0.000000000000001, "NeighborhoodSize", 75);
% OR specify both width and height independently
T = adaptthresh(spect, 0.000000000000001, "NeighborhoodSize", [75, 75]);

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!