Switch to unified view

a b/combinedDeepLearningActiveContour/sortDataES.m
1
% read mat files and store them as a 3D matrix for further processing
2
clc 
3
close all
4
clear all
5
%%
6
%imset='training';
7
imset='validation';
8
%imset='online';
9
10
folder=['matFiles/',imset,'/ES/'];
11
D=dir([folder,'\*.mat']);
12
numpatients = length(D(not([D.isdir])));
13
14
t_I=[];
15
t_yROI=[];
16
t_Iroi=[];
17
t_yLV=[];
18
t_contours=[];
19
t_centers=[];
20
t_LV_cont_names=[];
21
t_MC_cont_names=[];
22
for k=1:numpatients
23
    imgname=['matFiles/',imset,'/ES/ES_P',num2str(k)];
24
%    yname=['matFiles/',imset,'/yROI_ED',num2str(k)];
25
    load (imgname);
26
%    load (yname);
27
    t_I=cat(3,t_I,I);
28
    t_yROI=cat(3,t_yROI,yROI);
29
    t_Iroi=cat(3,t_Iroi,Iroi);
30
    t_yLV=cat(3,t_yLV,yLV);
31
    t_contours=[t_contours,contours(1:size(I,3))];
32
    t_centers=[t_centers,contour_center(1:size(I,3))];
33
    slice_per_patient(k)=size(I,3);
34
    t_LV_cont_names=[t_LV_cont_names;LV_contours_names];
35
end
36
37
filename=['matFiles/',imset,'_dataES'];
38
39
save (filename,'t_I','t_yROI','t_Iroi','t_yLV','t_contours','t_centers','numpatients',...
40
'slice_per_patient','t_LV_cont_names');
41
    
42
display('file has been saved')