title: Extract multiple ROI pixel value from multiple images
body: <p>I have a programming challenge out of reach of my very stammering Matlab expertise. I have a list of images and list of ROI mask in a cell array, and I want to extract mean pixel value of each ROI individually,
  My code goes like this :</p>
  
  <pre><code>files=dir('*.tif');
  for f=1:length(files)
  image=im2double(imread(files(f).name));       
  pixel_value(:,f)=cellfun(@(x) extractROIpixel(x,image), mask);    
  % apply extractROIpixel on each cell of the mask array
  end
  
  function [ mean_pixel_value ] = extractROIpixel( mask, img )
        mask=im2double(mask);
        mask(mask == 0) = NaN;
        mask_area=mask.*img;
        mean_pixel_value=mean(mask_area(~isnan(mask_area)));  
  end
  </code></pre>
  
  <p>This works, but very slow (&lt;5min), I have 400 images to process with a 200 long cell array of masks (200 ROIs).
  I'm sure it is due to poor design, as Matlab is widely used for this kind of image processing tasks, but I can't figure out another affordable way to do it, thanks in advance.</p>