CardiacPhase/Code/test_OOP.m

49 lines
1.9 KiB
Mathematica
Raw Normal View History

2019-05-06 16:34:28 +02:00
% Test Script
% TO DO LIST:
% - Display phases
% - Heart beat reconstruction with steady respiratory phase
% - Multislice analysis
% - Error messages and robustness of the methods
clear classes
phase = Phase; % creates a Phase object
phase.GetData; % extracts data
% Should become a set method
% User sets the workload, important to choose the correct IMF
list = {'Rest','Exercise','Continuous Acquisition'};
[indx,tf] = listdlg('ListString',list);
str = list{indx};
phase.WorkLoad = str;
phase.GetSignal % gets mean intensity level of the images
phase.GetEMD % decompose the siganl using EMD
phase.GetPhase % turn the modes into phase information
cardiac_phase = CardiacPhase(phase) % creates a CradiacPhase object
cardiac_phase.SelectPhase % choose the right imf besed on the work load
cardiac_phase.Diastole % detects diastolic events
cardiac_phase.Systole % detects systolic events
respiratory_phase = RespiratoryPhase(phase) % creates a RespiratoryPhase object
respiratory_phase.SelectPhase % choose the right imf besed on the work load
respiratory_phase.Expiration % detects expirtion moments
respiratory_phase.Inspiration % detects inspiration moments
SI = intersect(cardiac_phase.SystolePositions,respiratory_phase.InspirationPositions); % systole in inspiration
SE = intersect(cardiac_phase.SystolePositions,respiratory_phase.ExpirationPositions); % systole in expiration
DI = intersect(cardiac_phase.DiastolePositions,respiratory_phase.InspirationPositions); % diastole in inspiration
DE = intersect(cardiac_phase.DiastolePositions,respiratory_phase.ExpirationPositions); % diastole in expiration
% Show frames of the different cardiac/respiratory events
phase.ShowFrames(SI,'End-systolic frames in inpiration');
phase.ShowFrames(SE,'End-systolic frames in expiration');
phase.ShowFrames(DI,'End-diastolic frames in inpiration');
phase.ShowFrames(DE,'End-diastolic frames in expiration');
% c = ImageSequence
% c.ToBeSetByUser=15
% c.ToBeSetByUser=true