area fraction option missing in set measurements box

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

area fraction option missing in set measurements box

Ferrao Santos, Alexandre
 Hello,
 
 It is explained in http://rsb.info.nih.gov/ij/docs/menus/analyze.html that one can select an option "Area fraction" (under "Skewness") to cound fraction of an area covered by thresholded pixels.
 
 Unfortunatelly in my ImageJ install (1.34sm downloaded today) I have no such option. Is this a bug or this option can now be found somewhere else?
 
 Cheers,
 
 Alexandre Santos
Reply | Threaded
Open this post in threaded view
|

Re: area fraction option missing in set measurements box

Ferrao Santos, Alexandre
Sorry to have disturbed, from reading the archives it seems now Area Fraction is a macro not included in the main program:

// "MeasureAreaFraction"
//
// This macro measures the percentage of foreground pixels
// in a  thresholded image or in a 8-bit binary image.

  macro "Measure Percent Area [F9]" {
      getThreshold(lower, upper);
      if (lower!=-1)
          measureThresholdedImage(lower, upper);
       else {
           ok = measureBinaryImage();
           if (!ok)
               showMessage("Thresholded image or 8-bit binary image required");
       }      
  }


  function measureThresholdedImage(lower, upper) {
      if (bitDepth==32)
          exit("This macro does not work with 32-bit images");
      getRawStatistics(n, mean, min, max, std, histogram);
      sum = 0;
      total = 0;
      //print(min, max, lengthOf(histogram));
      for (i=min; i<=max; i++) {
          if (i>=lower && i<=upper)
              sum += histogram[i];
          total += histogram[i];
      }
      percent = sum*100/total;
      run("Measure");
      setResult("%Area", nResults-1, percent);
      updateResults();
  }

 function measureBinaryImage() {
      if (bitDepth!=8) return false;
      getStatistics(n, mean, min, max, std, histogram);
      if (n != histogram[0]+histogram[255])
          return false;
      percent = histogram[255]*100/n;
      run("Measure");
      setResult("%Area", nResults-1, percent);
      updateResults();
      return true;
  }

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]]On Behalf Of
> Ferrao Santos, Alexandre
> Sent: Monday, February 27, 2006 10:18 PM
> To: [hidden email]
> Subject: area fraction option missing in set measurements box
>
>
>  Hello,
>  
>  It is explained in
> http://rsb.info.nih.gov/ij/docs/menus/analyze.html that one
> can select an option "Area fraction" (under "Skewness") to
> cound fraction of an area covered by thresholded pixels.
>  
>  Unfortunatelly in my ImageJ install (1.34sm downloaded
> today) I have no such option. Is this a bug or this option
> can now be found somewhere else?
>  
>  Cheers,
>  
>  Alexandre Santos
>