a b/Image Segmentation/Image Utility Functions/loading/loadDicom.m
1
function [ dicomImage,dicomInfo,map,alpha,overlays ] = loadDicom(imageName)
2
%LoadDICOM Summary of this function goes here
3
%   Simple script that loads a dicom image and provides the header 
4
%   information in one function call
5
%   param imageName
6
%             imageName should be a string that contains the path to the 
7
%             dicom image, include the file extension also (*.dcm)
8
%   return dicomInfo
9
%            Returns dicom image headers information
10
%   return dicomImage
11
%            Returns the actual dicom image to be used
12
%   
13
%   [X, MAP, ALPHA, OVERLAYS] = DICOMREAD(...) also returns any overlays
14
%   from the DICOM file.  Each overlay is a 1-bit black and white image
15
%   with the same height and width as X.  If multiple overlays are present
16
%   in the file, OVERLAYS is a 4-D multiframe image.  If no overlays are in
17
%   the file, OVERLAYS is empty.
18
%
19
%Path to an example image:
20
%\\ailab03\LIDC\LIDC_FULL\LIDC-IDRI\exctract\crops\1.dcm
21
22
23
%PFS 2:38 6/25/2013
24
%Try/Catch block for file validation
25
%WHEN YOU READ IN A FILE YOU MIGHT WANT TO CHECK IT, BRO
26
try
27
    %Gather the information on the dicom file and read it
28
    dicomInfo = dicominfo(imageName);
29
    [dicomImage,map,alpha, overlays] = dicomread(dicomInfo);
30
catch ME
31
    %If the file is not a dicom file, then print out the warning
32
    warning(ME.message);
33
    rethrow(ME);
34
end
35
36
37
end
38