-
Notifications
You must be signed in to change notification settings - Fork 0
/
unNormCLASSES.m
37 lines (30 loc) · 1.17 KB
/
unNormCLASSES.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
clear all; close all
load('/Users/scott/Dropbox/Experiments/nideco/NIDECO/svca4_thal/svca4_thal.mat')
for fi = 1:numel(svca4.PET_list)
%%% load brain mask %%%
MASK_struct = load_nii(fullfile(svca4.MASK_dir, svca4.MASK_list{fi}));
MASK = single(MASK_struct.img);
%clear MASK_struct
%%% load PET image %%%
PET_struct = load_nii(fullfile(svca4.PET_dir, svca4.PET_list{fi}));
PET = single(PET_struct.img);
svca4.Res = PET_struct.hdr.dime.pixdim([2 4 3]); %
xDim = size(PET,1);
yDim = size(PET,2);
zDim = size(PET,3);
%%%% Normalizing dPET scan
indMASK = find(MASK==1);
for t=1:svca4.nFrames
PET_t = PET(:,:,:,t);
vals = PET_t(indMASK) - mean(PET_t(indMASK));
frameSTD(t) = std(vals(:));
frameMean(t) = mean(PET_t(indMASK));
end
CLASSES = squeeze(nanmean(svca4.classes_it00,1));
repMean = repmat(frameMean,4,1,1);
repSTD = repmat(frameSTD,4,1,1);
indCLASSES(:,:,fi) = (CLASSES.*repSTD)+repMean;
figure; plot(svca4.PET_standardEndTimes,indCLASSES(:,:,fi)')
end
meanCLASSES = squeeze(nanmean(indCLASSES,3));
leg = {'GM' 'WM' 'Blood' 'HSB-thalamus'};