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


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


desc
@dsp's original implementation.  RCS'd for posterity.
@


1.1
log
@Initial revision
@
text
@//SISThresh.c - Image algebra C++ program to determine the threshold
//              level for an image based on SIS
//
//Cross-references:  IA with Apps. pp x-X; IA Handbook pp. y-Y

#include "imagealgebra.h"


main()
{
   IA_IntPointSet s_ps(IA_IntPoint(-1,0),IA_IntPoint(1,0)),
                  t_ps(IA_IntPoint(0,-1),IA_IntPoint(0,1));

   IA_FloatDiscreteImage s_img(s_ps,0.0), t_img(t_ps,0.0);

   s_img[IA_IntPoint(-1,0)] = 1.0; 
   s_img[IA_IntPoint(1,0)] = -1.0;
   t_img[IA_IntPoint(0,-1)] = -1.0;
   t_img[IA_IntPoint(0,1)] = 1.0;

   IA_FloatDDTemplate s(2,s_img), t(2,t_img);
   
   IA_FloatDiscreteImage a;

   a = IA_IntDiscreteImage::read_PGM(cin);

   IA_FloatDiscreteImage e;

   e = max(sqrt(sqr(linear_product(a,s))),
           sqrt(sqr(linear_product(a,t))));

   float tau;



   tau = sum(e * sqrt(sqr(a)))/sum(e);

   cerr << "SIS THRESHOLD: " << tau << "\n";

   a = chi_ge(a,tau);

//   display(to_uchar(a)); 
}
@
