FreeSurfaceDescriptor.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 FreeSurfaceDescriptor 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.getPixelAt(x + 1, y, z) == 0)
00015 surface++;
00016 if (mask.getPixelAt(x - 1, y, z) == 0)
00017 surface++;
00018 if (mask.getPixelAt(x, y + 1, z) == 0)
00019 surface++;
00020 if (mask.getPixelAt(x, y - 1, z) == 0)
00021 surface++;
00022 if (mask.getPixelAt(x, y, z + 1) == 0)
00023 surface++;
00024 if (mask.getPixelAt(x + 1, y, z - 1) == 0)
00025 surface++;
00026 }
00027 return surface;
00028 }
00029
00030 public String getName() {
00031 return "Free Surface (3D)";
00032 }
00033
00034 public String getAbout() {
00035 return "Counts each side of a border-voxel that is not part of this region \n This estimates the surface of this region";
00036 }
00037
00038 public boolean does3D() {
00039 return true;
00040 }
00041
00042 public boolean isNumeric() {
00043 return true;
00044 }
00045
00046 }