SurfaceDescriptor.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 SurfaceDescriptor implements RegionDescriptor {
00007 
00008         public Object measure(RegionMask mask) {
00009                 long surface = 0;
00010                 for (int x = 0; x < mask.getWidth(); x++)
00011                         for (int y = 0; y < mask.getHeight(); y++)
00012                                 for (int z = 0; z < mask.getDepth(); z++)
00013                                         if (mask.isSet(x, y, z)) {
00014                                                 if (!mask.isSet(x + 1, y, z))
00015                                                         surface++;
00016                                                 if (!mask.isSet(x - 1, y, z))
00017                                                         surface++;
00018                                                 if (!mask.isSet(x, y + 1, z))
00019                                                         surface++;
00020                                                 if (!mask.isSet(x, y - 1, z))
00021                                                         surface++;
00022                                                 if (!mask.isSet(x, y, z + 1))
00023                                                         surface++;
00024                                                 if (!mask.isSet(x + 1, y, z - 1))
00025                                                         surface++;
00026                                         }
00027                 return surface;
00028         }
00029 
00030         public String getName() {
00031                 return "Surface (3D)";
00032         }
00033 
00034         public String getAbout() {
00035                 return null;
00036         }
00037 
00038         public boolean does3D() {
00039                 return true;
00040         }
00041 
00042         public boolean isNumeric() {
00043                 return true;
00044         }
00045 
00046 }

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