SolidityDescriptor.java

Go to the documentation of this file.
00001 package theba.descriptors;
00002 
00003 import theba.core.RegionDescriptor;
00004 import theba.core.RegionMask;
00005 
00006 public class SolidityDescriptor implements RegionDescriptor {
00007 
00008         public double measure(short[] mask, int width, int height) {
00009                 return ConvexityDescriptor.getSolidity(mask, width, height);
00010         }
00011 
00012         public String getName() {
00013                 return "Solidity";
00014         }
00015 
00016         public Object measure(RegionMask vmask) {
00017                 short[] mask = new short[vmask.getWidth() * vmask.getHeight()];
00018                 for (int x = 0; x < vmask.getWidth(); x++)
00019                         for (int y = 0; y < vmask.getHeight(); y++)
00020                                 if (vmask.isSet(x, y, 0))
00021                                         mask[x + y * vmask.getWidth()] = 1;
00022                 return measure(mask, vmask.getWidth(), vmask.getHeight());
00023         }
00024 
00025         public String getAbout() {
00026                 return "Returns the solidity = (area/convex) area of a 2D-region ";
00027         }
00028 
00029         public boolean does3D() {
00030                 return false;
00031         }
00032 
00033         public boolean isNumeric() {
00034                 return true;
00035         }
00036 
00037 }

Generated on Fri Nov 13 08:57:07 2009 for Theba by  doxygen 1.6.1