Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design2
/
2016104167
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조현아
2020-04-15 16:35:47 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bcee2c004a4103dcbe3ea260ae58aa87a41fff5a
bcee2c00
1 parent
37352494
mv getframe codes
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
102 deletions
code/getframe.m
code/shape_exception_handling.m
code/shape_exception_handling_all.m
code/getframe.m
View file @
bcee2c0
inputheader
=
'..\data\MICCAI_BraTS_2019_Data_Training\HGG_seg_flair\'
;
outfolder
=
'..\data\MICCAI_BraTS_2019_Data_Training\total_frame\'
;
outfolder
=
'..\data\MICCAI_BraTS_2019_Data_Training\total_frame
_m255
\'
;
files
=
dir
(
inputheader
);
id
=
{
files
.
name
};
...
...
@@ -8,7 +8,7 @@ flag = ~strcmp(id, '.') & ~strcmp(id, '..');
files
=
files
(
flag
);
for
i
=
1
:
length
(
files
)
for
i
=
1
:
1
%
length(files)
id
=
split
(
files
(
i
)
.
name
,
'.nii'
);
id
=
char
(
id
(
1
));
...
...
@@ -42,7 +42,11 @@ for i = 1 : length(files)
filename
=
strcat
(
id
,
'_'
,
int2str
(
c
),
type
);
% BraTS19_2013_2_1_seg_flair_c.png
outpath
=
strcat
(
outfolder
,
filename
);
% typecase int16 to double, range[0, 1], rotate 90 and filp updown
cp_data
=
flipud
(
rot90
(
mat2gray
(
double
(
data
(:,:,
k
)))));
% range [0, 1]
%cp_data = flipud(rot90(mat2gray(double(data(:,:,k)))));
cp_data
=
flipud
(
rot90
(
mat2gray
(
double
(
data
(:,:,
k
)))))
.*
255
;
% M = max(cp_data(:));
% disp(M);
imwrite
(
cp_data
,
outpath
);
c
=
c
+
1
;
...
...
code/shape_exception_handling.m
deleted
100644 → 0
View file @
3735249
data_path
=
'..\data\MICCAI_BraTS_2019_Data_Training\HGG_seg_flair\BraTS19_CBICA_AVG_1_seg_flair.nii'
;
data
=
niftiread
(
data_path
);
cp_data
=
flipud
(
rot90
(
mat2gray
(
double
(
data
(:,:,
82
)))));
type
=
'.png'
;
filename
=
strcat
(
'BraTS19_CBICA_AVG_1_seg_flair_8'
,
type
);
% BraTS19_2013_2_1_seg_flair_c.png
outpath
=
strcat
(
'..\data\MICCAI_BraTS_2019_Data_Training\zero to valid\'
,
filename
);
imwrite
(
cp_data
,
outpath
);
% st, end 10
%% (circle 0, ellipse 0)
% BraTS19_CBICA_AOP_1_seg_flair_0
% BraTS19_CBICA_ASF_1_seg_flair_9 -> 8
% BraTS19_CBICA_ASR_1_seg_flair_8
% BraTS19_CBICA_ASR_1_seg_flair_9
% BraTS19_CBICA_AVG_1_seg_flair_9 -> 8
%
%
%
%
%
%
%
%
%
%
%
%
\ No newline at end of file
code/shape_exception_handling_all.m
deleted
100644 → 0
View file @
3735249
getname_path
=
'..\data\MICCAI_BraTS_2019_Data_Training\zero2\'
;
inputheader
=
'..\data\MICCAI_BraTS_2019_Data_Training\HGG_seg_flair\'
;
outfolder
=
'..\data\MICCAI_BraTS_2019_Data_Training\zero to valid2\'
;
files
=
dir
(
getname_path
);
id
=
{
files
.
name
};
% files + dir file
flag
=
~
strcmp
(
id
,
'.'
)
&
~
strcmp
(
id
,
'..'
);
files
=
files
(
flag
);
% get filenames in getname_path folder
for
i
=
1
:
length
(
files
)
%id = split(files(i).name, '.nii');
fname
=
files
(
i
)
.
name
;
id
=
reverse
(
extractBetween
(
reverse
(
fname
),
7
,
strlength
(
fname
)));
data_path
=
convertCharsToStrings
(
strcat
(
inputheader
,
'\'
,
id
,
'.nii'
));
data
=
niftiread
(
data_path
);
fprintf
(
'ID #%d = %s\n'
,
i
,
data_path
);
idx
=
1
;
frames
=
zeros
(
1
,
1
);
for
j
=
1
:
z
n_nonblack
=
numel
(
find
(
data
(:,:,
j
)
>
0
));
if
(
n_nonblack
>
70
)
frames
(
idx
,
1
)
=
j
;
idx
=
idx
+
1
;
end
end
% for j = z : -1 : 1
% n_nonblack = numel(find(data(:,:,j) > 0));
% if(n_nonblack > 50)
% fprintf('%s: %d\n ','number: ', n_nonblack);
% en = j;
% break;
% end
% end
c
=
0
;
[
nrow
,
ncol
]
=
size
(
frames
);
step
=
round
(
nrow
/
11
);
% fprintf('%s: %d \n', 'nrow', nrow);
% fprintf('%s: %d\n ','st: ', frames(1, 1));
% fprintf('%s: %d\n ','end: ', frames(nrow, 1));
%disp(frames);
for
k
=
1
:
step
:
step
*
10
%fprintf('%d ', k);
fprintf
(
'%d '
,
frames
(
k
,
1
));
type
=
'.png'
;
filename
=
strcat
(
id
,
'_'
,
int2str
(
c
),
type
);
% BraTS19_2013_2_1_seg_flair_c.png
outpath
=
convertCharsToStrings
(
strcat
(
outfolder
,
filename
));
% typecase int16 to double, range[0, 1], rotate 90 and filp updown
% range [0, 1]
cp_data
=
flipud
(
rot90
(
mat2gray
(
double
(
data
(:,:,
frames
(
k
,
1
))))));
% M = max(cp_data(:));
% disp(M);
imwrite
(
cp_data
,
outpath
);
c
=
c
+
1
;
end
end
Please
register
or
login
to post a comment