Sheeba,
If using a recent MATLAB version, see the reference here:
http://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=ind06&L=SPM&P=R545647&I=-3
&m=24282
When I change the spm_dicom_headers.m code's fread of type 'char' to
'uint8', then that makes the MATLAB 7.3 version run as suggested here:
http://www.mathworks.com/support/solutions/data/1-2782ZU.html?solution=1
-2782ZU
If 64-bit, you may need to recompile your mex functions.
Should none of that work, you may have to trap the error to see which
DICOM header group/element is causing the problem. If you edit
spm_dicom_headers.m and uncomment the 7th line (fprintf) of the
read_dicom_function, that may identify the problematic DICOM/group
element. Attached are the changes I had to make to the SPM2 code to
account for a few local unexpected header settings.
Good luck!
Kathy Pearson
WFUHS Radiology
________________________________________
-----Original Message-----
From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]]
On Behalf Of Sheeba Arnold
Sent: Friday, June 29, 2007 10:57 AM
To: [log in to unmask]
Subject: Re: [SPM] DICOM convert error
Dear John,
Thank you very much for looking into this!!
I'm using SPM2. I downloaded the most recent version again and I'm
getting the
same error. The line numbers are different now.
I also noticed during debugging that the hdr.CSAImageHeaderInfo of the
dicom
image was not in readable format.. AcquisitionMatrix was 64*64s (instead
of
64*64) and I'm not sure if this has anything to do with it..
??? Reference to non-existent field 'name'.
Error in ==> spm_dicom_convert>get_numaris4_val at 653
if strcmp(deblank(str(i).name),name),
Error in ==> spm_dicom_convert>read_AcquisitionMatrixText at 639
val = get_numaris4_val(str,'AcquisitionMatrixText');
Error in ==> spm_dicom_convert>select_mosaic_images at 541
isempty(read_NumberOfImagesInMosaic(hdr{i}))
Error in ==> spm_dicom_convert at 35
[mosaic,standard] = select_mosaic_images(images);
Error in ==> spm_DICOM at 8
spm_dicom_convert(hdr)
Error in ==> spm at 1183
evalin('base',varargin{2}(i).prog)
??? Error while evaluating uicontrol Callback.
Best Regards,
Sheeba
Quoting "Ashburner John (PSYCHOLOGY)"
<[log in to unmask]>:
> Which version of SPM are you using? In the current version, the line
> numbers do not match the ones in your error message.
>
> Best regards,
> -John
>
> -----Original Message-----
> From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]]
> On Behalf Of Sheeba Arnold
> Sent: Wednesday, June 27, 2007 6:59 PM
> To: [log in to unmask]
> Subject: Re: [SPM] DICOM convert error
>
> Hi,
>
> Here's the error message-
>
> ??? Reference to non-existent field 'name'.
>
> Error in ==> spm_dicom_convert>get_numaris4_val at 457
> if strcmp(deblank(str(i).name),name),
>
> Error in ==> spm_dicom_convert>read_AcquisitionMatrixText at 446
> val = get_numaris4_val(str,'AcquisitionMatrixText');
>
> Error in ==> spm_dicom_convert>select_mosaic_images at 350
> isempty(read_NumberOfImagesInMosaic(hdr{i}))
>
> Error in ==> spm_dicom_convert at 18
> [mosaic,standard] = select_mosaic_images(images);
>
> Error in ==> spm_DICOM at 8
> spm_dicom_convert(hdr)
>
> Error in ==> spm at 1183
> evalin('base',varargin{2}(i).prog)
>
> ??? Error while evaluating uicontrol Callback.
>
> Thanks and Regards,
> Sheeba
>
SPM2 spm_dicom_headers.m changes:
while ~isempty(tag) && ~(tag.group==65534 && tag.element==57357), % && tag.length==0),
%
% --------------------------------------------------------------------
% WFU changes
%
% (1) Read tag.vr of character string types with uint8 instead of *char,
% and then convert to char. This prevents an error when reading the
% "A-circumflex" character (hex c2, decimal 194) as found in:
% 0051,1002 LO [Apparent Diffusion Coefficient (mÂâÁý/s)]
%
% (2) Add try/catch on tag.vr if IS or DS, and keep char input when
% error. This avoids a halt on reading these LO types set
% incorrectly by the DICOM vendor to:
% 0043,1082 IS
% 0043,1097 DS
%
% --------------------------------------------------------------------
%
switch tag.vr,
case {'UN'},
% Unknown - read as char
dat = fread(fp,tag.length,'uint8')';
case {'AE', 'AS', 'CS', 'DA', 'DS', 'DT', 'IS', 'LO', 'LT',...
'PN', 'SH', 'ST', 'TM', 'UI', 'UT'},
% Character strings
% dat = fread(fp,tag.length,'*char')';
dat = fread(fp,tag.length,'uint8')';
dat = char(dat);
switch tag.vr,
case {'UI','ST'},
dat = deblank(dat);
case {'DS'},
% dat = strread(dat,'%f','delimiter','\\')';
indat = dat;
try
dat = strread(dat,'%f','delimiter','\\')';
catch
warning('trouble reading vr tag %s from str %s @ (%.4x,%.4x)', ...
tag.vr, indat, tag.group, tag.element);
dat = indat;
end
case {'IS'},
% dat = strread(dat,'%d','delimiter','\\')';
indat = dat;
try
dat = strread(dat,'%d','delimiter','\\')';
catch
warning('trouble reading vr tag %s from str %s @ (%.4x,%.4x)', ...
tag.vr, indat, tag.group, tag.element);
dat = indat;
end
|