Matlab CERR Gray Level Run Length Matrix

2 vues (au cours des 30 derniers jours)
Laura Romero Crespo
Laura Romero Crespo le 4 Juil 2022
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

Réponses (1)

Ayush Modi
Ayush Modi le 17 Oct 2023
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.

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by