head	1.9;
access;
symbols
	bobbase:1.6
	bob:1.6.1
	r2_1:1.6
	r2_0:1.6
	r1_1_beta:1.5
	r1_1_alpha:1.4
	r1_0:1.4
	r0_11:1.3
	r0_10:1.2
	r0_9:1.1;
locks
	thoth:1.6.1.2; strict;
comment	@// @;


1.9
date	94.12.30.19.17.06;	author fjsoria;	state Exp;
branches;
next	1.8;

1.8
date	94.12.22.21.36.40;	author fjsoria;	state Exp;
branches;
next	1.7;

1.7
date	94.12.22.19.12.06;	author fjsoria;	state Exp;
branches;
next	1.6;

1.6
date	94.08.22.15.20.29;	author thoth;	state Exp;
branches
	1.6.1.1;
next	1.5;

1.5
date	94.07.25.17.26.39;	author thoth;	state Exp;
branches;
next	1.4;

1.4
date	94.05.17.12.53.27;	author thoth;	state Exp;
branches;
next	1.3;

1.3
date	94.03.14.15.50.10;	author thoth;	state Exp;
branches;
next	1.2;

1.2
date	94.01.07.15.10.00;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	93.11.29.22.20.39;	author thoth;	state Exp;
branches;
next	;

1.6.1.1
date	94.12.28.16.56.06;	author thoth;	state Exp;
branches;
next	1.6.1.2;

1.6.1.2
date	95.01.13.19.45.08;	author thoth;	state Exp;
branches;
next	;


desc
@Complex Discrete Image implementation
@


1.9
log
@added more static data
@
text
@// Emacs: -*- C++ -*-

//
//	Copyright 1993, Center for Computer Vision and Visualization,
//	University of Florida.  All rights reserved.
//

static char copyright[] = "Copyright 1993, Center for Computer Vision and Visualization,\nUniversity of Florida.  All rights reserved.\n";

static char ComplexDI_rcsid[] = "$Id: CplxDI.c,v 1.8 1994/12/22 21:36:40 fjsoria Exp fjsoria $";

//
// $Log: CplxDI.c,v $
// Revision 1.8  1994/12/22  21:36:40  fjsoria
// static data member template fix
//
// Revision 1.7  1994/12/22  19:12:06  fjsoria
// added static data member for IA_VectorI
//
// Revision 1.6  1994/08/22  15:20:29  thoth
// DOS-inspired name rework.
//
// Revision 1.5  1994/07/25  17:26:39  thoth
// Name sanitization
//
// Revision 1.4  1994/05/17  12:53:27  thoth
// Image Operations now get their own files.
//
// Revision 1.3  1994/03/14  15:50:10  thoth
// ValueSet has been replaced by container class Set.
//
// Revision 1.2  1994/01/07  15:10:00  thoth
// Image class is now CoreImage and named image types are
// Image<P,T>.
//
// Revision 1.1  1993/11/29  22:20:39  thoth
// Initial revision
//
//


#include	<math.h>
#include	<fstream.h>
#include	"VectorI.h"
#include	"ConstI.h"
#include        "ClosureI.h"
#include	"ErrorI.h"
#include	"ImageIter.h"
#include	"PSIter.h"
#include	"CplxDI.h"


//
//
//

#include "restrict.h"

#ifdef IA_NO_AUTOINST_OF_STATIC_DATA
#include "FuncI.h"
#include "LazyXlationI.h"
char IA_VectorI<IA_Point<int>, complex>::dummy;
char IA_ConstI<IA_Point<int>, complex>::dummy;
char IA_ClosureI<IA_Point<int>, complex>::dummy;
char IA_FunctionRefI<IA_Point<int>, complex>::dummy = 0;
char IA_LazyXlationI<IA_Point<int>, complex>::dummy;
char IA_FunctionI<IA_Point<int>, complex>::dummy = 0;
#endif


IA_BaseImage<IA_Point<int>,complex> *restrict_toD(const IA_BaseImage<IA_Point<int>, complex> *im, const IA_Set<IA_Point<int> > &ips) {
    return restrictD_toD(im, ips);
}


//
//


IA_Image<IA_Point<int>,complex>::
IA_Image(const IA_CoreImage<IA_Point<int>,float> &re,
	 const IA_CoreImage<IA_Point<int>,float> &im)
{
    if(im.domain() != re.domain()) {
	ia_throw( IA::PSET_MISMATCH, __FILE__,__LINE__);
	return;
    }

    const unsigned      sz = re.domain().card();
    complex * const     vec = new complex[sz];
    complex *scan = vec;
    float   re_temp,im_temp;
    IA_IVIter<IA_Point<int>,float>       re_iter(re),im_iter(im);

    while(re_iter(re_temp) && im_iter(im_temp)) {
        *(scan++) = complex(re_temp,im_temp);
    }

    disassociate_image();
    set_and_reference_image(new IA_VectorI<IA_Point<int>,complex>
			    (re.domain(), vec, sz, 1));
}

//
//
//

#if 0

class blah : public IA_ClosureI<IA_Point<int>,complex> {
  public:
    blah() 
    :IA_ClosureI<IA_Point<int>,complex>(IA_Set<IA_Point<int> >()) {}
    ostream &print_this(ostream &o) const { return o;}
    complex operator()(const IA_Point<int> &) const { return 0; }
    IA_ClosureI<IA_Point<int>,complex>* clone_self() const { return 0; }
};
static void dummy001()
{
    IA_Point<int>		ip;
    IA_Set<IA_Point<int> >	ps;
    IA_Image<IA_Point<int>,complex>	i1;
    IA_Image<IA_Point<int>,complex>
	i2(i1),
	i3(ps,0.0),
	i4(ps, (complex*)0, 0, 1),
	i5(ps, (complex*)0, 0),
	i6(blah()),
	i7(ps, (complex(*)(const IA_Point<int>&))0),
	i10(IA_CoreImage<IA_Point<int>, complex>());
    i1 = i1.restrict(i2.range());
    i1 = i1.translate(ip);
    (IA_CoreImage<IA_Point<int>, complex>&)i1 = 2;
    (void)i1.type();
    i1[ip] = i1(ip);
    i1 = i1.restrict(i2.domain());
    (void)i1.extend(i2);
    (void)i1.reduce((complex (*)(const complex&,const complex&)) 0, 0);
    (void)i1.reduce((complex (*)( complex, complex)) 0, 0);
    cout << (IA_CoreImage<IA_Point<int>, complex>&)i1;

#if 0
    IA_Image<IA_Point<int>,complex>::read_IAA("");
    IA_Image<IA_Point<int>,complex>::read_IAA("","");

    i1.write_IAA("");
    i1.write_IAA("","");
#endif

    IA_IVIter<IA_Point<int>,complex>	iter1(i1), iter2;
    IA_IPIter<IA_Point<int>,complex>	iter3(i2), iter4;
    iter1 = iter2;
    iter3 = iter4;

    compose(i1, (IA_Point<int>(*)(const IA_Point<int>&))0);
    compose(i1, *(IA_Closure<IA_Point<int>, IA_Point<int> >*)0);
    compose((complex(*)(complex))0, i1);
    compose((complex(*)(complex))0, (IA_CoreImage<IA_Point<int>, complex>&)i1);
//    compose((u_char(*)(complex))0, i1, (u_char*)0);

    IA_Set<complex>	vs(i1.range());
    // I shouldn\'t have to do the following two lines
    // vs.value_type_compare(0,0);
}

#endif
@


1.8
log
@static data member template fix
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: CplxDI.c,v 1.7 1994/12/22 19:12:06 fjsoria Exp fjsoria $";
d14 3
d61 1
d66 2
@


1.7
log
@added static data member for IA_VectorI
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: CplxDI.c,v 1.6 1994/08/22 15:20:29 thoth Exp fjsoria $";
d14 3
d57 1
d59 3
@


1.6
log
@DOS-inspired name rework.
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: ComplexDI.c,v 1.5 1994/07/25 17:26:39 thoth Exp thoth $";
d13 4
a16 1
// $Log: ComplexDI.c,v $
d40 1
a40 1
#include	"ClosureI.h"
d52 5
@


1.6.1.1
log
@Conversion to classes for throw.
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: CplxDI.c,v 1.6 1994/08/22 15:20:29 thoth Exp thoth $";
d13 1
a13 4
// $Log: CplxDI.c,v $
// Revision 1.6  1994/08/22  15:20:29  thoth
// DOS-inspired name rework.
//
d64 1
a64 1
	ia_throw(Image_DomainMismatch_Exception(__FILE__,__LINE__));
@


1.6.1.2
log
@CoreImage has been re-merged with Image.  All special stuff should be
friends of FBI now.
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: CplxDI.c,v 1.6.1.1 1994/12/28 16:56:06 thoth Exp thoth $";
a13 3
// Revision 1.6.1.1  1994/12/28  16:56:06  thoth
// Conversion to classes for throw.
//
d62 3
a64 3
IA_Image<IA_Point<int>,complex>
IA_CplxDI(const IA_Image<IA_Point<int>,float> &re,
	 const IA_Image<IA_Point<int>,float> &im)
d68 1
a68 1
	return IA_Image<IA_Point<int>,complex>();
d81 3
a83 1
    return IA_Image<IA_Point<int>,complex> (re.domain(), vec, sz, 1);
d112 1
a112 1
	i10(IA_Image<IA_Point<int>, complex>());
d115 1
a115 1
    (IA_Image<IA_Point<int>, complex>&)i1 = 2;
d122 1
a122 1
    cout << (IA_Image<IA_Point<int>, complex>&)i1;
d140 1
a140 1
    compose((complex(*)(complex))0, (IA_Image<IA_Point<int>, complex>&)i1);
@


1.5
log
@Name sanitization
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: ComplexDI.c,v 1.4 1994/05/17 12:53:27 thoth Exp $";
d14 3
d41 1
a41 1
#include	"ComplexDI.h"
@


1.4
log
@Image Operations now get their own files.
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: ComplexDI.c,v 1.3 1994/03/14 15:50:10 thoth Exp thoth $";
d14 3
d56 3
a58 3
IA_Image<IA_IntPoint,complex>::
IA_Image(const IA_CoreImage<IA_IntPoint,float> &re,
	 const IA_CoreImage<IA_IntPoint,float> &im)
d69 1
a69 1
    IA_IVIter<IA_IntPoint,float>       re_iter(re),im_iter(im);
d76 1
a76 1
    set_and_reference_image(new IA_VectorI<IA_IntPoint,complex>
d86 1
a86 1
class blah : public IA_ClosureI<IA_IntPoint,complex> {
d89 1
a89 1
    :IA_ClosureI<IA_IntPoint,complex>(IA_IntPointSet()) {}
d91 2
a92 2
    complex operator()(const IA_IntPoint &) const { return 0; }
    IA_ClosureI<IA_IntPoint,complex>* clone_self() const { return 0; }
d96 4
a99 4
    IA_IntPoint		ip;
    IA_IntPointSet	ps;
    IA_Image<IA_IntPoint,complex>	i1;
    IA_Image<IA_IntPoint,complex>
d105 2
a106 2
	i7(ps, (complex(*)(const IA_IntPoint&))0),
	i10(IA_CoreImage<IA_IntPoint, complex>());
d109 1
a109 1
    (IA_CoreImage<IA_IntPoint, complex>&)i1 = 2;
d116 1
a116 1
    cout << (IA_CoreImage<IA_IntPoint, complex>&)i1;
d119 2
a120 2
    IA_Image<IA_IntPoint,complex>::read_IAA("");
    IA_Image<IA_IntPoint,complex>::read_IAA("","");
d126 2
a127 2
    IA_IVIter<IA_IntPoint,complex>	iter1(i1), iter2;
    IA_IPIter<IA_IntPoint,complex>	iter3(i2), iter4;
d131 2
a132 2
    compose(i1, (IA_IntPoint(*)(const IA_IntPoint&))0);
    compose(i1, *(IA_Closure<IA_IntPoint, IA_IntPoint>*)0);
d134 1
a134 1
    compose((complex(*)(complex))0, (IA_CoreImage<IA_IntPoint, complex>&)i1);
@


1.3
log
@ValueSet has been replaced by container class Set.
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: ComplexDI.c,v 1.2 1994/01/07 15:10:00 thoth Exp thoth $";
d14 3
a51 18
template <class T>
inline T max(T a, T b)
{
    return (a<b)?b:a;
}

template <class T>
inline T min(T a, T b)
{
    return (a<b)?a:b;
}

template <class T>
inline T sqr(T v)
{
    return v*v;
}

a75 2

#include "ComplexImageOps.c"
@


1.2
log
@Image class is now CoreImage and named image types are
Image<P,T>.
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id: ComplexDI.c,v 1.1 1993/11/29 22:20:39 thoth Exp $";
d14 4
d98 2
d151 1
a151 1
    IA_ValueSet<complex>	vs(i1.range());
d156 1
@


1.1
log
@Initial revision
@
text
@d10 1
a10 1
static char ComplexDI_rcsid[] = "$Id$";
d13 3
a15 1
// $Log$
d17 1
d64 3
a66 3
IA_ComplexDiscreteImage::
IA_ComplexDiscreteImage(const IA_Image<IA_IntPoint,float> &re,
			const IA_Image<IA_IntPoint,float> &im)
d106 2
a107 2
    IA_ComplexDiscreteImage	i1;
    IA_ComplexDiscreteImage
d114 1
a114 1
	i10(IA_Image<IA_IntPoint, complex>());
d117 1
a117 1
    (IA_Image<IA_IntPoint, complex>&)i1 = 2;
d124 1
a124 1
    cout << (IA_Image<IA_IntPoint, complex>&)i1;
d127 2
a128 2
    IA_ComplexDiscreteImage::read_IAA("");
    IA_ComplexDiscreteImage::read_IAA("","");
d142 1
a142 1
    compose((complex(*)(complex))0, (IA_Image<IA_IntPoint, complex>&)i1);
@
