Skip to content

Commit 2f12540

Browse files
committed
More outline options, helper functions
- changed default line/edge properties for outlined overlays to minimize some visual artifacts on windows - added two new contextual menus for changing line/edge properties for outlined overlays and atlases (right click outline dropdown menu for overlays or outline toggle for atlas to summon the new GUI) -writeDataToAtlas in misc. scripts directory can help you assign values to individual ROIs in an atlas (e.g., based on some statistical tests)
1 parent 2da3134 commit 2f12540

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

GUIs/outProp.mlapp

26.2 KB
Binary file not shown.

GUIs/outProp2.mlapp

26.4 KB
Binary file not shown.

brainSurfer.mlapp

41.8 KB
Binary file not shown.

scripts/misc/writeDataToAtlas.m

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
function writeDataToAtlas(atLabs,atFile,data,dataLabs,ofAppend)
2+
% This function will take an atlas file and write in new values for each
3+
% ROI in the atlas.
4+
%
5+
% atLabs: a text file showing labels for each ROI. See
6+
% jhu_resampled_to_FSL_fixed_noWM as an example
7+
%
8+
% atFile: a path to a nifti file
9+
%
10+
% data: an n x 1 matrix where n corresponds to number of ROIs
11+
%
12+
% dataLabs: an n x 1 matrix where n corresponds to the name of the ROI,
13+
% which must match the names in atLabs. Note, each row in dataLabs has to
14+
% correspond to the same region as the row in data.
15+
%
16+
% example call: writeDataToAtlas('D:\Science\Matlab\GitHub\brainSurfer\atlases\jhu_resampled_to_FSL_fixed_noWM.txt',{'D:\Science\Matlab\GitHub\brainSurfer\atlases\jhu_resampled_to_FSL_fixed_noWM_renamed_CombinedClusters_FSSpace_LH.nii.gz';'D:\Science\Matlab\GitHub\brainSurfer\atlases\jhu_resampled_to_FSL_fixed_noWM_renamed_CombinedClusters_FSSpace_RH.nii.gz'},[0.2; 0.2],{'MTG L cbf ','Cu L cbf'})
17+
18+
atLabs = readtable(atLabs);
19+
atNii{1} = load_nifti(atFile{1});
20+
atNii{2} = load_nifti(atFile{2});
21+
22+
of{1} = atNii{1};
23+
of{1}.vol = zeros(size(of{1}.vol));
24+
of{2} = atNii{2};
25+
of{2}.vol = zeros(size(of{2}.vol));
26+
27+
for i = 1:length(data)
28+
id = strfind(dataLabs{i},' ');
29+
if contains(dataLabs{i},'pole')
30+
tmp = dataLabs{i}(1:id(end)-(id(end)-id(end-1))-1);
31+
else
32+
tmp = dataLabs{i}(1:id(end)-(id(end)-id(end-2)-1)); %dataLabs{i}(1:id(end)-5);
33+
end
34+
35+
id = strfind(tmp,' ');
36+
tmp(id) = '_';
37+
id = find(ismember(atLabs.Var2,tmp));
38+
if isempty(id)
39+
disp([dataLabs{i} ' not found'])
40+
else
41+
id = atLabs.Var1(id);
42+
c1 = intersect(atNii{1}.vol,id);
43+
c2 = intersect(atNii{2}.vol,id);
44+
if ~isempty(c1)
45+
mid = find(atNii{1}.vol == id);
46+
of{1}.vol(mid) = data(i);
47+
elseif ~isempty(c2)
48+
mid = find(atNii{2}.vol == id);
49+
of{2}.vol(mid) = data(i);
50+
end
51+
end
52+
end
53+
save_nifti(of{1},[atFile{1}(1:end-7) ofAppend '.nii.gz'])
54+
save_nifti(of{2},[atFile{2}(1:end-7) ofAppend '.nii.gz'])

0 commit comments

Comments
 (0)