Method: RTKIT::BinImage#area
- Defined in:
- lib/rtkit/bin_image.rb
#area(type = true) ⇒ Object
Calculates the area defined by true/false (1/0) pixels. By default, the area of the true pixels are returned. Returns a float value, in units of millimeters squared.
Parameters
-
type– Boolean. Pixel type of interest.
92 93 94 95 96 97 98 99 100 |
# File 'lib/rtkit/bin_image.rb', line 92 def area(type=true) if type number = (@narray.eq 1).where.length else number = (@narray.eq 0).where.length end # Total area is number of pixels times the area per pixel: return number * @image.pixel_area end |