-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_sholl_analysis.m
37 lines (28 loc) · 1.15 KB
/
run_sholl_analysis.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% Pick your root directory
path = uigetdir();
files = dir(path);
% ignore files and ./..
dirflags = [files.isdir];
subjects = files(dirflags);
subjects(ismember( {subjects.name}, {'.', '..'})) = [];
sides = {'L', 'R'};
for i = 1:length(subjects)
fprintf('Running Sholl analysis on %s\n', subjects(i).name);
subj_path = fullfile(subjects(i).folder, subjects(i).name, 'SHOLL');
for j = 1:length(sides)
side = sides{j};
fprintf('Running on %s\n', side);
side_path = fullfile(subj_path, side);
% read seed voxel xyz coordinates here
seed_path = fopen(fullfile(side_path, 'seed.txt'));
seed = cell2mat(textscan(seed_path, '%f %f %f'));
% Read in image using FSL's MATLAB bindings
nifti_path = fullfile(side_path, 'fdt_paths.nii.gz');
info = niftiinfo(nifti_path);
image = niftiread(nifti_path);
[dists, conns] = sholl_analysis(image, info, seed);
% save outputs in folder
output_path = fullfile(side_path, 'sholl_output.mat');
save(output_path, 'dists', 'conns', 'seed');
end
end