function [DAnterior, DCenter, DPosterior] = getIVDdistances(Infr,Supr,xgrid,ygrid,zgrid,xgrid2,ygrid2,zgrid2)

if xgrid~=0 & ygrid~=0 & zgrid~=0
    InfrAnterior = [xgrid(3,1) ygrid(3,1) zgrid(3,1)];
    InfrCenter = [xgrid(3,3) ygrid(3,3) zgrid(3,3)];
    InfrPosterior = [xgrid(3,5) ygrid(3,5) zgrid(3,5)];
        
    SuprAnterior = [xgrid2(3,1) ygrid2(3,1) zgrid2(3,1)];
    SuprCenter = [xgrid2(3,3) ygrid2(3,3) zgrid2(3,3)];
    SuprPosterior = [xgrid2(3,5) ygrid2(3,5) zgrid2(3,5)];
    
    DAnterior = sqrt(sum((InfrAnterior - SuprAnterior).^2));
    DCenter = sqrt(sum((InfrCenter - SuprCenter).^2));
    DPosterior = sqrt(sum((InfrPosterior - SuprPosterior).^2));
else
    DAnterior = 0;
    DCenter = 0;
    DPosterior = 0;
end