-
Notifications
You must be signed in to change notification settings - Fork 0
/
p317.m
42 lines (35 loc) · 909 Bytes
/
p317.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
% problem 3.1.7
% Generate baseline groupwise registration
clear;
% test image
[fixed,spacing] = myReadNifti('sub021_mri.nii');
% Create 20x1 cell arrays
A_cell = cell(20,1);
b_cell = cell(20,1);
% Create filename string parts
base1 = 'sub00';
base2 = 'sub0';
ending = '_mri.nii';
% Definte iteration vector and smoothing factor
iter = [20, 10, 5];
sigma = 1;
% Populate cell arrays
for i = 1:20
% Create filename
imagenum = num2str(i);
if i<10
filename = strcat(base1,imagenum,ending);
else
filename = strcat(base2,imagenum,ending);
end
% Read image and perform registration
[moving,~] = myReadNifti(filename);
[A_cell{i}, b_cell{i}] = myAffineRegMultiRes3D(fixed,moving,iter,sigma);
end
% Evaluate performance
if isunix()
path = strcat(pwd,'/train');
else
path = strcat(pwd,'\train');
end
meanovl = evaluateOnTrainingSet(path, A_cell, b_cell);