function [ Pbrighter,Pdarker,Psame ] = partitionImage( image,threshold, position )
% Hassan Nahas
%This function partitions an image according to a choice of relative
%position into pixels where that position is brighter, darker or similar.
    pos = index2pos(position);
    translatedImage = imtranslate(image,-[pos(1), -pos(2)]);
    Pbrighter = translatedImage >= (image + threshold);
    Pbrighter = Pbrighter(:,:,1);
    Pdarker = translatedImage <= (image - threshold);
    Pdarker = Pdarker(:,:,1);
    Psame = (translatedImage > (image - threshold)) &(translatedImage < (image + threshold));
    Psame = Psame(:,:,1);
end

