|
a |
|
b/main.m |
|
|
1 |
% This program extracts diameter waveform [units of mm] from a movie of |
|
|
2 |
% B-mode images and Blood flow velocity [units of m/s] from pulsed doppler data |
|
|
3 |
% recorded from an ultrasound machine. The code extract ECG as well. |
|
|
4 |
|
|
|
5 |
% Code updates and main contributors. |
|
|
6 |
% [5/28/2021] Anand Chandrasekhar and Syed Muhammad Imaduddin. |
|
|
7 |
% We are using the Helper files from Philips to process the Dicom imges. |
|
|
8 |
|
|
|
9 |
% That said, This program is exclusively for DICOM files created from Philips |
|
|
10 |
% machine, and we have not tested it on files created from other Ultrasound machines. |
|
|
11 |
% If the input data is recorded from machines other than Philips, modify |
|
|
12 |
% the code fragment: Loading_script.m |
|
|
13 |
|
|
|
14 |
% How to use this program ? |
|
|
15 |
% Run: main(); |
|
|
16 |
|
|
|
17 |
% Where are the resuls saved ? |
|
|
18 |
% Output Data will be saved based on the path as per the function |
|
|
19 |
% "script_create_save_path_name". Modify it as per your need. |
|
|
20 |
|
|
|
21 |
% What is the input to the GUI ? |
|
|
22 |
% GUI takes a variable called dpath. |
|
|
23 |
% Set dpath as the absolute path of the DICOM Bmode or Pulsed |
|
|
24 |
% Doppler Data. |
|
|
25 |
|
|
|
26 |
% dpath aka "data path" is the input to the program. dpath, as discussed |
|
|
27 |
% earlier, may be set as the absolute path of the DICOM Bmode or Pulsed |
|
|
28 |
% Doppler Data. You may play arround with some pre-loaded data by setting |
|
|
29 |
% dpath = 1 or 2. |
|
|
30 |
|
|
|
31 |
% if dpath = 1 then: |
|
|
32 |
% I have saved a small file called "bframe_sample.mat" in this |
|
|
33 |
% folder. This file is a B-mode image that is easy to load than other heavy DICOM imges. |
|
|
34 |
% FYI: Result-Data will be plotted, but not saved, for this simulation. |
|
|
35 |
|
|
|
36 |
% if dpath = 2 then: |
|
|
37 |
% I have saved a small file called "pulsed_doppler_frame.mat" in this |
|
|
38 |
% folder. This file is a pulsed doppler data that is easy to load. |
|
|
39 |
% FYI: Result-Data will be plotted, but not saved, for this simulation. |
|
|
40 |
|
|
|
41 |
function main() |
|
|
42 |
|
|
|
43 |
% Force alose the GUI and clear the screen. |
|
|
44 |
% Makes our life easier. |
|
|
45 |
close all force;clc; |
|
|
46 |
|
|
|
47 |
% Thic commnad check if all helper files are added to the main |
|
|
48 |
% directory (pwd) of the project. If these helper folder not |
|
|
49 |
% available, check for "Load_these_folders.zip" and unzip it. |
|
|
50 |
% Report an error if these folders are not avaialble. |
|
|
51 |
script_check_folder_exist; |
|
|
52 |
if No_folder_flag |
|
|
53 |
fprintf('Some helper files from Philips are not available.\n'); |
|
|
54 |
return; |
|
|
55 |
else |
|
|
56 |
fprintf('All helper files from Philips are available.\n'); |
|
|
57 |
end |
|
|
58 |
|
|
|
59 |
% These are the helper files for extracting data from the Philips |
|
|
60 |
% DICOM files. Jonathan (from Philips) provided these scripts. |
|
|
61 |
addpath 'envelope helpers' 'PolarRectangularConv0' 'helpers'; |
|
|
62 |
|
|
|
63 |
% Select the dpath |
|
|
64 |
%dpath = '../../Project_Ultrasound/Data/protocol_D/Experiment_Data/001_MIT/supine_US/IM_0004'; |
|
|
65 |
%dpath = 1; % This is for B-model images |
|
|
66 |
%dpath = 2; % Thi is for Doppler data |
|
|
67 |
|
|
|
68 |
% Check if dpath exist |
|
|
69 |
if ~exist('dpath', 'var') |
|
|
70 |
fprintf('Variable dpath is not set.\n'); |
|
|
71 |
return; |
|
|
72 |
else |
|
|
73 |
% GUI main function call. |
|
|
74 |
fprintf('Opening the GUI.\n'); |
|
|
75 |
if isnumeric(dpath) |
|
|
76 |
Ultrasound_Analyse(dpath); |
|
|
77 |
elseif isfile(dpath) |
|
|
78 |
Ultrasound_Analyse(dpath); |
|
|
79 |
else |
|
|
80 |
fprintf('File not available.\n'); |
|
|
81 |
end |
|
|
82 |
end |
|
|
83 |
|
|
|
84 |
end |