function improcCLEAN(path3)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% improcCLEAN.m
%
% goes through the processed (now binarized) images and check for
% "pancake amygdales" (amygdales 1 voxel thick), and removes them
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%clear all,close all,clc
files=dir(fullfile(path3, '*.tif'));
for j=2:length(files)-1
    I=imread([path3 files(j-1).name]);
    J=imread([path3 files(j).name]);
    K=imread([path3 files(j+1).name]);
%     I=imread('d:\Binaries\05017-5\05017-5-1_rec0616.tiff');
%     J=imread('d:\Binaries\05017-5\05017-5-1_rec0617.tiff');
%     K=imread('d:\Binaries\05017-5\05017-5-1_rec0618.tiff');
%     subplot(131), imshow(I)
%     subplot(132),imshow(J)
%     subplot(133),imshow(K)
    J2=pancake(I,J,K);
    filename=files(j).name;
    imwrite(J2,[path3 filename(1:end-4) '.tif'],'tif');
    %imshow(J)
%     keyboard
%     
%     imwrite(Ibin,[path3 filename(1:end-4) '.tiff'],'tiff');
end
