-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.m
45 lines (31 loc) · 1.16 KB
/
main.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
% Main script to be launched in order to segment the
% Dynamic contrast-Enhanced CT-scan images (DCE-CT) by voxels clustering
% Images must be registered and with same resolution
% (ANTs does this automatically)
clear variables
close all
%% Define your data variables.
% Define the folder with Niftifiles to be segmented
% Example:
img_folder = 'DATA/';
% Set acquisition times of different phases (in seconds)
% Example:
t = [0 237 291 878];
%% --- Parameters for image pre-processing ---
% Thresholds of values to be ignored
% Default values tuned on kidney CT-scan:
t_high = 300;
t_low = -50;
% Set to 0 to load images already computed, to speed up the code
dif_avgnbr = 1; % Computation of the difference between a voxel and the avg of its neighbours
Im_all_preproc = 1; % Preprocess images to remove non interesting voxels
% Set to 0 to skip plotting of preprocessed images
plotting = 1;
%% Load Nifti images
load_registered_nii
%% Apply clustering
% Set number of clusters (otherwise it will be automatically estimated)
n_clusters = 6;
clustering3D
%% save Nifti image with clusters labels
niftiwrite(single(pixel_labels), [folder_out 'segmentation.nii'], info)