From 30a18acf7bc54a852beb2104e4588f4cc2249a40 Mon Sep 17 00:00:00 2001 From: Challen <273239067@qq.com> Date: Sun, 14 Jan 2018 14:56:20 +0800 Subject: [PATCH] final update --- .../JHU_level3_m2_52/JHU52_level3_new.node | 53 +++++++++ BrainNet/ROI_coordinate_cal.m | 31 ++++++ BrainNet/new_co.txt | 90 ++++++++++++++++ .../hitsz_gretn_PlotNetwork_2GroupCompare.m | 6 +- ROI_volmue_283_MNI_level2_20.m | 102 ++++++++++++++++++ level5_to_level3_M2_type2.m | 4 +- yecf/coregis_spm12.m | 34 ++++++ 7 files changed, 315 insertions(+), 5 deletions(-) create mode 100644 BrainNet/JHU_level3_m2_52/JHU52_level3_new.node create mode 100644 BrainNet/ROI_coordinate_cal.m create mode 100644 BrainNet/new_co.txt create mode 100644 ROI_volmue_283_MNI_level2_20.m create mode 100644 yecf/coregis_spm12.m diff --git a/BrainNet/JHU_level3_m2_52/JHU52_level3_new.node b/BrainNet/JHU_level3_m2_52/JHU52_level3_new.node new file mode 100644 index 0000000..d1eaf5f --- /dev/null +++ b/BrainNet/JHU_level3_m2_52/JHU52_level3_new.node @@ -0,0 +1,53 @@ +#jhu 52 +27.67 23.2 25.34 1 1 Frontal_L +-28.21 25.58 24.17 1 1 Frontal_R +35.08 -42.2 42.02 1 1 parietal_L +-37.95 -39.27 42.38 1 1 parietal_R +47.35 -24.03 -11.03 1 1 Temporal_L +-49.46 -21.81 -11.8 1 1 Temporal_R +10.88 -15.14 18.13 1 1 Limbic_L +-12.15 -15.48 17.37 1 1 Limbic_R +22.08 -75.10 8.760 1 1 optical_L +-25.04 -73.10 10.15 1 1 optical_R +35.91 5.940 3.410 1 1 Insula_L +-37.65 8.330 1.800 1 1 Insula_R +20.46 3.200 5.520 1 1 BasalGang_L +-22.05 4.620 4.670 1 1 BasalGang_R +10.61 -18.46 8.630 1 1 Thalamus_L +-12.03 -17.64 8.280 1 1 Thalamus_R +14.28 0.3100 -6.310 1 1 BasalForebrain_L +-16.18 1.300 -6.710 1 1 BasalForebrain_R +9.250 -19.02 -7.070 1 1 midbrain_L +-10.60 -19.09 -7.630 1 1 midbrain_R +-21.93 -59.68 -32.92 1 1 cerebellum_L +20.26 -59.68 -32.56 1 1 cerebellum_R +6.790 -27.04 -27.98 1 1 Pons_L +-8.710 -26.86 -28.12 1 1 Pons_R +2.120 -41.64 -51.44 1 1 Medulla_L +-5.640 -40.95 -51.52 1 1 Medulla_R +22.29 15.01 23.93 1 1 AnteriorWM_L +-22.97 15.14 22.37 1 1 AnteriorWM_R +26.80 -33.78 29.34 1 1 PosteriorWM_L +-28.48 -34.25 29.76 1 1 PosteriorWM_R +10.49 -11.37 19.38 1 1 CorpusCallosum_L +-11.07 -11.19 18.45 1 1 CorpusCallosum_R +29.83 -24.93 6.150 1 1 InferiorWM_L +-31.48 -20.92 5.200 1 1 InferiorWM_R +15.47 -13.87 11.59 1 1 LimbicWM_L +-16.74 -13.51 11.74 1 1 LimbicWM_R +15.51 -10.79 12.61 1 1 LatervalVentricle_L +-16.77 -9.380 12.23 1 1 LatervalVentricle_R +-0.8800 -11.54 3.870 1 1 III_ventricle +28.51 28.81 31.43 1 1 FrontSul_L +-29.98 29.32 29.99 1 1 FrontSul_R +40.31 -20.11 52.89 1 1 CentralSul_L +-36.07 -20.00 56.89 1 1 CentralSul_R +51.69 -13.45 5.270 1 1 TempSul_L +-54.19 -10.88 3.120 1 1 TempSul_R +32.04 -47.68 51.70 1 1 parietsul_L +-28.06 -47.03 53.35 1 1 parietsul_R +1.360 5.240 36.99 1 1 CinguSul_L +-2.550 5.190 36.44 1 1 CinguSul_R +17.92 -75.14 29.11 1 1 occiptsul_L +-18.16 -73.11 27.38 1 1 occiptsul_R +-1.230 -44.04 -32.08 1 1 IV_ventricle \ No newline at end of file diff --git a/BrainNet/ROI_coordinate_cal.m b/BrainNet/ROI_coordinate_cal.m new file mode 100644 index 0000000..6a7b9ff --- /dev/null +++ b/BrainNet/ROI_coordinate_cal.m @@ -0,0 +1,31 @@ +clc;clear all;close all; +filename = 'G:\所有的文档\DTI神经纤维成像方法\29Male\output\29Male_M2_MNI_level3_type2.img'; +[hdr,filetype,fileprefix,machine] = load_nii_hdr(filename); +[img,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); +co_x = zeros(90,1); +co_y = zeros(90,1); +co_z = zeros(90,1); +count = zeros(90,1); +for roi=1:90 + for i=1:181 + for j=1:217 + for k=1:181 + if(img(i,j,k)==roi) + co_x(roi)=co_x(roi)+i; + co_y(roi)=co_y(roi)+j; + co_z(roi)=co_z(roi)+k; + count(roi)=count(roi)+1; + end + end + end + end +end +for i=1:90 + co_x(i)=co_x(i)/count(i); + co_y(i)=co_y(i)/count(i); + co_z(i)=co_z(i)/count(i); +end +corrdinate=zeros(90,3); +corrdinate(:,1)=co_x-91; +corrdinate(:,2)=co_y-125; +corrdinate(:,3)=co_z-72; diff --git a/BrainNet/new_co.txt b/BrainNet/new_co.txt new file mode 100644 index 0000000..ed99c8e --- /dev/null +++ b/BrainNet/new_co.txt @@ -0,0 +1,90 @@ + 2.7670000e+01 2.3200000e+01 2.5340000e+01 + -2.8210000e+01 2.5580000e+01 2.4170000e+01 + 3.5080000e+01 -4.2200000e+01 4.2020000e+01 + -3.7950000e+01 -3.9270000e+01 4.2380000e+01 + 4.7350000e+01 -2.4030000e+01 -1.1030000e+01 + -4.9460000e+01 -2.1810000e+01 -1.1800000e+01 + 1.0880000e+01 -1.5140000e+01 1.8130000e+01 + -1.2150000e+01 -1.5480000e+01 1.7370000e+01 + 2.2080000e+01 -7.5100000e+01 8.7600000e+00 + -2.5040000e+01 -7.3100000e+01 1.0150000e+01 + 3.5910000e+01 5.9400000e+00 3.4100000e+00 + -3.7650000e+01 8.3300000e+00 1.8000000e+00 + 2.0460000e+01 3.2000000e+00 5.5200000e+00 + -2.2050000e+01 4.6200000e+00 4.6700000e+00 + 1.0610000e+01 -1.8460000e+01 8.6300000e+00 + -1.2030000e+01 -1.7640000e+01 8.2800000e+00 + 1.4280000e+01 3.1000000e-01 -6.3100000e+00 + -1.6180000e+01 1.3000000e+00 -6.7100000e+00 + 9.2500000e+00 -1.9020000e+01 -7.0700000e+00 + -1.0600000e+01 -1.9090000e+01 -7.6300000e+00 + -2.1930000e+01 -5.9680000e+01 -3.2920000e+01 + 2.0260000e+01 -5.9680000e+01 -3.2560000e+01 + 6.7900000e+00 -2.7040000e+01 -2.7980000e+01 + -8.7100000e+00 -2.6860000e+01 -2.8120000e+01 + 2.1200000e+00 -4.1640000e+01 -5.1440000e+01 + -5.6400000e+00 -4.0950000e+01 -5.1520000e+01 + 2.2290000e+01 1.5010000e+01 2.3930000e+01 + -2.2970000e+01 1.5140000e+01 2.2370000e+01 + 2.6800000e+01 -3.3780000e+01 2.9340000e+01 + -2.8480000e+01 -3.4250000e+01 2.9760000e+01 + 1.0490000e+01 -1.1370000e+01 1.9380000e+01 + -1.1070000e+01 -1.1190000e+01 1.8450000e+01 + 2.9830000e+01 -2.4930000e+01 6.1500000e+00 + -3.1480000e+01 -2.0920000e+01 5.2000000e+00 + 1.5470000e+01 -1.3870000e+01 1.1590000e+01 + -1.6740000e+01 -1.3510000e+01 1.1740000e+01 + 1.5510000e+01 -1.0790000e+01 1.2610000e+01 + -1.6770000e+01 -9.3800000e+00 1.2230000e+01 + -8.8000000e-01 -1.1540000e+01 3.8700000e+00 + 2.8510000e+01 2.8810000e+01 3.1430000e+01 + -2.9980000e+01 2.9320000e+01 2.9990000e+01 + 4.0310000e+01 -2.0110000e+01 5.2890000e+01 + -3.6070000e+01 -2.0000000e+01 5.6890000e+01 + 5.1690000e+01 -1.3450000e+01 5.2700000e+00 + -5.4190000e+01 -1.0880000e+01 3.1200000e+00 + 3.2040000e+01 -4.7680000e+01 5.1700000e+01 + -2.8060000e+01 -4.7030000e+01 5.3350000e+01 + 1.3600000e+00 5.2400000e+00 3.6990000e+01 + -2.5500000e+00 5.1900000e+00 3.6440000e+01 + 1.7920000e+01 -7.5140000e+01 2.9110000e+01 + -1.8160000e+01 -7.3110000e+01 2.7380000e+01 + -1.2300000e+00 -4.4040000e+01 -3.2080000e+01 + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN + NaN NaN NaN diff --git a/Plot_Gretna/hitsz_gretn_PlotNetwork_2GroupCompare.m b/Plot_Gretna/hitsz_gretn_PlotNetwork_2GroupCompare.m index 319d17c..5f12d9f 100644 --- a/Plot_Gretna/hitsz_gretn_PlotNetwork_2GroupCompare.m +++ b/Plot_Gretna/hitsz_gretn_PlotNetwork_2GroupCompare.m @@ -10,10 +10,10 @@ num_G=2; %分别确定G1与G2的Network Analysis网络参数txt的文件位置 -pathname_G1 = 'G:\玄武医院数据\2017_10_01PD_NC_XXG\NCnetwork'; -pathname_G2 = 'G:\玄武医院数据\2017_10_01PD_NC_XXG\xiaoxueguanNETWORK'; +pathname_G1 = 'G:\玄武医院数据\PD\PD画图\parameter_nc'; +pathname_G2 = 'G:\玄武医院数据\PD\PD画图\parameter_pd'; pathname_G3 = 'G:\韩璎课题组数据\SCD-NC\Result_path'; -pathname_P='G:\玄武医院数据\2017_10_01PD_NC_XXG\xiaoxueguan_NC'; +pathname_P='G:\玄武医院数据\PD\PD画图\p_value'; % 读取G1的数据 dirs_G1=dir([pathname_G1, '\*.txt']); diff --git a/ROI_volmue_283_MNI_level2_20.m b/ROI_volmue_283_MNI_level2_20.m new file mode 100644 index 0000000..58c4253 --- /dev/null +++ b/ROI_volmue_283_MNI_level2_20.m @@ -0,0 +1,102 @@ +%function:统计一个目录下所有分割结果中283个脑区的ROI大小,放到一个txt文档中 +clc;clear all;close all; +clc; +clear all; +close all; + +load('M2lookuptable.mat'); %para named 'a' + +b = a(:,5); +hashset = unique(b); + +res = a; +row_num = zeros(21,1); +cnt = 1; +for z =1:283 +% flag = 0; + dim = size(hashset); + if(dim(2)~=0) + for j = 1:dim(1) + if isequal(res(z,5),hashset(j)) +% flag = 1; + row_num(cnt)=z; + hashset(j)=[]; + cnt=cnt+1; + break; + end + end + end +% if(flag==0) +% res(i,:)=[]; +% end +end +%after that we got important row num in array row_num + +cnt = 21; +for z=283:-1:1 + if(z~=row_num(cnt)) + res(z,:)=[]; + else + cnt=cnt-1; + end +end +%开始进行回溯 +path = 'G:\玄武医院数据\韩璎课题组数据\NC\NC_M2_level2_type1'; +cd(path) +dirs_G1=dir([path, '\*.*']); +dircell_G1=struct2cell(dirs_G1)' ; +filenames_G1=dircell_G1(3:length(dircell_G1),1); +for m=1:length(filenames_G1) + floder_name = char(filenames_G1(m)); + cd(floder_name); + disp(floder_name); + cd('output'); + dirs_G2=dir; + dircell_G2=struct2cell(dirs_G2)' ; + filenames_G2=dircell_G2(3:length(dircell_G2),1); + len = length(filenames_G2); + for j = 1:len + + filenamesIS = char(filenames_G2(j)); + jamar = strfind(filenamesIS,'283Labels_M2_MNI.img'); + if length(jamar) ~= 0 + + [hdr,filetype,fileprefix,machine] = load_nii_hdr(filenamesIS); + [img,hdr] = load_nii_img(hdr,filetype,fileprefix,machine); + %开始回溯步骤 + for indexer=1:21 + for img_index = 1:283 + if isequal(res(indexer,5),a(img_index,5)) + if indexer~= 17 + index=(img==img_index); %index是图像中对应label number的体素序号 + for t=img_index + index1=(img==t); + index=index|index1; + end + img(index)=indexer; + else + index=(img==img_index); %index是图像中对应label number的体素序号 + for t=img_index + index1=(img==t); + index=index|index1; + end + img(index)=0; + end + end + end + end + %从1到20排列,因为总共有20个脑区 + Lables=unique(img); + for z=1:20 + temp=Lables(z); %label number + index=(img==temp); %index是图像中对应label number的体素序号 + img(index)=z-1; + end + + CC_286_L=make_ana(img); %savemat + savename = strcat(floder_name,'_M2_MNI_level2_type1'); + save_untouch_nii(CC_286_L,savename); + cd(path); + end + end +end diff --git a/level5_to_level3_M2_type2.m b/level5_to_level3_M2_type2.m index 2b525be..9cafa89 100644 --- a/level5_to_level3_M2_type2.m +++ b/level5_to_level3_M2_type2.m @@ -43,7 +43,7 @@ end end %开始进行回溯 -path = 'G:\玄武医院数据\Image_Out\画图分割结果'; +path = 'G:\所有的文档\DTI神经纤维成像方法'; cd(path) dirs_G1=dir([path, '\*.*']); dircell_G1=struct2cell(dirs_G1)' ; @@ -60,7 +60,7 @@ for j = 1:len filenamesIS = char(filenames_G2(j)); - jamar = strfind(filenamesIS,'283Labels_MNI.img'); + jamar = strfind(filenamesIS,'283Labels_M2_MNI.img'); if length(jamar) ~= 0 [hdr,filetype,fileprefix,machine] = load_nii_hdr(filenamesIS); diff --git a/yecf/coregis_spm12.m b/yecf/coregis_spm12.m new file mode 100644 index 0000000..caf6b7f --- /dev/null +++ b/yecf/coregis_spm12.m @@ -0,0 +1,34 @@ +%----------------------------------------------------------------------- +% Chenfei Ye updated:10/16/2016 +% function coregis_spm12(dir_ref,dir_source,dir_other) can run +% intra-subject coregsitering based on SPM12 +% Input: +% dir_ref: reference image directory +% dir_source: source image directory +% dir_other: other image dicrectory +% This function will generate the coregistered images +% The default parameters is using normalized mutual information, 12-parametric transformation and trilinear interpolation +% Below are formats of some variables. +% jobs{1}.spm.spatial.coreg.estwrite.ref = {'D:\Subjects\0339350_118_LAUEAR\0339350_118_LAUEAR_150914\scans\301-MPRAGE\oWIPMPRAGESENSE.nii,1'}; +% jobs{1}.spm.spatial.coreg.estwrite.source = {'D:\Subjects\0339350_118_LAUEAR\0339350_118_LAUEAR_150914\scans\1201-Skinny_T2AX\WIPSkinnyT2AXSENSEA.nii,1'}; +% jobs{1}.spm.spatial.coreg.estwrite.other = {'D:\Subjects\0339350_118_LAUEAR\0339350_118_LAUEAR_150914\scans\1201-Skinny_T2AX\resources\DICOM\files\T2_map.nii,1'}; +%----------------------------------------------------------------------- +function coregis_spm12(dir_ref,dir_source,dir_other) +spm_get_defaults; +global defaults +spm_jobman('initcfg'); +%% using default parameters in SPM12 +jobs{1}.spm.spatial.coreg.estwrite.ref =dir_ref; +jobs{1}.spm.spatial.coreg.estwrite.source =dir_source; +jobs{1}.spm.spatial.coreg.estwrite.other =dir_other; +jobs{1}.spm.spatial.coreg.estwrite.eoptions.cost_fun = 'nmi'; +jobs{1}.spm.spatial.coreg.estwrite.eoptions.sep = [4 2]; +jobs{1}.spm.spatial.coreg.estwrite.eoptions.tol = [0.02 0.02 0.02 0.001 0.001 0.001 0.01 0.01 0.01 0.001 0.001 0.001]; +jobs{1}.spm.spatial.coreg.estwrite.eoptions.fwhm = [7 7]; +jobs{1}.spm.spatial.coreg.estwrite.roptions.interp = 1; +jobs{1}.spm.spatial.coreg.estwrite.roptions.wrap = [0 0 0]; +jobs{1}.spm.spatial.coreg.estwrite.roptions.mask = 0; +jobs{1}.spm.spatial.coreg.estwrite.roptions.prefix = 'r'; + +spm_jobman('run',jobs); +clear jobs \ No newline at end of file