Release announcement for version 4.1 of Alan Peters's morphology software. Created 19 July 1993. See the end of this announcement for a list of changes. *** IMPORTANT *** If you are currently using this software, or if after reading this, you download and use this software, kindly send me an e-mail note. I want to compile a list of users so I may keep you informed of any changes, additions, or bug-fixes. Thanks! ======================================================================= Software for 2D and 3D Mathematical Morphology written by Richard Alan Peters II Assistant Professor of Electrical Engineering Vanderbilt University School of Engineering Nashville, TN 37235 (615) 322-7924 rap2@vuse.vanderbilt.edu Mathematical morphology is a powerful tool for image analysis and enhancement. Morphological operators are shape-dependent, nonlinear image transforms such as erosion, dilation, opening, closing, and rank filters. The mathematical operators are defined in n dimensions so it is possible to create programs that will operate on 1D signals, 2D images, or 3D datasets using exactly the same concepts. As operators on 2D binary images, mathematical morphology is well known; much software is available which performs binary morphology. However, the true power in morphology lies in its ability to transform grayscale 2D pixel images and 3D voxel datasets. Software for these operations is less common. This is a morphological software package written under the auspices of the US Airforce Office of Scientific Research at Arnold Airforce Base, Tullahoma, TN during the 1991 Summer Faculty Research program. Subsequently, it has been in continual use and has undergone numerous enhancements. The software includes a 2D image morphology program, a 3D voxel image morphology program, a program for enhancement and noise reduction of 2D images, and related support routines for image arithmetic and logical operations. There are standard unix man pages for all programs. These programs will perform many -- if not all -- of the possible morphological operations on both binary and grayscale images. They include erosion, dilation, opening, closing, rank filters, LUM filters, etc. The 3D image program is ideally suited for the processing of image time-sequences as well as true 3D data. The programs provide many of the commonly used features automatically (such as disk shaped or ellipsoidal structuring elements) or permit the user to customize the operation to fit an application. The user programs operate on Sun rasterfiles. However, the main morphological routines are c-code subroutines. These are independent of specific file formats, so a users can easily write an interface program to operate on other file formats. The software was written on Sun Sparcstations under SunOS Release 4.1.3. However, I used no indigenous libraries other than libm.a. The user interface is of the standard csh command-line variety. This should make porting to other unix platforms trivial (Yeah, right!). I know of one person who ported the program to a PC using Borland C. Apparently, it was not too terribly difficult. This software is freely redistributable, providing I and my school get appropriate credit where due. I hereby grant permission to post the software at any netsite or BBS's, providing, of course, that I get authorship credit, etc. I am not in a position to actively support development of this software. Nor do I have a lot of time to answer questions about it, although I'll make every attempt to do so. The software was used by a dozen grad students in a seminar class this spring; so I'm reasonably sure the most egregious bugs have been squashed. Please do report any bugs to me, though. I'll do what I can to fix them. Also, if you download this software and actually use it, please drop me an e-mail note. I'll then keep you informed of any changes, bug fixes, etc. Enjoy! -Alan. ======================================================================= The following are the programs included in version 4.1 of the mathematical morphology software: Morphology programs: morph - 2D mathematical morphology. It performs erosion, dilation opening, closing, rank, tophat, bothat, LUM, LUM smoothing, LUM sharpening, and binary shape removal. It does both binary and grayscale operations as either set or function operations. morph3d - 3D mathematical morphology. It performs erosion, dilation opening, closing, rank, maxmin, minmax, LUM, LUM smoothing, LUM sharpening, and binary shape removal. It does both binary and grayscale operations as either set or function operations. mclean - 2D morphological noise reduction program that uses morphological size distributions for grayscale image noise reduction while preserving small features. Arithmetic programs: andimg - Perform a pixelwise logical AND of two images. avg3d - Performs a pixelwise running nth order combination on an image time-sequence. Combination types are average, minimum, maximum, median, rank, ordinary linear combination, and rank-ordered linear combination. comb3d - Performs a pixelwise frame-by-frame combination of n image time-sequences or 3D voxel images. Combination types are average, minimum, maximum, median, rank, ordinary linear combination, and rank-ordered linear combination. combimg - Performs a pixelwise combination of n images. Combination types are average, minimum, maximum, median, rank, ordinary linear combination, and rank-ordered linear combination. This particular program was designed specifically to implement the Song-Delp generalized morphological filters. See, Song, J., and E. J. Delp, "A study of the generalized morphological filter,'' submitted to Circuits, Systems, and Signal Processing, 1990. linco - Performs a linear combination of two byte images. Performs 6 different kinds of output scaling: (1) clip if out of bounds, (2) linear compress if out-of-bounds, (3) linear scale of min,max to black,white, (4) scale up if max < white, (5) scale down if min > black, (6) affine scaling using user parameters. It can also be used to scale single images. maximg - Perform a pixelwise maximum of two images. minimg - Perform a pixelwise minimum of two images. orimg - Perform a pixelwise logical OR of two images. support - returns the number of active pixels in a given structuring element. This is very useful for setting rank and LUM filter parameters in morph or morph3d. Rasterfile programs: rasremap - Creates a grayscale rasterfile from an arbitrary 8-bit rasterfile. Causes pixels to at once reference grayscale colormap and reflect true grayscale value. ras2raw - Creates a byte array from an 8-bit rasterfile. raw2ras - Creates an 8-bit rasterfile from a byte array. Script files (using morph): bclose binary closing bdilate binary dilation berode binary erosion bopen binary opening brank binary rank filter gfclose grayscale function-function closing gfdilate grayscale function-function dilation gferode grayscale function-function erosion gfocco grayscale function-function openclose - closeopen gfopen grayscale function-function opening grank grayscale rank filter gsclose grayscale function-set closing gsdilate grayscale function-set dilation gserode grayscale function-set erosion gsocco grayscale function-set openclose - closeopen gsopen grayscale function-set opening hitormiss binary hit-or-miss transform invroll inverted rolling ball transform invtop inverted tophat transform isodel binary isolated delete medge R. Haralick's morphological edge detector rollball rolling ball transform thresh threshold a grayscale image tophat tophat transform ======================================================================= Installation instructions: 1. cd to whatever directory in which you want to have the installation procedure create and fill a directory called "morph". 2. ftp to image.vanderbilt.edu and get morph.tar.Z. A transcription of a typical session follows: % ftp 129.59.100.16 Connected to 129.59.100.16. 220 image FTP server (SunOS 4.1) ready. Name (nnn.nn.nnn.nn:xxx): anonymous 331 Guest login ok, send ident as password. Password: [your email address] 230 Guest login ok, access restrictions apply ftp> cd /pub 250 CWD command successful. ftp> bin 200 Type set to I. ftp> get morph.tar.Z 200 PORT command successful. 150 Binary data connection for morph.tar.Z (n.n.n.n,xxxx) (243551 bytes). 226 Binary Transfer complete. local: morph.tar.Z remote: morph.tar.Z 243551 bytes received in 2.9 seconds (81 Kbytes/s) ftp> quit 221 Goodbye. 3. dearchive the morph directory and its contents: zcat morph.tar.Z | tar xvf - x morph/Makefile, 1593 bytes, 4 tape blocks x morph/arith/maximg.c, 2437 bytes, 5 tape blocks x morph/arith/linco.c, 7716 bytes, 16 tape blocks ... x morph/.nse_depinfo, 201 bytes, 1 tape blocks x morph/man/man1/morph.1, 9134 bytes, 18 tape blocks x morph/man/man1/linco.1, 3107 bytes, 7 tape blocks 4. change access permission of directory "morph" (if you want to) chmod 755 morph 5. cd to morph and make either all of morph cd morph make or just the libraries cd morph make libraries ======================================================================= version 4.1 changes (1) All references to log2() were removed from mclean. Some math libs don't contain log2. (2) morph3d_sub was rewritten to permit SE depths of 1 and 2 to run correctly. (3) program "support" was added to the util directory. It calculates the number of active pixels in a structuring element. This is useful for setting rank or LUM parameters in either morph or morph3d. version 4.0 changes (1) The 'auto' SE flag now makes SE's with even dimensions. e.g. 2x2 (2) The rasterio utilities (in morph/utils) were rewritten to properly process images with an odd number of pixels per row. Also, OpenFile now decompresses unix-compressed (*.Z) rasterfiles. (3) Three new rank-order dependent filters were added, LUMFilt, LUMSmooth, and LUMSharp. LUMfilt is the lower-upper-middle filter as defined by Hardie, R. C., and C. G. Boncelet, "LUM filters: A class of rank-order-based filters for smoothing and sharpening," IEEE Trans. Signal Processing, vol. SP-41, No. 3, March 1993. LUMSMO is the LUM smoothing filter defined therein, and LUMSHA is the LUM sharpening filter. These filters compare the center pixel in a neighborhood defined by an SE to upper and lower order statistics in the neighborhood. Depending on the ordering either the center pixel or one of the order stats is output. (4) The 3D rankfilter now agrees with the 2D that rank == 1 == max (or dilate) and rank == support-of-structuring-elment == min (erode). --