/** delete particles corresponding to edge maxima * @param typeP Here the pixel types of the original image are noted, * pixels with bit MAX_AREA at the edge are considered indicators of an edge maximum. * @param ip the image resulting from watershed segmentaiton * (foreground pixels, i.e. particles, are 255, background 0) */ void deleteEdgeParticles(ByteProcessor ip, ByteProcessor typeP) { byte[] pixels = (byte[])ip.getPixels(); byte[] types = (byte[])typeP.getPixels(); width = ip.getWidth(); height = ip.getHeight(); ip.setValue(0); Wand wand = new Wand(ip); for (int x=0; x<width; x++) { int y = 0; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); y = height - 1; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); } for (int y=1; y<height-1; y++) { int x = 0; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); x = width - 1; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); } } //void deleteEdgeParticles
/** delete particles corresponding to edge maxima * @param typeP Here the pixel types of the original image are noted, * pixels with bit MAX_AREA at the edge are considered indicators of an edge maximum. * @param ip the image resulting from watershed segmentaiton * (foreground pixels, i.e. particles, are 255, background 0) */ void deleteEdgeParticles(ByteProcessor ip, ByteProcessor typeP) { byte[] pixels = (byte[])ip.getPixels(); byte[] types = (byte[])typeP.getPixels(); width = ip.getWidth(); height = ip.getHeight(); ip.setValue(0); Wand wand = new Wand(ip); for (int x=0; x<width; x++) { int y = 0; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); y = height - 1; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); } for (int y=1; y<height-1; y++) { int x = 0; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); x = width - 1; if ((types[x+y*width]&MAX_AREA) != 0 && pixels[x+y*width] != 0) deleteParticle(x,y,ip,wand); } } //void deleteEdgeParticles