Skip to content

Commit

Permalink
cal the volmune information for 283/286 labels M2/M1 segmention
Browse files Browse the repository at this point in the history
  • Loading branch information
zclhit committed Apr 27, 2017
1 parent 101d435 commit 4c26137
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions ROI_volmue_283_MNI.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
%function:统计一个目录下所有分割结果中283个脑区的ROI大小,放到一个txt文档中
clc;clear all;close all;
pathname_G1 = 'J:\XuanWu\M2_PD分割';
cd(pathname_G1);
dirs_G1=dir([pathname_G1, '\*.*']);
dircell_G1=struct2cell(dirs_G1)' ;
filenames_G1=dircell_G1(3:length(dircell_G1),1);
%file_path_G1=fullfile(pathname_G1,filenames_G1); %保存各网络参数的全路径
dirs_G2=dir([pathname_G1, '\*.*']);
dircell_G2=struct2cell(dirs_G2)' ;
filenames_G2=dircell_G2(3:length(dircell_G2),1);
savemat = zeros(length(filenames_G1),283);
for i=1:length(filenames_G1)
cd(char(filenames_G1(i)));
cd output;
clear dirs_G2;clear dircell_G2;clear filenames_G2;
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 k = 1:283
counter = length(find(img==k));
savemat(i,k)= counter;
end
end

end


cd(pathname_G1);
end
save wholeBrain_voxel.txt -ascii savemat;
2 changes: 1 addition & 1 deletion ROI_volmue.m → ROI_volmue_286_MNI.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%function:统计一个目录下所有分割结果中286个脑区的ROI大小,放到一个txt文档中
clc;clear all;close all;
pathname_G1 = 'G:\韩璎课题组数据\NC\NC_分割结果';
pathname_G1 = 'G:\韩璎课题组数据\aMCI\aMCI_M2';
cd(pathname_G1);
dirs_G1=dir([pathname_G1, '\*.*']);
dircell_G1=struct2cell(dirs_G1)' ;
Expand Down

0 comments on commit 4c26137

Please sign in to comment.