From bde3537bd402d3270e891e5334e088e2d5f0f8ff Mon Sep 17 00:00:00 2001 From: Lisa Date: Thu, 13 Jun 2024 13:37:37 +0200 Subject: [PATCH] Consider three scores of acute behavior --- public/neglect_predict.m | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/public/neglect_predict.m b/public/neglect_predict.m index 267c000..c81d629 100644 --- a/public/neglect_predict.m +++ b/public/neglect_predict.m @@ -1,9 +1,9 @@ -function neglect_predict(fnm, acuteCoC) -%Predict chronic neglect using lesion map and acute center of cancellation +function neglect_predict(fnm, acuteCoCl, acuteCoCb, acuteCop) +%Predict chronic neglect using lesion map and acute behavior % Assumes lesion map is normalized to 181x217x181 using SPM %Examples % neglect_predict; %use GUI; -% neglect_predict('M2095_lesion.nii.gz', 0.65) +% neglect_predict('example_lesion.nii.gz', 0.87, 0.81, 2) if nargin < 1 [p_file, p_path] = uigetfile('*.nii.gz;*.nii', 'Select lesion map'); if p_file==0 @@ -11,17 +11,31 @@ function neglect_predict(fnm, acuteCoC) end fnm = fullfile(p_path, p_file); end - if nargin < 2 - prompt = {'Enter acute CoC score (-1..1):'}; + if nargin < 3 + prompt = {'Enter acute CoC score [letters] (-1..1):', 'Enter acute CoC score [bells] (-1..1):', 'Enter acute Copying score (0..8):'}; dlgtitle = 'Input'; fieldsize = [1]; - definput = {'0.65'}; + definput = {'0.87', '0.81', '2'}; answer = inputdlg(prompt,dlgtitle,fieldsize,definput); if length(answer) == 0 return end - acuteCoC = str2double(answer{1}); + acuteCoCl = str2double(answer{1}); + acuteCoCb = str2double(answer{2}); + acuteCop = str2double(answer{3}); + end + % calculate mean CoC score + if (isnan(acuteCoCl)) && (isnan(acuteCoCb)) + error('Enter at least one acute CoC score.') + else + acuteCoC = mean([acuteCoCl, acuteCoCb], 'omitnan'); end + % calculate acute z-score based on user input + acuteZl = (acuteCoCl - 0.00686)/0.0179; % mean/SD of controls + acuteZb = (acuteCoCb - 0.0092)/0.0253; % mean/SD of controls + acuteZCop = (acuteCop - 0.23333)/0.43018; % mean/SD of controls + acuteZ = mean([acuteZl, acuteZb acuteZCop], 'omitnan'); + lesion = niftiread(fnm); mpath = fileparts(mfilename("fullpath")); fnmMsk = fullfile(mpath, 'mask.nii.gz'); @@ -61,7 +75,6 @@ function neglect_predict(fnm, acuteCoC) acuteCoC01 = norm0to1(acuteCoC, -0.024243014, 0.951938077); ROI_volML01 = norm0to1(ROI_volML, 0, 21.625); % input_vector = [PC1, PC2, PC3, PC4, PC5, CoC, ROI_vol]; - % Exemplary patient data (with outcome = 0.8155): input_vector = [PC(1), PC(2), PC(3), PC(4), PC(5), acuteCoC01, ROI_volML01]; fnmModel = fullfile(mpath, 'models_5x10_diff.mat'); if ~exist(fnmPCA,'file') @@ -91,14 +104,10 @@ function neglect_predict(fnm, acuteCoC) % Calculate mean prediction prediction_mean = mean(predictions_mdls); diffZ = prediction_mean * (38.72560594 + 1.211389735) - 1.211389735; - % calculate acute z-score based on user input CoC - acuteZ = (acuteCoC - 0.00803)/0.0216; % mean/SD of controls % calculate chronic z-score that can be interpreted by the user chronZ = acuteZ-diffZ; - chronCoC = chronZ * 0.0216 + 0.00803; + chronCoC = chronZ * 0.0216 + 0.00803; % average of letters and bells % output text - % "Acute z-score = xxx; z-score difference (predicted) = xxx; chronic z-score = xxx. - % The predicted score represents the direct improvement between acute and chronic stroke phase (i.e. acute z-score minus chronic z-score). Negative values and a z-score % of about 0 indicate no deficit; the larger the z-score, the more severe the neglect behavior." str = sprintf('Given %gml lesion (with %g in core neglect voxels), and acute CoC %g (z= %g), predicted chronic CoC is %g (z= %g)\n', lesionVolTotalML, ROI_volML, acuteCoC, acuteZ, chronCoC, chronZ); disp(str); end