001/******************************************************************************* 002 * This software is provided as a supplement to the authors' textbooks on digital 003 * image processing published by Springer-Verlag in various languages and editions. 004 * Permission to use and distribute this software is granted under the BSD 2-Clause 005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 006 * Copyright (c) 2006-2016 Wilhelm Burger, Mark J. Burge. All rights reserved. 007 * Visit http://imagingbook.com for additional details. 008 *******************************************************************************/ 009 010package imagingbook.pub.morphology.old; 011 012import imagingbook.pub.morphology.old.BinMorpher; 013 014 015/** 016 * This class is obsolete (replaced by {@link imagingbook.pub.morphology.BinaryMorphologyFilter}). 017 * 018 */ 019@Deprecated 020public class BinMorpherDisk extends BinMorpher { 021 022 BinMorpherDisk(){ 023 makeDisk(1); 024 } 025 026 public BinMorpherDisk(double radius) { 027 makeDisk(radius); 028 029 } 030 031 private void makeDisk(double radius){ 032 int r = (int) Math.rint(radius); 033 if (r <= 1) r = 1; 034 int size = r + r + 1; 035 se = new int[size][size]; 036 double r2 = radius * radius; 037 038 for (int v = -r; v <= r; v++) { 039 for (int u = -r; u <= r; u++) { 040 if (u * u + v * v <= r2) 041 se[v + r][u + r] = 1; 042 } 043 } 044 } 045 046}