classdef CardiacPhase < Phase properties FullPhase = Phase; SelectedPhase = []; SystolePositions = []; DiastolePositions = []; end methods %constructor function obj=CardiacPhase(Phase) if nargin==0;return;end % gets properties of superclass obj.FullPhase = Phase.Values; obj.WorkLoad = Phase.WorkLoad; obj.Video = Phase.Video; end % % methods %set methods % % function set.ToBeSetByUser(obj,val) % % if ~isboolean(val);error('provide a boolean value please');end % % obj.ToBeSetByUser=val; % % end % end % % Choose the correct IMF depending on the work load function SelectPhase(obj) if strcmp(obj.WorkLoad,'Rest') imf_number = 3; else if strcmp(obj.WorkLoad,'Exercise') imf_number = 2; else if strcmp(obj.WorkLoad,'Continuous Acquisition') imf_number = 3; end end end obj.SelectedPhase = obj.FullPhase(imf_number,:); % Phase corresponding to the cardiac phase end % Detects the frame's positions of diastolic events function Diastole(obj) max_heart_phase = max(obj.SelectedPhase); % cardiac phase maxima treshold_diast = 0.8*max_heart_phase; % diastole treshold index1 = obj.SelectedPhase > treshold_diast; % frames with phase above the diastolic treshold indexNumeric1 = find(index1); values1 = obj.SelectedPhase(indexNumeric1); [ordered_values1 oredered_index1] = sort(values1); obj.DiastolePositions = indexNumeric1(oredered_index1); % sorts the frames in ascending cardiac phase end % Detects the frame's positions of systolic events function Systole(obj) min_heart_phase = min(obj.SelectedPhase); % cardiac phase minima treshold_syst = 0.8*min_heart_phase; % systole treshold index2 = obj.SelectedPhase < treshold_syst; % frames with phase below the systolic treshold indexNumeric2 = find(index2); values2 = obj.SelectedPhase(indexNumeric2); [ordered_values2 oredered_index2] = sort(values2); obj.SystolePositions = indexNumeric2(oredered_index2); % sorts the frames in ascending cardiac phase end end end