-
Notifications
You must be signed in to change notification settings - Fork 1
/
DMdicomread.m
35 lines (33 loc) · 1019 Bytes
/
DMdicomread.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function imageData = DMdicomread(fileName_or_metaHeader)
% DMdicomread Reads image data from a Dicom file
%
% Usage:
% imageData = DMdicomread(fileName)
% fileName: path and filename of the file to test
%
% imageData = DMdicomread(metaheader)
% metaheader: structure returned from DMdicominfo
%
% Returns:
% The pixel data
%
%
%
% Licence
% -------
% Part of DicoMat. https://github.com/tomdoel/dicomat
% Author: Tom Doel, 2013. www.tomdoel.com
% Distributed under the BSD 3-Clause license. Please see the file LICENSE for details.
%
if isstruct(fileName_or_metaHeader)
fileName = fileName_or_metaHeader.Filename;
else
fileName = fileName_or_metaHeader;
end
header = DMReadDicomTags(fileName, DMDicomDictionary.EssentialDictionary);
if isfield(header, 'PixelData')
imageData = header.PixelData;
else
imageData = [];
end
end