matlab 使用radiomics包时输入参数不足

olhwl3o2  于 2023-03-19  发布在  Matlab
关注(0)|答案(2)|浏览(250)

我尝试使用radiomics包(https://www.mathworks.com/matlabcentral/fileexchange/51948-radiomics)运行GLCM,使用以下代码:

volume = double(rgb2gray(imread('http://www.cs.sjsu.edu/~bruce/images/fall_2016_cs160/lectures/eye_pupil_tracking/grayscale_eye_cropped_to_bounding_box.png')));
mask = ones(size(volume,1),size(volume,2));
[ROIonly,levels] = prepareVolume(volume,mask,'Other','Matrix','Uniform',32);
[GLCM] = getGLCM(ROIonly,levels);

出现以下错误:
输入参数不足。
如果出现~strcmp(文本类型,“全局”)&& ~strcmp(文本类型,“矩阵”),则prepareVolume(第110行)出错
无标题错误(第7行)[仅ROI,水平] =准备体积(体积,掩码,“其他”,“矩阵”,“均匀”,32);
我该怎么修呢?

ojsjcaue

ojsjcaue1#

prepareVolume的函数定义如下:

prepareVolume(volume,mask,scanType,pixelW,slices,R,scale,textType,quantAlgo,Ng)

第8个输入为textType
调用时只提供了6个输入

prepareVolume(volume,mask,'Other','Matrix','Uniform',32);

因此,该错误准确地描述了发生了什么问题
输入参数不足。
只有第9个和第10个输入是可选的,正如函数if nargin > 8中的第3个实际代码行所捕获的,但是,第一个代码行使用textType,并且总是假设它已经作为输入传递。

2mbi3lxu

2mbi3lxu2#

正如我所看到的,这个错误是由于没有为radiomics包中的prepareVolume函数提供足够的输入参数引起的。具体来说,这个错误说没有足够的输入参数,您可以在这里的注解中看到文档。为了便于理解,prepareVolume函数需要8个输入参数,而不是您提供的6个参数。

% -------------------------------------------------------------------------
% INPUTS:
% - volume: 2D or 3D array containing the medical images to analyze
% - mask: 2D or 3D array of dimensions corresponding to 'volume'. The mask 
%         contains 1's in the region of interest (ROI), and 0's elsewhere.
% - scanType: String specifying the type of scan analyzed. Either 'PETscan', 
%             'MRscan' or 'Other'.
% - pixelW: Numerical value specifying the in-plane resolution (mm) of 'volume'.
% - sliceS: Numerical value specifying the slice spacing (mm) of 'volume'.
%           Put a random number for 2D analysis.
% - R: Numerical value specifying the ratio of weight to band-pass coefficients 
%      over the weigth of the rest of coefficients (HHH and LLL). Provide R=1 
%      to not perform wavelet band-pass filtering.    
% - scale: Numerical value specifying the scale at which 'volume' is isotropically 
%          resampled (mm). If a string 'pixelW' is entered as input, the
%          volume will be isotropically resampled at the initial in-plane
%          resolution of 'volume' specified by 'pixelW'.
% - textType: String specifying for which type of textures 'volume' is 
%             being prepared. Either 'Global' or 'Matrix'. If 'Global', the 
%             volume will be prepared for Global texture features computation. 
%             If 'Matrix',the volume will be prepared for matrix-based texture 
%             features computation (i.e. GLCM, GLRLM, GLSZM, NGTDM).
% - quantAlgo: String specifying the quantization algorithm to use on 'volume'. 
%              Either 'Equal' for equal-probability quantization, 'Lloyd'
%              for Lloyd-Max quantization, or 'Uniform' for uniform quantization.
%              Use only if textType is set to 'Matrix'.
% - Ng: Integer specifying the number of gray levels in the quantization process.
%       Use only if textType is set to 'Matrix'.
% -------------------------------------------------------------------------

该错误还表明问题与textType参数有关,该参数是函数定义中的第8个参数。因此,应确保提供所有必需的参数,如scaletextType,并确保按正确的顺序提供这些参数。
下面是prepareVolume函数的用法示例:

[ROIonly] = prepareVolume(volume,mask,'PETscan',4,3.27,2,'pixelW','Global')

在本例中,prepareVolume函数准备volume,以便在与面内分辨率相等的比例下进行全局纹理分析,R=2。该函数将返回ROIonly属性,该属性是包含从volume提取的ROI的3D矩阵。

相关问题