Skip to content

Commit

Permalink
Consider three scores of acute behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
lisaroehrig authored Jun 13, 2024
1 parent 15f92d0 commit bde3537
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions public/neglect_predict.m
Original file line number Diff line number Diff line change
@@ -1,27 +1,41 @@
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
return
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');
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bde3537

Please sign in to comment.