-
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.
cal the volmune information for 283/286 labels M2/M1 segmention
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
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,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; |
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