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
%%%----- Annotation Task ------%%%
% NOTE: The variable 'TREE' is the hierarchical structure of brain regions.
% brain_region = input('Enter region of interest: ');
function [Int,mask,idxLUT] = annotation_tan(brain_region)
% ---------- 1. Obtaining intensity values of region of interest ------------ %%%%%
addpath(genpath('/home/tchaudhuri/toolboxes/antx-master/freiburgLight/allen'));
brain = load('TREE');
[table idxLUT] = buildtable(brain.tree);
Int = {};
Regions = extractfield(idxLUT,'name')';
for i = 1:length(idxLUT)
Int{end + 1} = extractfield(idxLUT(i),'children');
end
Int = Int';
% brain_region = input('Enter region of interest: ');
for a = 1:length(Regions)
if(strcmp(Regions{a,1},brain_region) == 1)
Int = Int{a,1}';
end
end
% disp(strcat('Allen intensities of ', brain_region, ' are in Int'));
% ---- How to search for the name of a region in the LUT? ---- %%
Index_region = strfind(Regions,brain_region);
Index = find(not(cellfun('isempty',Index_region)));
% disp(strcat('Index of ',brain_region,' in idxLUT: ',num2str(Index)));
% ---------- 2. Creating Mask of region of interest ------------ %%%%%
% MC_change_voxel_size;
ano = niftiread('ANO_x10.nii');
% ano = niftiread('ANOpcol.nii');
mask = zeros(size(ano,1),size(ano,2),size(ano,3));
ind = {};
for j = 1:length(Int)
ind{end + 1} = find(ano == Int(j));
mask(ind{j}) = 1;
end
%metadata = niftiinfo('ANO_x10.nii');
%x = pwd;
% cd('/home/tchaudhuri/code/matlab/Annotation_Task')
%niftiwrite(mask,strcat(brain_region,'_Mask'),metadata);
%cd(x);
end