|
a |
|
b/AC_2D_MRI.m |
|
|
1 |
% LV segmentation from 2D cardiac MRI |
|
|
2 |
% M. R. Avendi, 2014-2015 |
|
|
3 |
|
|
|
4 |
clear all |
|
|
5 |
close all |
|
|
6 |
clc |
|
|
7 |
addpath('functions') |
|
|
8 |
%% load the image |
|
|
9 |
disp('Load MRI images'); |
|
|
10 |
load ('matFiles/images1.mat','Iroi','yLV') |
|
|
11 |
|
|
|
12 |
max_its = 200; % maximum iterations |
|
|
13 |
intEweight=0.5; % weight of length energy |
|
|
14 |
ShapeWeight=0.0; % weight of shape engery |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
slice_num=1; % slice number |
|
|
18 |
subI=Iroi(:,:,slice_num); |
|
|
19 |
ground_truth=yLV(:,:,slice_num); |
|
|
20 |
|
|
|
21 |
% show image |
|
|
22 |
showCurveAndPhi(subI,ground_truth); |
|
|
23 |
legend('ground truth') |
|
|
24 |
disp('Please draw an initial contour...'); |
|
|
25 |
|
|
|
26 |
% initialization |
|
|
27 |
h = imfreehand(gca,'closed',false); |
|
|
28 |
init_mask=createMask(h); |
|
|
29 |
|
|
|
30 |
% run segmentation |
|
|
31 |
disp('sementation in progress ...'); |
|
|
32 |
[auto_seg1,phi] = ac_seg(subI,init_mask,max_its,intEweight,ShapeWeight,1); |
|
|
33 |
|
|
|
34 |
% clean segmentation, remove islands and small contours |
|
|
35 |
auto_seg2=clean_segs(auto_seg1); |
|
|
36 |
|
|
|
37 |
% show automatic and manual segmentation |
|
|
38 |
showCurveAndPhi(subI,ground_truth,auto_seg2); |
|
|
39 |
legend('ground truth','','automatic') |
|
|
40 |
disp('sementation completed.'); |