Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updating documentation
  • Loading branch information
Tanusree Chaudhuri authored and Tanusree Chaudhuri committed Jul 27, 2020
1 parent 8251bfc commit 67e5276
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 28 deletions.
9 changes: 8 additions & 1 deletion Allen_to_GroupSpace.m
@@ -1,6 +1,13 @@
function Allen_to_GroupSpace(Templates)

% ------ Transformation of ANO to group template space ------ %
% Description: Transformation of ANO file to group template space
% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%

% ----------------------------------------------------------------------------------------%
global DataDir;
global TemplatesDir;

Expand Down
9 changes: 9 additions & 0 deletions ClusterLabelling.m
@@ -1,5 +1,14 @@

function [ClusterLabels, ClusterParents] = ClusterLabelling(ClusterIntensities,ANO)

% Description: Labelling detected brain regions in each cluster blob in the
% cluster image.

% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%
Region = table2array(ANO(:,1));
ID = table2array(ANO(:,4));
colHex = table2array(ANO(:,2));
Expand Down
22 changes: 12 additions & 10 deletions Cluster_Overlap_main.m
@@ -1,20 +1,22 @@
function [ClusterTable] = Cluster_Overlap_main(ImageFiles)
% %----Description----%
% Run this script to obtain proportion of brain regions detected in the cluster images.

%%%% ----- Cluster Overlap Task ----- %%%%
%---------------------------------------------------------------------------------------------------------------%
% Documentation: Run this script to obtain proportion of brain
% regions detected in the cluster images. The output will appear in the
% command window as the number of clusters detected
% and the proportion (in percentage) of different brain regions present in
% each cluster.
% 'CodeDir' contains the fullpath to the folder into which the Toolbox is copied.
% 'DataDir' is the fullpath to the directory whose data needs to be analysed
% by this pipeline.
% FORMAT [ClusterTable] = Cluster_Overlap_main(ImageFiles)
%
% %----Input----%
% ImageFiles: Filename of cluster image.

% %----Output----%
% ClusterTable: Table array showing percentages and parent regions of
% detected brain regions in each cluster blob.
%
% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%

%---------------------------------------------------------------------------------------------------------------%

global DataDir;
Expand Down
88 changes: 88 additions & 0 deletions Cluster_Overlap_main.m~
@@ -0,0 +1,88 @@
function [ClusterTable] = Cluster_Overlap_main(ImageFiles)

%%%% ----- Cluster Overlap Task ----- %%%%
%---------------------------------------------------------------------------------------------------------------%

% 'CodeDir' contains the fullpath to the folder into which the Toolbox is copied.
% 'DataDir' is the fullpath to the directory whose data needs to be analysed
% by this pipeline.
%
% %----Description----%
% Run this script to obtain proportion of brain regions detected in the cluster images.

% FORMAT [ClusterTable] = Cluster_Overlap_main(ImageFiles)
%
% %----Input----%
% ImageFiles: Filename of cluster image.

% %----Output----%
% ClusterTable: Table array showing per
%
% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%

%---------------------------------------------------------------------------------------------------------------%

global DataDir;
global TemplatesDir;

cd(DataDir);

% ----- Binarizing cluster image ------ %
ImagesToBeMasked = ImageFiles;
InputFilename = cellstr(ImagesToBeMasked);
[pth,nam,ext] = spm_fileparts(ImageFiles);
OutputFilename = strcat(pth,'/Mask_',nam,ext);
MaskingClusterImages(InputFilename,OutputFilename);

% ------ Cluster Labelling.------ %
ClusterMask = spm_vol(OutputFilename);
ClusterMask = spm_read_vols(ClusterMask);
CC = bwconncomp(ClusterMask);
NumberOfClusters = CC.NumObjects;


for img_cluster = 1:NumberOfClusters

[ClusterLabels,ClusterParents,ClusterLabelsPercent] = ClusterProportionInPercentages(TemplatesDir,CC,img_cluster);
if(isempty(ClusterLabels))
Cluster_blob_num = cellstr(repmat(['Cluster',' ',num2str(img_cluster)],[1, 1]));
ClusterLabels{end + 1} = [];
ClusterLabelsPercent = 100;
ClusterParents{end + 1} = [];
end
Cluster_blob_num = cellstr(repmat(['Cluster',' ',num2str(img_cluster)],[length(ClusterLabels) 1]));
ClusterParents = ClusterParents';
ClusterImageInfo = table(Cluster_blob_num,ClusterLabels,ClusterParents,ClusterLabelsPercent);
disp(strcat('Blob','_',num2str(img_cluster),'_','done'));


if(img_cluster == 1)
ClusterTable = ClusterImageInfo;
else
ClusterTable = [ClusterTable;ClusterImageInfo];
end

end



end















10 changes: 10 additions & 0 deletions Start_ARET.m
@@ -1,4 +1,14 @@
%%% ------ START ARET ------ %%%%
% ------------------------------ %

% Description: start Allen ROI Extraction Toolbox to perform two
% functionalities - ROI Extraction and Cluster Labelling.

% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%

%% ----- Variables to be changed before running this script ----- %%%

Expand Down
22 changes: 5 additions & 17 deletions annotation_tan.m
Expand Up @@ -2,42 +2,30 @@
function [Int_ROI,ROI] = annotation_tan(brain_region)

% %----Description----%
% Create masks of user specified gray matter regions using the latest antx templates,
% specifically the annotation template(ANO.nii) and the allen table.
% Both files are located in TemplatesDir directory.
% Create masks of user specified brain regions using the annotation
% template(ANO.nii) and the allen table in the templates folder.

% FORMAT [Int,mask,idxLUT] = annotation_tan(brain_region)
% FORMAT [Int_ROI,ROI] = annotation_tan(brain_region)
%
% %----Input----%
% DataDir: fullpath to the directory with the cluster data.
% TemplatesDir = fullpath to the templates directory, which contains the
% latest templates from the following link:
% https://drive.google.com/drive/folders/1q5XOOVLvUYLqYsQJLqNRF7OK8fNwYhI9
% 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
% mask: image volume of brain_region
% ROI: image volume of brain_region
%
% -----------------------------------------%
% Tanusree Chaudhuri
% Max Planck Institute of Psychiatry, Munich
% tanusree_chaudhuri@psych.mpg.de
% -----------------------------------------%


%global DataDir
global TemplatesDir
global ROI_ResultsDir

% % ---- Creating subfolder for output images ---- %
% cd(DataDir);
% % if ~exist('ROI_Masks', 'dir')
% % mkdir('ROI_Masks')
% % end
% mkdir(ROI_ResultsDir);

% ---------- 1. ANO table ------------ %%%%%
ANO = readtable(strcat(TemplatesDir,'/ANO.xlsx'));
Regions = table2array(ANO(:,1));
Expand Down

0 comments on commit 67e5276

Please sign in to comment.