public void setf( final int i, final float value ) { ip.set( i, Math.max( 0, Math.min( 65535, Util.roundPos( value ) ) ) ); } }
private ShortProcessor initialize(ImageProcessor marker) { // size of image sizeX = marker.getWidth(); sizeY = marker.getHeight(); ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (foreground) or Inf (background) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int val = marker.get(x, y) & 0x00ff; distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0); } } return distMap; }
private ShortProcessor initialize(ImageProcessor marker) { // size of image sizeX = marker.getWidth(); sizeY = marker.getHeight(); ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (foreground) or Inf (background) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int val = marker.get(x, y) & 0x00ff; distMap.set(x, y, val == 0 ? Short.MAX_VALUE : 0); } } return distMap; }
final double f = alpha.getPixelInterpolated( t[ 0 ], t[ 1 ] ) / 255.0; final double v = it + f * ( is - it ); target.set( x, y, ( int )Math.max( 0, Math.min( 65535, Math.round( v ) ) ) );
private ShortProcessor initializeResult(ImageProcessor labelImage) { this.fireStatusChanged(new AlgoEvent(this, "Initialization")); // size of image int sizeX = labelImage.getWidth(); int sizeY = labelImage.getHeight(); // create new empty image, and fill it with black ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (background) or Inf (foreground) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int label = (int) labelImage.getf(x, y); distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE); } } return distMap; }
private void normalizeResult(ShortProcessor distMap, ImageProcessor labelImage) { this.fireStatusChanged(new AlgoEvent(this, "Normalization")); // size of image int sizeX = labelImage.getWidth(); int sizeY = labelImage.getHeight(); // normalization weight int w0 = weights[0]; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { if ((int) labelImage.getf(x, y) > 0) { distMap.set(x, y, distMap.get(x, y) / w0); } } } } }
private ShortProcessor initializeResult(ImageProcessor labelImage) { this.fireStatusChanged(new AlgoEvent(this, "Initialization")); // size of image int sizeX = labelImage.getWidth(); int sizeY = labelImage.getHeight(); // create new empty image, and fill it with black ShortProcessor distMap = new ShortProcessor(sizeX, sizeY); distMap.setValue(0); distMap.fill(); // initialize empty image with either 0 (background) or Inf (foreground) for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { int label = (int) labelImage.getf(x, y); distMap.set(x, y, label == 0 ? 0 : Short.MAX_VALUE); } } return distMap; }
private void normalizeResult(ShortProcessor distMap, ImageProcessor labelImage) { this.fireStatusChanged(new AlgoEvent(this, "Normalization")); // size of image int sizeX = labelImage.getWidth(); int sizeY = labelImage.getHeight(); // normalization weight int w0 = weights[0]; for (int y = 0; y < sizeY; y++) { for (int x = 0; x < sizeX; x++) { if ((int) labelImage.getf(x, y) > 0) { distMap.set(x, y, distMap.get(x, y) / w0); } } } } }
distMap.set(x, y, newDist);
distMap.set(x, y, newDist);
distMap.set(x, y, newDist);
distMap.set(x, y, newDist);