-
Notifications
You must be signed in to change notification settings - Fork 2
/
Conc_Map_Generation.m
58 lines (46 loc) · 2.06 KB
/
Conc_Map_Generation.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%% This function generates concentration Maps of all metabolites.
% Inputs: P info struct, All concentration values parsed from LCModel output files.
% Conc maps only shows the concentration values of the included voxel to the analysis.
% All maps will be saved under ~nifti/conc_maps folder as a nifti file.
% Author: Sevim Cengiz, Bogazici University , 2020
% Contact: [email protected]
function Conc_Map_Generation(Pinfo,AllConc,coreg_path,Metabolites,includedvoxels)
[sli row col]=size(Pinfo.littlevoxels);
fcsf=Pinfo.frac_CSF;
litvox_pixloc=Pinfo.metab;
metno=size(Metabolites);
for n=1:metno(1,2)
MRIFOVMask_file=load_untouch_nii([coreg_path,filesep,Pinfo.sparname,'_FOV_mask.nii']); %newlyadded
im_size=size(MRIFOVMask_file.img);
MRIFOVMask_file.img=zeros(im_size);
MRIpressMask_file=load_untouch_nii([coreg_path,filesep,Pinfo.sparname,'_',Metabolites(n).name,'_PressBox_mask.nii']);
%% LCModel concentration results are used after exclusion criteria.
for isli=1:sli
for irow=1:row
for icol=1:col
if includedvoxels(n,isli,irow,icol)==1
loc=litvox_pixloc(1).littlevoxels(isli,irow,icol).loc;
[xx,yy] =size(loc);
for kk=1:xx
locations=loc(kk,:);
lx=locations(1,1);
ly=locations(1,2);
lz=locations(1,3);
MRIFOVMask_file.img(lx,ly,lz)=AllConc(n,isli,irow,icol);
end
end
end
end
end
out_mask=[Pinfo.spectrapath,filesep,'nifti',filesep,'conc_maps'];
if ~exist(out_mask,'dir')
mkdir(out_mask);
end
Mask_path=[out_mask,filesep,Pinfo.sparname,'_',Metabolites(n).name,'_conc.nii'];
mask=(MRIFOVMask_file.img.*MRIpressMask_file.img);
MRIFOVMask_file.img=mask;
MRIFOVMask_file.untouch=1;
MRIFOVMask_file.fileprefix= Mask_path;
save_untouch_nii(MRIFOVMask_file, Mask_path)
end
%% kk