function [prm] = plugindonorcell(handle,prm)

% not to load the donorcell definition each time, that takes some time
if prm.plugin.plugindonorcell.loaded == 0
    pathload = [prm.pathbase '-donorcell.mat'];
    msg = ['Loading donorcell from ' pathload];
    disp(msg);
    D = load(pathload);
    donorcell = D.donorcellunion;
else
    donorcell = prm.plugin.plugindonorcell.donorcell;
end;
perim = donorcell(:,:,prm.plane);
perim = bwperim(perim);
perim = logical(perim);
load ball1;se = getball(ball,1,1);
perim = imdilate(perim,se);
prm.plugin.plugindonorcell.loaded = 1;
prm.plugin.plugindonorcell.donorcell = donorcell;

for i = 1 : size(handle.subpl,1)
    for j = 1 : size(handle.subpl,2)
        im = handle.subpl(i,j).data;
        sc = handle.subpl(i,j).sc;
        pos = handle.subpl(i,j).pos;
        dim = size(im);
        v = (sc(1) + sc(2))/2;
        if numel(dim) == 2
            im(perim) = v;            
        elseif numel(dim) == 3
            % keep these colors
            k1 = [2];
            for k = numel(k1)
                imhere = im(:,:,k1(k));
                imhere(perim) = v;
                im(:,:,k1(k)) = imhere;
            end;
            % remove these colors
            k2 = [1,3];
            for k = numel(k2)
                imhere = im(:,:,k2(k));
                imhere(perim) = 0;
                im(:,:,k2(k)) = imhere;
            end;
            
        else
            error(['Dimension error in ' mfilename]);
        end;
        subplot('Position',pos,'Parent',handle.fig.handle);imshow(im,sc);        
    end;
end;