clear; close all; clc

addpath(genpath('./utils'));
data_path = 'data';

fprintf('Loading mask ... \n');
hdr_mask = spm_vol(sprintf('%s/mask.nii', data_path));
[mask, ~] = spm_read_vols(hdr_mask);  

fprintf('Loading img ... \n');
hdr_img = spm_vol(sprintf('%s/img.nii', data_path));
[img, ~] = spm_read_vols(hdr_img);   

fprintf('Loading ground truth seg ... \n');
hdr_gt = spm_vol(sprintf('%s/gt.nii', data_path));
[gt, ~] = spm_read_vols(hdr_gt);  

%%
seg = gt;

fprintf('Saving of the segmented img ...\n');
hdr_seg = hdr_gt;
hdr_seg.fname = spm_vol(sprintf('%s/seg.nii', data_path));
hdr = spm_write_vol(hdr_seg, seg);


%% save in .mat

save(sprintf('%s/img.mat', data_path),'img');
save(sprintf('%s/mask.mat', data_path),'mask');
save(sprintf('%s/gt.mat', data_path),'gt');




