RegionMask.java

Go to the documentation of this file.
00001 package theba.core;
00002 
00009 public class RegionMask {
00010 
00011         private Stack volume;
00012 
00013         private int id;
00014 
00015         private BoxBounds bounds;
00016 
00017         int width, height, depth;
00018 
00019         public RegionMask() {
00020         }
00021 
00022         public RegionMask(short id, Stack volume, BoxBounds bounds) {
00023                 this.bounds = bounds;
00024                 this.volume = volume;
00025                 this.id = id;
00026                 width = bounds.xmax - bounds.xmin + 1;
00027                 height = bounds.ymax - bounds.ymin + 1;
00028                 depth = bounds.zmax - bounds.zmin + 1;
00029         }
00030 
00036         public boolean isSet(int xp, int yp, int zp) {
00037                 int x = xp + bounds.xmin;
00038                 int y = yp + bounds.ymin;
00039                 int z = zp + bounds.zmin;
00040                 if (xp < 0 || yp < 0 || zp < 0 || xp >= width || yp >= height
00041                                 || zp >= depth)
00042                         return false;
00043                 return volume.getVoxelUnchecked(x, y, z) == id;
00044         }
00045 
00052         public short getPixelAt(int xp, int yp, int zp) {
00053                 int x = xp + bounds.xmin;
00054                 int y = yp + bounds.ymin;
00055                 int z = zp + bounds.zmin;
00056                 if (xp < 0 || yp < 0 || zp < 0 || xp >= width || yp >= height
00057                                 || zp >= depth)
00058                         return 0;
00059                 return volume.getVoxelUnchecked(x, y, z);
00060         }
00061 
00062         public int getWidth() {
00063                 return width;
00064         }
00065 
00066         public int getHeight() {
00067                 return height;
00068         }
00069 
00070         public int getDepth() {
00071                 return depth;
00072         }
00073 
00074 }

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