flair2seg_1.m
1.01 KB
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
43
44
45
46
47
48
%load('..\data\MICCAI_BraTS_2019_Data_Training\name_mapping.csv')
inputheader = '..\data\MICCAI_BraTS_2019_Data_Training\HGG\';
outfolder = '..\testfolder\';
id = 'BraTS19_2013_2_1';
type = 'flair.nii';
filename = strcat(id,'_', type); % BraTS19_2013_2_1_flair.nii
flair_path = strcat(inputheader, id, '\', filename,'\', filename);
%disp(path);
flair = niftiread(flair_path); %size 240x240x155
cp_flair = flair;
type = 'seg.nii';
filename = strcat(id,'_', type); % BraTS19_2013_2_1_seg.nii
seg_path = strcat(inputheader, id, '\', filename, '\', filename);
seg = niftiread(seg_path);
[x,y,z] = size(seg);
% copy flair, segment flair data
cp_flair(seg == 0) = 0;
% save a segmented data
type = 'seg_flair.nii';
filename = strcat(id,'_', type); % BraTS19_2013_2_1_seg_flair.nii
outpath = strcat(outfolder, filename);
%niftiwrite(cp_flair, outpath);
%whos seg
%extract = seg(84, :, 86);
% cp84 = cp_flair(84,:,86);
% flair84 = flair(84,:, 86);
%[flair,info] = ReadData3D(filename)
% whos flair
%volumeViewer(flair);