getData.m 597 B

1234567891011121314151617181920212223242526
  1. function ty=getData(data,i,j,k)
  2. %getData at i,j,k
  3. xsize=size(data);
  4. ty=squeeze(data(i,j,k,:));
  5. %add neighbours for smoothing
  6. tw=1;
  7. fc=[i j k];
  8. for na=1:6
  9. ao=zeros(size(fc));
  10. i2=idivide(int16(na-1),2);
  11. ao(i2+1)=2*rem(na-1,2)-1;
  12. %disp(ao)
  13. fc1=fc+single(ao);
  14. if any(fc1<1)
  15. continue
  16. end
  17. if any(fc1>xsize(1:3))
  18. continue
  19. end
  20. w=0.5/sum(ao.*ao);
  21. %disp(fc1)
  22. ty=ty+w*squeeze(data(fc1(1),fc1(2),fc1(3),:));
  23. tw=tw+w;
  24. end
  25. ty=ty./tw;
  26. end