head	1.5;
access;
symbols;
locks; strict;
comment	@// @;


1.5
date	95.01.04.07.06.56;	author rjj;	state Exp;
branches;
next	1.4;

1.4
date	94.12.04.21.21.04;	author rjj;	state Exp;
branches;
next	1.3;

1.3
date	94.12.01.22.11.29;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	94.09.23.18.31.39;	author rjj;	state Exp;
branches;
next	1.1;

1.1
date	94.09.23.17.23.19;	author rjj;	state Exp;
branches;
next	;


desc
@Implementation file for the rolling-ball.c algorithm.
@


1.5
log
@Added standard section header.
@
text
@// rolling-ball.c      Section: 5.7, The Rolling Ball Algorithm
//     Copyright 1994, Center for Computer Vision and Visualization,
//     University of Florida.  All rights reserved.

#include "rolling-ball.h"
#include "semi-sphere-image.h"

#include "DDTempl.h"
#include "UcharConv.h"
#include "IntConv.h"
#include "FloatConv.h"


// This algorithm simply implements the image algebra formulation
//    of the rolling ball algorithm, as presented in the manual.
//
// NOTE: This implementation does not support an arbitary
//       structuring element, but the ia formulation does.
//       Such support could be easily added by allowing the
//       calling routine to specify the structuring element
//       as an image of the appropriate type.
//
template <class P, class T>
IA_Image<P,T>
rolling_ball( const IA_Image<P,T> & inImage, double radius ) {

    unsigned int  image_dim( inImage.domain().dim() );

    IA_Image<P,T>
	sball( semi_sphere_image( radius, image_dim, (P*)0, (T*)0 ) );

    IA_DDTemplate<IA_Image<P,T> >
	s( image_dim, sball );

    IA_DDTemplate<IA_Image<P,T> >
	neg_s( image_dim, -sball );

    return
	inImage
	- addmax_product( addmin_product( inImage, neg_s ), s );
}
@


1.4
log
@Corrected previous check in that I though worked...arghhh.
@
text
@d1 1
a1 1
// rolling-ball.c      Section: 5.7  The Rolling Ball Algorithm
@


1.3
log
@Modified header lines.
Removed parameter value that are now given default values.
@
text
@d30 1
a30 1
	sball( semi_sphere_image( radius, image_dim ) );
@


1.2
log
@Forgot to change function name from 'function_ball_image'
  to 'semi_sphere_image'.
@
text
@d1 1
a1 1
// rolling-ball.c      Section: 5.7
a28 4
#if 0
    BallImage<P,T>
	sball( radius, image_dim );
#else
d30 1
a30 3
	sball( semi_sphere_image( radius, image_dim,
				    (P*)0, (T*)0 ) );
#endif
@


1.1
log
@Initial revision
@
text
@d34 1
a34 1
	sball( function_ball_image( radius, image_dim,
@
