-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
3,822 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
clc;clear all;close all; | ||
load D:\ZCL\课题-纹理特征\codes\codes\select_feature.mat; | ||
load D:\ZCL\课题-纹理特征\codes\codes\selectROI.mat; | ||
load D:\ZCL\课题-纹理特征\codes\codes\method.mat; | ||
path = 'D:\ZCL\课题-纹理特征\graymatrixdata\graymatrixdata\original_excel_data\NC'; | ||
cd(path); | ||
method(4)={'Trace'}; | ||
savemat = zeros(17,231); | ||
savemat(2:17,1)=1:16; | ||
num = 1; | ||
for i = 1:4 | ||
cd(char(method(i))); %进入第i个方法 | ||
for j = 1:23 %23个区域 | ||
for k =1:10 | ||
%savemat(1,k*j+1)=char(select_feature(k)); | ||
savemat(2:17,num+1)=xlsread (char(strcat(roi(j),'.xlsx')),char(strcat(select_feature(k))),'A21:A36'); | ||
num=num+1; | ||
end | ||
end | ||
save savemat | ||
cd (path); %返回目录 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Hippocampus 75 76 282 284 | ||
splenium of corpus callosum 127 128 | ||
Genu of corpus callosum left 123 124 | ||
Parietal_R 24 28 30 32 34 | ||
Temporal_L 35 37 39 41 43 | ||
Occipital_L 51 53 55 57 59 | ||
Occipital_R 52 54 56 58 60 | ||
Insula_L 71 | ||
Insula_R 72 | ||
GP_L globus pallidus left 81 | ||
Thalamus_L 83 | ||
Thalamus_R 84 | ||
FrontalLateralVentricle_L 171 | ||
PosteriorLateralVentricle_L 173 174 | ||
InferiorLateralVentricle_R 180 | ||
FrontalLateralVentricle_R 176 | ||
PosteriorLateralVentricle_R 178 179 | ||
PeripheralFrontalWM_L 186 188 190 192 194 196 198 200 202 204 206 210 | ||
PeripheralFrontalWM_R 187 189 191 193 195 197 199 201 203 205 207 211 | ||
PeripheralParietalWM_L 155 208 212 214 216 218 | ||
PeripheralParietalWM_R 156 209 213 215 217 219 | ||
PeripheralTemporalWM_L 220 222 224 226 228 230 | ||
ALIC 131 132 | ||
PLIC 133 134 | ||
Caud 77 78 | ||
Thal 83 84 | ||
Ventrical 171 172 173 174 175 176 177 178 179 180 181 285 286 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
clc; | ||
clear; | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr('E:\biomedical signal\0306_atlas_DICE\286L\a13_800001NC_286L.hdr'); | ||
[seg,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
seg=double(seg); | ||
[a,b,c]=size(seg); | ||
slice=34; | ||
loc=find(seg==83|seg==84); | ||
volume=numel(loc); | ||
mask=zeros(a,b,c); | ||
mask(loc)=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
clc; | ||
clear; | ||
|
||
|
||
addpath('D:\JHU_AD\codes\functions'); | ||
s01='800070'; | ||
s02='061114'; | ||
s1=['D:\JHU_AD\AD\',s01,'_',s02,'\T1_T2_DTI_ResampledImage_InSameSpace']; | ||
path0=strcat('D:\JHU_AD\AD\',s01,'_',s02,'\Result',s01,'\output\MNI_Shifted_Rotated_Axial_',s01,'_',s02,'_T1_brainmask_286Labels.hdr'); | ||
path1=strcat(s1,'\affine_MD.hdr'); | ||
path2=strcat(s1,'\affine_B0.hdr'); | ||
path3=strcat(s1,'\affine_FA.hdr'); | ||
path4=strcat(s1,'\affine_TRACE.hdr'); | ||
|
||
|
||
source=('D:\JHU_AD\codes\ventricle2'); | ||
destination=strcat('D:\JHU_AD\analysis\',s01,'AD\'); | ||
|
||
|
||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path0); | ||
[seg,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path1); | ||
[MD,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path2); | ||
[B0,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path3); | ||
[FA,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path4); | ||
[TRACE,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
seg=double(seg); | ||
MD=double(MD); | ||
B0=double(B0); | ||
FA=double(FA); | ||
TRACE=double(TRACE); | ||
[a,b,c]=size(seg); | ||
slice=34; | ||
|
||
loc=find(seg>=171 & seg<=181|seg==285|seg==286); | ||
|
||
mkdir('D:\JHU_AD\codes\ventricle2'); | ||
cd('D:\JHU_AD\codes\ventricle2'); | ||
|
||
volume=numel(loc); | ||
save volume volume; | ||
mask=zeros(a,b,c); | ||
mask(loc)=1; | ||
|
||
|
||
M_target1=mask.*B0; | ||
B0_data=nonzeros(M_target1); | ||
save B0_data B0_data; | ||
|
||
M_target2=mask.*FA; | ||
FA_data=nonzeros(M_target2); | ||
save FA_data FA_data; | ||
|
||
M_target3=mask.*TRACE; | ||
TRACE_data=nonzeros(M_target3); | ||
save TRACE_data TRACE_data; | ||
|
||
M_target4=mask.*MD; | ||
MD_data=nonzeros(M_target4); | ||
save MD_data MD_data; | ||
|
||
figure(1); | ||
f_B0=plotGMM(B0_data); | ||
title('B0'); | ||
print(1, '-dpng', 'B0'); | ||
save f_B0 f_B0; | ||
|
||
|
||
figure(2); | ||
f_FA=plotGMM(FA_data); | ||
title('FA'); | ||
print(2, '-dpng', 'FA'); | ||
save f_FA f_FA; | ||
|
||
figure(3); | ||
f_TRACE=plotGMM(TRACE_data); | ||
title('TRACE'); | ||
print(3 ,'-dpng', 'TRACE'); | ||
save f_TRACE f_TRACE; | ||
|
||
figure(4); | ||
f_MD=plotGMM(MD_data); | ||
title('MD'); | ||
print(4 ,'-dpng', 'MD'); | ||
save f_MD f_MD; | ||
|
||
movefile(source,destination); | ||
|
||
% MEAN=mean(DATA); | ||
% VAR=var(DATA); | ||
|
||
% result=plotGMM(DATA); | ||
|
||
% DATA_DWI=zeros(volume,slice); | ||
% for i=2:slice | ||
% DATA_DWI(:,i)=nonzeros(mask.*DWI_4D(:,:,:,i)); | ||
% | ||
% M_DWI(i-1)=mean(mean(DATA_DWI(:,i))); | ||
% | ||
% end | ||
% M_DWI=(M_DWI-min(M_DWI))/(max(M_DWI)-min(M_DWI)); | ||
% figure;plot(M_DWI); | ||
% FP=zeros(slice,6); | ||
% for i=2:slice | ||
% DATA_DWI(:,i)=nonzeros(mask.*DWI_4D(:,:,:,i)); | ||
% result=plotGMM(DATA_DWI(:,i)); | ||
% FP(i,:)=[result.mu,result.sigma,result.phi]; | ||
% end | ||
% FP1=FP(2:slice,:); | ||
% FP2=FP1(:); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
for i = 1:28; | ||
for j = 1:4; | ||
clc; | ||
clearvars -except i j; | ||
filespath_excel='I:\Data\AD'; | ||
filenames_excel=dir(filespath_excel); | ||
filenames_excel=struct2cell(filenames_excel); | ||
filenames_excel=filenames_excel(1,3:20)'; | ||
%roi_name = raw1; | ||
peoplenum = filenames_excel(1:18,1); | ||
load('I:\Data\codes\roi_name'); | ||
stat_header = load('I:\Data\codes\stat_header'); | ||
method = load('D:\Documents\MatlabCode\dtireference\method'); | ||
write_co = load('I:\Data\codes\write_co'); | ||
|
||
roi_load=char(roi_name(i)); %当前ROI的名称 | ||
destination=cell(28,1); | ||
source = cell(4,1); | ||
|
||
temp = method.method; | ||
source{j,1} = strcat('I:\Data\graymatrixdata\NC\',temp{j,1},'\',roi_load,'.xlsx'); %读取目标excel文件 | ||
destination{i,1}=strcat('I:\Data\graymatrixdata\NC2\',temp{j,1},'\',roi_load,'.xlsx'); | ||
header = stat_header.txt1; | ||
coordinate = write_co.write_co; | ||
xlRange = 'B2:IA19'; | ||
|
||
%ans_Range = 'B2'; | ||
for sheet = 1:22; | ||
aveSheet = sheet+1; | ||
[num,txt,raw] = xlsread(source{j,1},aveSheet,xlRange); | ||
%ans_Range = coordinate{sheet-1,1}; | ||
sheetname = header{sheet}; | ||
xlswrite(destination{i,1},num,sheetname,'B2'); | ||
xlswrite(destination{i,1},peoplenum,aveSheet,'A2'); | ||
for number = 1:18; | ||
peopletemp = nanmean(num(number,:)); | ||
numbertemp = int2str(20+number); | ||
location = strcat('A',numbertemp); | ||
xlswrite(destination{i,1},peopletemp,aveSheet,location); | ||
end | ||
end | ||
|
||
end | ||
system('tskill excel'); | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
|
||
%for i=1:17; | ||
i=5; | ||
for j=1:27; | ||
% j=1; | ||
clc; | ||
clearvars -except i j; | ||
|
||
addpath('K:\Data\JHU_AD\codes\functions'); | ||
load('K:\Data\JHU_AD\codes\num.mat'); | ||
load('K:\Data\JHU_AD\codes\roi_name'); | ||
filespath='K:\Data\JHU_AD\data\AD'; | ||
filenames=dir(filespath); | ||
filenames=struct2cell(filenames); | ||
filenames=filenames(1,3:18)'; | ||
|
||
|
||
roi_cur=char(roi_name(j)); %当前ROI的名称 | ||
roi_num=num(j,:) %当前ROI所对应的区域 | ||
roi_num(find(roi_num==0))=287; | ||
|
||
file_cur=char(filenames(i,1)); | ||
display(file_cur); | ||
s01=file_cur(1:6); | ||
s02=file_cur(8:13); | ||
s1=['K:\Data\JHU_AD\data\AD\',s01,'_',s02,'\T1_T2_DTI_ResampledImage_InSameSpace']; | ||
path0=strcat('K:\Data\JHU_AD\data\AD\',s01,'_',s02,'\',s01,'\output\MNI_Shifted_Rotated_Axial_',s01,'_',s02,'_T1_brainmask_286Labels.hdr'); | ||
path1=strcat(s1,'\affine_MD.hdr'); | ||
path2=strcat(s1,'\affine_B0.hdr'); | ||
path3=strcat(s1,'\affine_FA.hdr'); | ||
path4=strcat(s1,'\affine_TRACE.hdr'); | ||
|
||
|
||
source=strcat('K:\Data\JHU_AD\codes\',roi_cur); | ||
destination=strcat('K:\Data\JHU_AD\analysis\',s01,'NC\'); | ||
|
||
|
||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path0); | ||
[seg,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path1); | ||
[MD,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path2); | ||
[B0,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path3); | ||
[FA,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
[hdr,filetype,fileprefix,machine] = load_nii_hdr(path4); | ||
[TRACE,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); | ||
seg=double(seg); | ||
MD=double(MD); | ||
B0=double(B0); | ||
TRACE=double(TRACE); | ||
FA=double(FA); | ||
[a,b,c]=size(seg); | ||
|
||
%找到指定的ROI区域 | ||
loc=find(seg==roi_num(1)|seg==roi_num(2)|seg==roi_num(3)|seg==roi_num(4)|seg==roi_num(5)|seg==roi_num(6)|seg==roi_num(7)|seg==roi_num(8)|seg==roi_num(9)|seg==roi_num(10)|seg==roi_num(11)|seg==roi_num(12)|seg==roi_num(13)); | ||
|
||
|
||
mkdir(source);%创建新目录 | ||
cd(source);%进入新目录路径 | ||
|
||
volume=numel(loc); %确定ROI区域的像素数 | ||
save volume volume; | ||
mask=zeros(a,b,c); | ||
mask(loc)=1; | ||
|
||
|
||
M_target1=mask.*B0; | ||
B0_data=nonzeros(M_target1); %将掩膜叠加后把不为零的位置提取出来 | ||
save B0_data B0_data; | ||
|
||
M_target3=mask.*TRACE; | ||
TRACE_data=nonzeros(M_target3); | ||
save TRACE_data TRACE_data; | ||
|
||
M_target4=mask.*MD; | ||
MD_data=nonzeros(M_target4); | ||
save MD_data MD_data; | ||
|
||
M_target2=mask.*FA; | ||
FA_data=nonzeros(M_target2); | ||
save FA_data FA_data; | ||
|
||
figure(1); | ||
f_B0=plotGMM(B0_data); | ||
title('B0'); | ||
print(1, '-dpng', 'B0'); | ||
save f_B0 f_B0; | ||
|
||
figure(2); | ||
f_FA=plotGMM(FA_data); | ||
title('FA'); | ||
print(2, '-dpng', 'FA'); | ||
save f_FA f_FA; | ||
|
||
figure(3); | ||
f_TRACE=plotGMM(TRACE_data); | ||
title('TRACE'); | ||
print(3 ,'-dpng', 'TRACE'); | ||
save f_TRACE f_TRACE; | ||
|
||
figure(4); | ||
f_MD=plotGMM(MD_data); | ||
title('MD'); | ||
print(4 ,'-dpng', 'MD'); | ||
save f_MD f_MD; | ||
|
||
close Figure 1; | ||
close Figure 2; | ||
close Figure 3; | ||
close Figure 4; | ||
|
||
movefile(source,destination); | ||
|
||
end | ||
% end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
%write the ave & std to the excel | ||
% ans_ave_AD = zeros(28,22); | ||
% ans_ave_NC = zeros(28,22); | ||
|
||
for j = 1:4; | ||
for i = 1:28; | ||
load('G:\Data\codes\roi_name.mat'); | ||
roi_load=char(roi_name(i)); | ||
ans_ave_AD = 0; | ||
ans_ave_NC = 0; | ||
source=strcat('G:\Data\graymatrixdata\Bi_ave\Bi_',roi_load,'.xlsx'); | ||
destination =strcat('G:\Data\graymatrixdata\all_average.xlsx'); | ||
readxlRange = 'B2:W37'; | ||
[num1,txt1,raw1] = xlsread(source,j+1,readxlRange); | ||
for k = 1:22; | ||
ans_ave_AD = mean(num1(1:18,k)); | ||
ans_ave_NC = mean(num1(19:36,k)); | ||
AD_range = strcat(char(k+65),int2str(2*i)); | ||
NC_range = strcat(char(k+65),int2str(2*i+1)); | ||
xlswrite(destination,ans_ave_AD,j,AD_range); | ||
xlswrite(destination,ans_ave_NC,j,NC_range); | ||
end | ||
end | ||
system('tskill excel'); | ||
end |
Binary file not shown.
Oops, something went wrong.