0

I have used 'regionprops' to identify regions after a volume segmentation. I need to know the pixel values within each region. The result from 'regionprops' include 'PixelList'. For example, the first region's pixel subscripts in my volume are:

regions(1).PixelList:


   100    27    73
   100    26    74
    99    25    75

There are more than 4000 regions. It takes time as well as being inelegant to go through all the regions in a loop.

How can I get the 'PixelList' for all the regions and calculate the Mean, Max, Min, etc. for every region without using a loop.

Thanks.

user1641496
  • 457
  • 1
  • 8
  • 18

1 Answers1

1

You can pass the intensity image, as well as the label mask to regionprops:

>> p = regionprops( bw, intensity, 'MaxIntensity', 'MeanIntensity' );

Read more about it in the docs

Shai
  • 111,146
  • 38
  • 238
  • 371
  • I am afraid it is not possible for 3D volumes. It is only for 2D. – user1641496 Jul 08 '13 at 10:07
  • 1
    @user1641496 once you have `bw` and `intensity` you can `reshape` them to 2D and apply `regionprops`. Note that while this trick is good for `'MeanIntensity'` and `'MaxIntensity'` this trick will **fail** for other properties, such as `'WeightedCentroid'`. – Shai Jul 08 '13 at 10:41