Sample Code on 2d color images from ISIC skin databse

clear
% load 3 images and corresponding segmentations
I1=double(imread('/Users/hamarneh/Downloads/isic-seg/ISIC_0000001.jpg'));
I2=double(imread('/Users/hamarneh/Downloads/isic-seg/ISIC_0000002.jpg'));
I3=double(imread('/Users/hamarneh/Downloads/isic-seg/ISIC_0000003.jpg'));
S1=double(imread('/Users/hamarneh/Downloads/isic-seg/ISIC_0000001_segmentation.png'));
S2=double(imread('/Users/hamarneh/Downloads/isic-seg/ISIC_0000002_segmentation.png'));
S3=double(imread('/Users/hamarneh/Downloads/isic-seg/ISIC_0000003_segmentation.png'));
 
imgs(:,:,1,1,:)=I1;
imgs(:,:,1,2,:)=I2;
imgs(:,:,1,3,:)=I3;
 
segs(:,:,1,1)=S1;
segs(:,:,1,2)=S2;
segs(:,:,1,3)=S3;
 
%crop 
imgs=imgs(round(end/2)-200:round(end/2)+200,round(end/2)-200:round(end/2)+200,:,:,:);
segs=segs(round(end/2)-200:round(end/2)+200,round(end/2)-200:round(end/2)+200,:,:);
 
DeformIt(imgs, segs, 1, [1  1  1], '/Users/hamarneh/Downloads/isicdeformitout');

Change a few lines (highlighted below)  in DeformIT.m  (lines 500-520)

        if 0 %set to 1 to output nii
            % Save image
            if ndims(newIM) == 5,
                saveNiftiDTI(newIM, sprintf('%s/newIM-%04d.nii', saveDir, k), ...
                    voxSz, 'upper');
            else
                niiIMG = make_nii(newIM, voxSz);
                save_nii(niiIMG, sprintf('%s/newIM-%04d.nii', saveDir, k));
            end
            
            % Save segmentation
            niiS = make_nii(newSeg, voxSz);
            save_nii(niiS, sprintf('%s/newSeg-%04d.nii', saveDir, k));
        else % output PNG FORMAT 
            imwrite(squeeze(uint8(newIM)), sprintf('%s/newIM-%04d.png', saveDir, k));
            niiS = make_nii(newSeg, voxSz);
            imwrite(squeeze(uint8(niiS.img)), sprintf('%s/newSeg-%04d.png', saveDir, k));                       
        end