Showing
2 changed files
with
46 additions
and
0 deletions
code/classifier/networks/grayResNet2.py
0 → 100644
This diff is collapsed. Click to expand it.
code/getNormalFrames.m
0 → 100644
| 1 | +inputheader = '..\data\Normal_all\'; | ||
| 2 | +outfolder = '..\data\Normal_frames\'; | ||
| 3 | + | ||
| 4 | +files = dir(inputheader); | ||
| 5 | +id = {files.name}; | ||
| 6 | +% files + dir file | ||
| 7 | +flag = ~strcmp(id, '.') & ~strcmp(id, '..'); | ||
| 8 | +files = files(flag); | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +for i = 1 : length(files) | ||
| 12 | + | ||
| 13 | + id = split(files(i).name, '.nii'); | ||
| 14 | + id = char(id(1)); | ||
| 15 | + fprintf('ID #%d = %s\n', i, id); | ||
| 16 | + filename = id; % BraTS19_2013_2_1_seg_flair.nii | ||
| 17 | + data_path = strcat(inputheader,'\', filename); | ||
| 18 | + data = niftiread(data_path); %size 240x240x155 | ||
| 19 | + | ||
| 20 | + [x,y,z] = size(data); | ||
| 21 | + | ||
| 22 | + c = 0; | ||
| 23 | + | ||
| 24 | + for k = 18:24 | ||
| 25 | + type = '.png'; | ||
| 26 | + filename = strcat(id, '_', int2str(c), type); % BraTS19_2013_2_1_seg_flair_c.png | ||
| 27 | + outpath = strcat(outfolder, filename); | ||
| 28 | + % typecase int16 to double, range[0, 1], rotate 90 and filp updown | ||
| 29 | + % range [0, 1] | ||
| 30 | + %cp_data = flipud(rot90(mat2gray(double(data(:,:,k))))); | ||
| 31 | + cp_data = flipud(rot90(mat2gray(double(data(:,:,k))))); | ||
| 32 | +% M = max(cp_data(:)); | ||
| 33 | +% disp(M); | ||
| 34 | + imwrite(cp_data, outpath); | ||
| 35 | + | ||
| 36 | + c = c+ 1; | ||
| 37 | + end | ||
| 38 | + | ||
| 39 | +end | ||
| 40 | + | ||
| 41 | + | ||
| 42 | +% p = 'st: %d\n'; | ||
| 43 | +% fprintf(p, st); | ||
| 44 | +% p = 'en: %d\n'; | ||
| 45 | +% fprintf(p, en); | ||
| 46 | + |
-
Please register or login to post a comment