-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_BI.m
59 lines (49 loc) · 1.4 KB
/
demo_BI.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
clc;
clear;
close all;
%add the scripts to current path
addpath(strcat(pwd,'\strm_to_block'));
%%%%%%%%%%Block specifications%%%%%%%%%%%%%%%%
%specifiy size of block
N=4;
%create block-level atlas
atlas=create_block_atlas_3d(N);
%Number of nodes
nR=max(max(max(atlas)));
%number of cores
N_core=4;
%%%%%%%%%%%dMRI signal and its corresponding track file%%%%%%%%%%%%%%%%
disp('Loading dataset...');
tic
%provide respective dMRI data or atlas for dimension extraction,
%which was also used for extracting raw dMRI blocks for training CNN
dmri_file=strcat(pwd,'\Data\ground.nii.gz');
info = niftiinfo(dmri_file);
toc
%provide tck file path
track_file=strcat(pwd,'\Data\ground.tck');
%for tck file
tracks = read_mrtrix_tracks(track_file);
streamlines= cell(1,length(tracks.data));
for i=1:length(tracks.data)
streamlines(i)=tracks.data(i);
end
clear tracks;
%for trk file
%{
[header, tracks]=trk_read(track_file);
streamlines= cell(1,length(tracks));
for i=1:length(tracks)
streamlines{i}=tracks(i).matrix;
end
clear tracks;
%}
%%%%%%Generate block-image from the provided tracks and dMRI data%%%%%%%%%%%%
%generate block_image
disp('Generating Block-image...');
tic
conn_map=generate_block_image(streamlines,info,atlas,N_core);
toc
%%%%%%%%%%%%%%save block_image%%%%%%%%%%%%%%%%%%%%%%%%%
save_path=strcat(pwd,'\data\block_image.mat');
save(save_path,'conn_map');