Matlab CERR Gray Level Run Length Matrix

2 次查看(过去 30 天)
When I run the code in github to obtain the GLRLM in CERR, Matlab doesn't end running and no errors appear in the command window. So I have no clue what's wrong.
Here is the function I wrote based on the code in the github wiki above.
function out = run_length_matrix
global planC;
% Define the scan index
scanNum = 1;
indexS = planC{end};
scan3M = getScanArray(planC{indexS.scan}(scanNum));
numGrLevels = 64;
minIntensity = -400;
maxIntensity = 500;
%binWidth = 25;
quantizedM = imquantize_cerr(scan3M,numGrLevels,minIntensity,maxIntensity);
numVoxels = sum(~isnan(quantizedM(:)));
dirFlag = 1; % 1: 3-d, 2: 2-d
offsetsM = getOffsets(dirFlag);
rlmType= 1; % 1: combine, 2: separate GLCMs
rlmM = calcRLM(quantizedM, offsetsM, numGrLevels, rlmType);
rlmFeatC = {'sre', 'lre', 'gln', 'glnNorm', 'rln', 'rlnNorm', 'rp', 'lglre',...
'hglre', 'srlgle', 'srhgle', 'lrlgle', 'lrhgle', 'glv', 'rlv', 're'};
rlmFlagS = cell2struct(num2cell(ones(size(rlmFeatC))),rlmFeatC,2);
featureS = rlmToScalarFeatures(rlmM, numVoxels, rlmFlagS);
out = featureS;
end

回答(1 个)

Ayush Modi
Ayush Modi 2023-10-17
Hi Laura,
As per my understanding, you are not able to see any error and MATLAB is running indefinitely. As “planC” is a global variable, I am not able to reproduce the issue at my end.
You can refer the suggested solution in the community to obtain the GLRLM. Please refer the following for the same:
After opening the link, go to the functions tab at the top of the page. You can refer the file named – “grayrlmatrix.m”.
I hope this resolves the issue you were facing.

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by