-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathroiresize.m
27 lines (27 loc) · 1002 Bytes
/
roiresize.m
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
function [ flag ] = roiresize( trainpath, trainroipath, roiheight, roiwidth )
%ROIRESIZE Summary of this function goes here
% Detailed explanation goes here
filedir = dir([trainpath '*roi.mat']);
for i = 1 : length(filedir)
fn = filedir(i).name;
im = load([trainpath fn]);
im = im.roiim;
im = imresize(im, [roiheight, roiwidth]);
save([trainroipath fn], 'im');
im = double(im);
im = im - min(im(:));
im = im ./ max(im(:));
imwrite(im,[trainroipath fn(1:end-3) 'jpeg']);
im = load([trainpath fn(1:end-7) 'massgt.mat']);
im = im.massgt;
im = imresize(im, [roiheight, roiwidth]);
im = imbinarize(im);
save([trainroipath fn(1:end-7) 'massgt.mat'], 'im');
imwrite(im,[trainroipath fn(1:end-7) 'massgt.jpeg']);
end
flag = 1;
mkdir([trainroipath 'massgt\']);
movefile([trainroipath '*massgt.jpeg'], [trainroipath 'massgt\']);
mkdir([trainroipath 'roi\']);
movefile([trainroipath '*roi.jpeg'], [trainroipath, 'roi\']);
end