flair2seg_1.m 1.01 KB
%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);