/code/getpoints.m

http://ne-proj.googlecode.com/ · Objective C · 25 lines · 23 code · 2 blank · 0 comment · 1 complexity · d0ecabf14e22648fd3cb7164866ca4ca MD5 · raw file

  1. %************************************************************************************************************
  2. % "getpoints.m" creates a set of points corresponding to the average
  3. % ROI value in each slice .
  4. % inputs:
  5. % im- the image from which the ROI is selected.
  6. % num_s- the image's number of slices
  7. % ROI- an image with the same size of 'im':the pixels of the ROI equal 1
  8. % and the others 0.
  9. % output:
  10. % points- the set of averaged points
  11. % SD- the standard deviation
  12. % mask_size- the number of pixels in the chosen ROI
  13. %************************************************************************************************************
  14. function [points,SD, mask_size] = getpoints(im, num_s,ROI)
  15. for j=1:num_s
  16. im_mask=im(:,:,j).*ROI;
  17. mask_temp=im_mask(im_mask>0);
  18. points(j)=mean(mask_temp);
  19. % SD= std(im_mask(im_mask>0))/points(j);
  20. SD(j)= std(mask_temp);
  21. end
  22. mask_size=length(mask_temp);
  23. end