-
Notifications
You must be signed in to change notification settings - Fork 14
/
open_dicom.m
37 lines (28 loc) · 940 Bytes
/
open_dicom.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
try
osInfo=computer('arch');
if strfind(osInfo,'win')
cd('D:\') % go to assumed CD drive on PC
elseif strfind(osInfo,'mac')
cd('...') % go to assumed CD drive on MAC
end
dirlisting=dir(); % list CD directory
catch % if that fails
disp('please select DICOM folder');
folder_name = uigetdir('','please select DICOM folder'); %ask user for DICOM directory
end
if sum(~cellfun('isempty',strfind({dirlisting.name},'DICOM')))
folder_name='D:\DICOM';
else
disp('please select DICOM folder');
folder_name = uigetdir('','please select DICOM folder');
end
%ask user for output directory
output_folder_name = uigetdir('','please select folder to write to');
dirlisting=dir(folder_name);
%...
info = dicominfo([dir '\' dirlisting(3).name])
if strfind(info.SeriesDescription,'diff')
elseif ...
I = dicomread(info);
dicomwrite(I,[output_folder_name '\' filename],info)
end