Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function [Int_ROI,ROI] = annotation_tan(brain_region)
% %----Description----%
% Create masks of user specified brain regions using the annotation
% template(ANO.nii) and the allen table in the templates folder.
% FORMAT [Int_ROI,ROI] = annotation_tan(brain_region)
%
% %----Input----%
% brain_region: name of brain region whose mask will be generated by this
% function.
% Please refer to manual to know how to give brain_region as an input.
% %----Output----%
% Int: the allen intensities present in brain_region
% ROI: image volume of brain_region
%
% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%
global TemplatesDir
global ROI_ResultsDir
% ---------- 1. ANO table ------------ %%%%%
ANO = readtable(strcat(TemplatesDir,'/ANO.xlsx'));
Regions = table2array(ANO(:,1));
Children = table2array(ANO(:,5));
% ---- 2. Obtaining intensities of region of interest ---- %%
Index_region = strfind(Regions,brain_region);
Index = find(not(cellfun('isempty',Index_region)));
Children_region = Children(Index);
Int_ROI = strsplit(Children_region{1,1},';') ;
Int_ROI = str2double(Int_ROI);
if(isnan(Int_ROI) == 1)
Int_ROI = table2array(ANO(Index,4));
end
% ---------- 3. Creating Mask of region of interest ------------ %%%%%
ano_hdr = spm_vol(strcat(TemplatesDir,'/wANO.nii'));
ano = spm_read_vols(ano_hdr);
ROI = zeros(size(ano,1),size(ano,2),size(ano,3));
ind = {};
for j = 1:length(Int_ROI)
ind{end + 1} = find(ano == Int_ROI(j));
ROI(ind{j}) = 1;
end
no_of_words = numel(strsplit(brain_region));
if (no_of_words == 1)
ano_hdr.fname = strcat(brain_region,'_ROI.nii');
ano_hdr.fname = strcat(regexprep(brain_region,'/','_'),'_ROI.nii');
else
ano_hdr.fname = strcat(regexprep(brain_region,' ','_'),'_ROI.nii');
ano_hdr.fname = strcat(regexprep(brain_region,'/','_'),'_ROI.nii');
end
ano_hdr.fname = strcat(ROI_ResultsDir,'/',ano_hdr.fname);
spm_write_vol(ano_hdr,ROI);
disp(['ROI result is stored in ',ROI_ResultsDir]);
end