function ty=getData(data,i,j,k) %getData at i,j,k xsize=size(data); ty=squeeze(data(i,j,k,:)); %add neighbours for smoothing tw=1; fc=[i j k]; for na=1:6 ao=zeros(size(fc)); i2=idivide(int16(na-1),2); ao(i2+1)=2*rem(na-1,2)-1; %disp(ao) fc1=fc+single(ao); if any(fc1<1) continue end if any(fc1>xsize(1:3)) continue end w=0.5/sum(ao.*ao); %disp(fc1) ty=ty+w*squeeze(data(fc1(1),fc1(2),fc1(3),:)); tw=tw+w; end ty=ty./tw; end