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-03-29 19:05:16 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ef3696d0fc513759b29cceeab3d2ffb0e952ad6b
ef3696d0
1 parent
0a653a47
get frames & nii2png
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
code/getframe.m
code/getframe.m
0 → 100644
View file @
ef3696d
inputheader
=
'..\data\MICCAI_BraTS_2019_Data_Training\HGG_seg_flair\'
;
outfolder
=
'..\data\MICCAI_BraTS_2019_Data_Training\frame\'
;
files
=
dir
(
inputheader
);
id
=
{
files
.
name
};
% files + dir file
flag
=
~
strcmp
(
id
,
'.'
)
&
~
strcmp
(
id
,
'..'
);
files
=
files
(
flag
);
for
i
=
1
:
length
(
files
)
id
=
split
(
files
(
i
)
.
name
,
'.nii'
);
id
=
char
(
id
(
1
));
fprintf
(
'ID #%d = %s\n'
,
i
,
id
);
filename
=
id
;
% BraTS19_2013_2_1_seg_flair.nii
data_path
=
strcat
(
inputheader
,
'\'
,
filename
);
data
=
niftiread
(
data_path
);
%size 240x240x155
[
x
,
y
,
z
]
=
size
(
data
);
for
i
=
1
:
z
[
row
,
col
]
=
find
(
data
(:,:,
i
)
~=
0
);
if
(
size
(
row
)
>
0
)
st
=
i
;
break
;
end
end
for
i
=
z
:
-
1
:
1
[
row
,
col
]
=
find
(
data
(:,:,
i
)
~=
0
);
if
(
size
(
row
)
>
0
)
en
=
i
;
break
;
end
end
c
=
0
;
step
=
round
(((
en
)
-
(
st
))/
11
);
for
k
=
st
+
step
:
step
:
st
+
step
*
10
c
=
c
+
1
;
type
=
'.png'
;
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
)))));
imwrite
(
cp_data
,
outpath
);
end
end
% p = 'st: %d\n';
% fprintf(p, st);
% p = 'en: %d\n';
% fprintf(p, en);
Please
register
or
login
to post a comment