Can't open files
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm not really familiar with MATLAB, but I need it to extract some information for my project.
I'm using a code (CGITA) that aimes to open and analys medical images (DICOM).
But I'm not able to open these images as I got the following error:
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in parse_directory_for_dicom (line 97)
fileinfo.PatientName.GivenName = 'N/A';
Error in CGITA_GUI>load_Primary_btn_Callback (line 450)
[filelist fusion_filelist] = parse_directory_for_dicom(Primary_dir);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in CGITA_GUI (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)CGITA_GUI('load_Primary_btn_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
Appreciate your help.
4 个评论
Rik
2019-7-9
This code seems very much a work in progress. There is a lot of commented code, and not all comments accurately describe what the code is doing.
The Image Processing Toolbox function dicominfo apparently has a different output from that custom function dcmreadfile. The code below should reproduce your error.
clc
clear fileinfo
fileinfo.PatientName='foo';
if ~isfield(fileinfo.PatientName, 'GivenName')
fileinfo.PatientName.GivenName = 'N/A';
else
disp('condition returned false')
end
This example shows the probable root cause: fileinfo.PatientName is already a char array, instead of a struct, as that assignment assumes.
mahmoud hafez
2023-2-4
This code old work and agree with old Matlab version, so, you can use an older version of MATLAB to avoid this error.
回答(1 个)
Image Analyst
2023-2-4
Try changing the first few lines of the function to this
function varargout = parse_directory_for_dicom(dirname)
dirListing = dir(fullfile(dirname, '*.dcm'));
all_files_list = fullfile(dirname, {dirListing.name})
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!