From a572858cf55667912d50b894ae1b6098faa68e49 Mon Sep 17 00:00:00 2001 From: Ningfei Li Date: Sat, 5 Dec 2020 00:28:24 +0100 Subject: [PATCH] BUG: Adapt new atlas roi structures. --- ea_checkstructures.m | 16 ++++++++-------- ea_genvat_horn.m | 6 +++--- helpers/ea_atlasmajorcomponent.m | 16 ++++++++-------- helpers/ea_atlasreducepatch.m | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ea_checkstructures.m b/ea_checkstructures.m index 2d5f40979..8eec47d7d 100644 --- a/ea_checkstructures.m +++ b/ea_checkstructures.m @@ -240,29 +240,29 @@ function ea_setnewatlas(h,gf,options,handles,dontupdate) options.atlasset=h.Parent.Label; load([ea_space(options,'atlases'),options.atlasset,filesep,'atlas_index.mat']); if strcmp(h.Label,'ALL') - fv=atlases.fv; + roi=atlases.roi; pixdim=atlases.pixdim; xyz=[]; - for i=1:numel(fv) + for i=1:numel(roi) try % some are empty in case of midline/mixed structures - xyz=[xyz;fv{i}.vertices]; + xyz=[xyz;roi{i}.fv.vertices]; end end pixdim=pixdim{1}; else [~,six]=ismember(h.Label,ea_rmext(atlases.names)); - fv=atlases.fv(six,:); + roi=atlases.roi(six,:); pixdim=atlases.pixdim(six,:); - if length(fv)>1 + if length(roi)>1 xyz=[]; - for i=1:numel(fv) + for i=1:numel(roi) try % some are empty in case of midline/mixed structures - xyz=[xyz;fv{i}.vertices]; + xyz=[xyz;roi{i}.fv.vertices]; end end pixdim=mean([pixdim{1};pixdim{2}]); else - xyz=fv{1}.vertices; + xyz=roi{1}.fv.vertices; pixdim=pixdim{1}; end end diff --git a/ea_genvat_horn.m b/ea_genvat_horn.m index a8025780f..2605332c0 100644 --- a/ea_genvat_horn.m +++ b/ea_genvat_horn.m @@ -88,11 +88,11 @@ if ~isfield(atlases,'tissuetypes') atlases.tissuetypes=ones(length(atlases.names),1); end - for atlas=1:numel(atlases.fv) - if isempty(atlases.fv{atlas}) || (atlases.tissuetypes~=1) + for atlas=1:numel(atlases.roi) + if isempty(atlases.roi{atlas}.fv) || (atlases.tissuetypes~=1) continue end - fv(cnt)=atlases.fv{atlas}; + fv(cnt)=atlases.roi{atlas}.fv; ins=surfinterior(fv(cnt).vertices,fv(cnt).faces); %tissuetype(cnt)=1; diff --git a/helpers/ea_atlasmajorcomponent.m b/helpers/ea_atlasmajorcomponent.m index 8f5120fe5..9732277cd 100644 --- a/helpers/ea_atlasmajorcomponent.m +++ b/helpers/ea_atlasmajorcomponent.m @@ -1,17 +1,17 @@ function atlases=ea_atlasmajorcomponent(atlases,toclean) % from specified component, only preserve largest component -for c=toclean +for c=toclean for side=1:2 - % figure, patch(atlases.fv{c,side},'FaceColor','none') - - fvsplit=splitFV(atlases.fv{c,side}.faces,atlases.fv{c,side}.vertices); + % figure, patch(atlases.roi{c,side}.fv,'FaceColor','none') + + fvsplit=splitFV(atlases.roi{c,side}.fv.faces,atlases.roi{c,side}.fv.vertices); for comp=1:length(fvsplit) lengths(comp)=length(fvsplit(comp).faces); end [~,ix]=max(lengths); - atlases.fv{c,side}.faces=fvsplit(ix).faces; - atlases.fv{c,side}.vertices=fvsplit(ix).vertices; + atlases.roi{c,side}.fv.faces=fvsplit(ix).faces; + atlases.roi{c,side}.fv.vertices=fvsplit(ix).vertices; end end @@ -69,7 +69,7 @@ openVertices = f(nextAvailFace,:); while ~isempty(openVertices) availFaceInds = find(fSets==0); - [availFaceSub, ~] = find(ismember(f(availFaceInds,:), openVertices)); + [availFaceSub, ~] = find(ismember(f(availFaceInds,:), openVertices)); fSets(availFaceInds(availFaceSub)) = currentSet; openVertices = f(availFaceInds(availFaceSub),:); end @@ -85,4 +85,4 @@ [unqVertIds, ~, newVertIndices] = unique(setF); fvOut(currentSet).faces = reshape(newVertIndices,size(setF)); fvOut(currentSet).vertices = v(unqVertIds,:); -end \ No newline at end of file +end diff --git a/helpers/ea_atlasreducepatch.m b/helpers/ea_atlasreducepatch.m index 288e2e163..f07704ca0 100644 --- a/helpers/ea_atlasreducepatch.m +++ b/helpers/ea_atlasreducepatch.m @@ -2,8 +2,8 @@ for atl=1:length(atlases.names) for side=1:2 - atlases.fv{atl,side}=reducepatch(atlases.fv{atl,side},red); - + atlases.roi{atl,side}.fv=reducepatch(atlases.roi{atl,side}.fv,red); + end end