head	1.13;
access;
symbols
	bobbase:1.10
	bob:1.10.1
	r2_1:1.10
	r2_0:1.9
	r1_1_beta:1.9
	r1_1_alpha:1.8
	r1_0:1.8
	r0_11:1.7
	r0_10:1.6
	r0_9:1.3;
locks
	thoth:1.10.1.3; strict;
comment	@// @;


1.13
date	94.12.30.19.17.06;	author fjsoria;	state Exp;
branches;
next	1.12;

1.12
date	94.12.22.21.36.40;	author fjsoria;	state Exp;
branches;
next	1.11;

1.11
date	94.12.22.19.12.06;	author fjsoria;	state Exp;
branches;
next	1.10;

1.10
date	94.09.16.15.03.40;	author thoth;	state Exp;
branches
	1.10.1.1;
next	1.9;

1.9
date	94.07.25.17.26.39;	author thoth;	state Exp;
branches;
next	1.8;

1.8
date	94.05.17.12.53.27;	author thoth;	state Exp;
branches;
next	1.7;

1.7
date	94.03.14.15.51.35;	author thoth;	state Exp;
branches;
next	1.6;

1.6
date	94.01.31.15.46.30;	author thoth;	state Exp;
branches;
next	1.5;

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

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

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

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

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

1.10.1.1
date	94.12.28.17.14.00;	author thoth;	state Exp;
branches;
next	1.10.1.2;

1.10.1.2
date	95.01.09.18.15.45;	author thoth;	state Exp;
branches;
next	1.10.1.3;

1.10.1.3
date	95.01.13.19.37.42;	author thoth;	state Exp;
branches;
next	;


desc
@Integer discrete image implementation.
@


1.13
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 IntDI_rcsid[] = "$Id: IntDI.c,v 1.12 1994/12/22 21:36:40 fjsoria Exp fjsoria $";

//
// $Log: IntDI.c,v $
// Revision 1.12  1994/12/22  21:36:40  fjsoria
// static data member template fix
//
// Revision 1.11  1994/12/22  19:12:06  fjsoria
// added static data member for IA_VectorI
//
// Revision 1.10  1994/09/16  15:03:40  thoth
// remove unnecessary header files.
//
// Revision 1.9  1994/07/25  17:26:39  thoth
// Name sanitization
//
// Revision 1.8  1994/05/17  12:53:27  thoth
// Image Operations now get their own files.
//
// Revision 1.7  1994/03/14  15:51:35  thoth
// ValueSet has been replaced by container class Set.
// abs is now available on Int images.
//
// Revision 1.6  1994/01/31  15:46:30  thoth
// read_PGM now can return the maxval.
// pseudo_division is now available.
//
// Revision 1.5  1994/01/07  15:10:00  thoth
// Image class is now CoreImage and named image types are
// Image<P,T>.
//
// Revision 1.4  1993/12/29  17:03:42  thoth
// write_PGM functions will no longer calculate a maxval of 0.
//
// Revision 1.3  1993/11/17  18:23:26  thoth
// IPSIter is now PSIter<IntPoint>.
// restriction functions now go in the individual image implementation modules.
// read_PGM and write_PGM now support P2 ASCII images.
//
// Revision 1.2  1993/10/05  19:33:08  thoth
// Move to new Closure naming convention.
//
// Revision 1.1  1993/09/15  12:54:51  thoth
// Initial revision
//
// Revision 1.9  93/05/27  11:36:28  thoth
// Copyright Notices
// 
// Revision 1.8  93/05/26  17:02:11  thoth
// instantiate IAAIO.
// 
// Revision 1.7  93/05/18  21:40:49  thoth
// *** empty log message ***
// 
// Revision 1.6  93/04/29  11:20:40  thoth
// non-boxy images now output correctly.
// 
// Revision 1.5  93/04/17  18:48:02  thoth
// use IA_Point<int> instead of IntPoint
// 
// Revision 1.4  93/04/08  13:15:13  thoth
// write_PGM will now compute maxval if not supplied.
// read/write_PGM now accept character strings as well
// as ostream&s and treat them as filenames.
// const_reduce special cases now available.
// 
// Revision 1.3  93/03/10  13:35:32  thoth
// intimage-intimage operations are now generated by a perl script.
// We must still provide some inline functions to help it out though.
// 
// Revision 1.2  93/02/23  14:25:12  thoth
// force an instantiation of OtherDI.
// FunctionRefDIs are supported again.
// 
// Revision 1.1  93/02/20  12:17:42  thoth
// Initial revision
// 
// 

#include	"Closure.h"
#include	"PSIter.h"

#include	"IntDI.h"
#include	"ImageIter.h"

#include	<math.h>
#include	<fstream.h>
#include	<values.h>

#include	"Bit.h"

//
//
//

#include "restrict.h"

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

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

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

//
//

istream &wsc(istream &);	// from UcharDI.c

IA_Image<IA_Point<int>,int>
IA_Image<IA_Point<int>,int>::read_PGM(istream &istr, int *maxval_ret)
{
    int	width, height,maxval;
    int	code;
    if (istr.get()=='P' && ((code=istr.get())=='5' || code == '2')
	&& istr>>wsc>>width>>wsc>>height>>wsc>>maxval) {
	if (maxval_ret)
	    *maxval_ret = maxval;
	{
	    int	ch = istr.get();
	    if (ch!='\n')
		istr.putback(ch);
	}
	const unsigned	size=width*height;
	int	*data = new int[size];
	if (code=='5') {
	    unsigned char	*tmp = new unsigned char[size];
	    if (!istr.read(tmp, size)) {
		delete[] data;
		ia_throw(IA::PNM_IO_ERROR, __FILE__, __LINE__);
		return IA_Image<IA_Point<int>,int>();
	    }
	    for (unsigned i=0; i<size; i++)
		data[i] = tmp[i];
	    delete[] tmp;
	} else {
	    for (unsigned i=0; i<size; i++) {
		if (!(istr >> data[i])) {
		    delete[] data;
		    ia_throw(IA::PNM_IO_ERROR, __FILE__, __LINE__);
		    return IA_Image<IA_Point<int>,int>();
		}
	    }
	}
	return IA_Image<IA_Point<int>,int>
	    (IA_Set<IA_Point<int> >(IA_Point<int>(0,0), IA_Point<int>(height-1,width-1)),
	     data, size, 1);
    } else {
	ia_throw(IA::PNM_IO_ERROR, __FILE__, __LINE__);
	return IA_Image<IA_Point<int>,int>();
    }
}

IA_Image<IA_Point<int>,int>
IA_Image<IA_Point<int>,int>::read_PGM(const char *fname, int *maxval)
{
    ifstream	in(fname);
    return read_PGM(in, maxval);
}

ostream &IA_Image<IA_Point<int>,int>::write_PGM(ostream &o, unsigned maxval) const
{
    // what if image is not dimension 2?

    IA_Set<IA_Point<int> > boxydomain(domain().inf(),domain().sup());
    IA_Point<int>	width(domain().sup()-domain().inf()+1);
    const int	binary_pgm = (maxval <= 255);
    if (binary_pgm)
	o<<"P5\n";
    else
	o<<"P2\n";
    o<<width[1] << " " << width[0] << " " << maxval << "\n";
    IA_PSIter<IA_Point<int> >	iter(boxydomain);
    IA_Point<int>	ip;

    int	idx=0;
    int	oldwidth = o.width(7);
    while (iter(ip)) {
	if (binary_pgm) {
	    o.put((char) ( domain().contains(ip)?(*this)(ip):0));
	} else {
	    o << ( domain().contains(ip)?(*this)(ip):0);
	    if (idx%10 == 0)
		o << '\n';
	    else
		o << ' ';
	}
	idx++;
    }
    return o;
}

ostream &IA_Image<IA_Point<int>,int>::write_PGM(ostream &o) const
{
    const unsigned	m = max(*this);
    return write_PGM(o,m>0?m:1);
}

void IA_Image<IA_Point<int>,int>::write_PGM(const char *fname, unsigned maxval) const
{
    ofstream	out(fname);
    write_PGM(out, maxval);
}

void IA_Image<IA_Point<int>,int>::write_PGM(const char *fname) const
{
    ofstream	out(fname);
    const unsigned	m = max(*this);
    write_PGM(out, m>0?m:1);
}

//
//
//

#if 0

class blah : public IA_ClosureI<IA_Point<int>, int> {
  public:
    blah() 
    :IA_ClosureI<IA_Point<int>,int>(IA_Set<IA_Point<int> >()) {}
    ostream &print_this(ostream &o) const { return o;}
    int operator()(const IA_Point<int> &) const { return 0; }
    IA_ClosureI<IA_Point<int>,int>* clone_self() const { return 0; }
};

static void dummy001()
{
    IA_Point<int>		ip;
    IA_Set<IA_Point<int> >	ps;
    IA_Image<IA_Point<int>,int>	i1;
    IA_Image<IA_Point<int>,int>
	i2(i1),
	i3(ps,0),
	i4(ps, (int*)0, 0, 1),
	i5(ps, (int*)0, 0),
	i6(blah()),
	i7(ps, (int(*)(const IA_Point<int>&))0),
	i10(IA_CoreImage<IA_Point<int>,int>());
    int	sc;

    i1 = i1.restrict(i2.range());
    i1 = i1.xlated(ip);
    (IA_CoreImage<IA_Point<int>,int>&)i1 = 2;
    (void)i1.type();
    i1[ip] = i1(ip);
    i1 = i1.restrict(i2.domain());
    (void)i1.extend(i2);
    (void)i1.reduce((int (*)(const int&,const int&)) 0, 0);
    (void)i1.reduce((int (*)( int, int)) 0, 0);
    cout << (IA_CoreImage<IA_Point<int>,int>&)i1;

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

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

    IA_IVIter<IA_Point<int>, int>	iter1(i1), iter2;
    IA_IPIter<IA_Point<int>, int>	iter3(i2), iter4;
    iter1 = iter2;
    iter3 = iter4;
#if 1
    iter1.reset();
    iter1(sc);
    iter3.reset();
    iter3(ip, sc);
#endif
#if 0
    compose(i1, (IA_Point<int>(*)(const IA_Point<int>&))0);
    compose(i1, *(IA_Closure<IA_Point<int>, IA_Point<int> >*)0);
    compose((int(*)(int))0, i1);
    compose((u_char(*)(int))0, i1, (u_char*)0);
#endif

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


1.12
log
@static data member template fix
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.11 1994/12/22 19:12:06 fjsoria Exp fjsoria $";
d14 3
d111 1
d116 2
@


1.11
log
@added static data member for IA_VectorI
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.10 1994/09/16 15:03:40 thoth Exp fjsoria $";
d14 3
d105 3
d109 3
@


1.10
log
@remove unnecessary header files.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.9 1994/07/25 17:26:39 thoth Exp thoth $";
d14 3
d100 4
@


1.10.1.1
log
@Image I/O is now ROF
remove obsolete instantiation cruft.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.10 1994/09/16 15:03:40 thoth Exp thoth $";
a13 3
// Revision 1.10  1994/09/16  15:03:40  thoth
// remove unnecessary header files.
//
a90 1
#include "image_errors.h"
d112 1
a112 1
read_int_PGM(istream &istr, int *maxval_ret)
d131 1
a131 1
		ia_throw(Image_PNMIO_Exception(__FILE__, __LINE__));
d141 1
a141 1
		    ia_throw(Image_PNMIO_Exception(__FILE__, __LINE__));
d147 1
a147 1
	    (IA_boxy_pset(IA_Point<int>(0,0), IA_Point<int>(height-1,width-1)),
d150 1
a150 1
	ia_throw(Image_PNMIO_Exception(__FILE__, __LINE__));
d156 1
a156 1
read_int_PGM(const char *fname, int *maxval)
d159 1
a159 1
    return read_int_PGM(in, maxval);
d162 1
a162 1
ostream &write_PGM(const IA_Image<IA_Point<int>,int>&img, ostream &o, unsigned maxval)
d166 2
a167 3
    IA_Set<IA_Point<int> > boxydomain
	= IA_boxy_pset(img.domain().inf(),img.domain().sup());
    IA_Point<int>	width(img.domain().sup()-img.domain().inf()+1);
d181 1
a181 1
	    o.put((char) ( img.domain().contains(ip)?img(ip):0));
d183 1
a183 1
	    o << ( img.domain().contains(ip)?img(ip):0);
d194 1
a194 1
ostream & write_PGM(const IA_Image<IA_Point<int>,int>&img, ostream &o)
d196 2
a197 2
    const unsigned	m = max(img);
    return write_PGM(img, o,m>0?m:1);
d200 1
a200 1
void write_PGM(const IA_Image<IA_Point<int>,int>&img, const char *fname, unsigned maxval)
d203 1
a203 1
    write_PGM(img, out, maxval);
d206 1
a206 1
void write_PGM(const IA_Image<IA_Point<int>,int>&img, const char *fname)
d209 2
a210 2
    const unsigned	m = max(img);
    write_PGM(img, out, m>0?m:1);
d216 68
@


1.10.1.2
log
@Make functions match prototype.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.10.1.1 1994/12/28 17:14:00 thoth Exp thoth $";
a13 4
// Revision 1.10.1.1  1994/12/28  17:14:00  thoth
// Image I/O is now ROF
// remove obsolete instantiation cruft.
//
d166 1
a166 1
ostream &write_PGM(const IA_CoreImage<IA_Point<int>,int>&img, ostream &o, unsigned maxval)
d199 1
a199 1
ostream & write_PGM(const IA_CoreImage<IA_Point<int>,int>&img, ostream &o)
d205 1
a205 1
void write_PGM(const IA_CoreImage<IA_Point<int>,int>&img, const char *fname, unsigned maxval)
d211 1
a211 1
void write_PGM(const IA_CoreImage<IA_Point<int>,int>&img, const char *fname)
@


1.10.1.3
log
@CoreImage has been re-merged with Image.  All special stuff should be
friends of FBI now.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.10.1.2 1995/01/09 18:15:45 thoth Exp thoth $";
a13 3
// Revision 1.10.1.2  1995/01/09  18:15:45  thoth
// Make functions match prototype.
//
d170 1
a170 1
ostream &write_PGM(const IA_Image<IA_Point<int>,int>&img, ostream &o, unsigned maxval)
d203 1
a203 1
ostream & write_PGM(const IA_Image<IA_Point<int>,int>&img, ostream &o)
d209 1
a209 1
void write_PGM(const IA_Image<IA_Point<int>,int>&img, const char *fname, unsigned maxval)
d215 1
a215 1
void write_PGM(const IA_Image<IA_Point<int>,int>&img, const char *fname)
@


1.9
log
@Name sanitization
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.8 1994/05/17 12:53:27 thoth Exp $";
d14 3
a83 4
#include	"VectorI.h"
#include	"ConstI.h"
#include	"ClosureI.h"
#include	"ErrorI.h"
@


1.8
log
@Image Operations now get their own files.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.7 1994/03/14 15:51:35 thoth Exp thoth $";
d14 3
d56 1
a56 1
// use IA_IntPoint instead of IntPoint
d112 2
a113 2
IA_Image<IA_IntPoint,int>
IA_Image<IA_IntPoint,int>::read_PGM(istream &istr, int *maxval_ret)
d133 1
a133 1
		return IA_Image<IA_IntPoint,int>();
d143 1
a143 1
		    return IA_Image<IA_IntPoint,int>();
d147 2
a148 2
	return IA_Image<IA_IntPoint,int>
	    (IA_IntPointSet(IA_IntPoint(0,0), IA_IntPoint(height-1,width-1)),
d152 1
a152 1
	return IA_Image<IA_IntPoint,int>();
d156 2
a157 2
IA_Image<IA_IntPoint,int>
IA_Image<IA_IntPoint,int>::read_PGM(const char *fname, int *maxval)
d163 1
a163 1
ostream &IA_Image<IA_IntPoint,int>::write_PGM(ostream &o, unsigned maxval) const
d167 2
a168 2
    IA_IntPointSet boxydomain(domain().inf(),domain().sup());
    IA_IntPoint	width(domain().sup()-domain().inf()+1);
d175 2
a176 2
    IA_PSIter<IA_IntPoint>	iter(boxydomain);
    IA_IntPoint	ip;
d195 1
a195 1
ostream &IA_Image<IA_IntPoint,int>::write_PGM(ostream &o) const
d201 1
a201 1
void IA_Image<IA_IntPoint,int>::write_PGM(const char *fname, unsigned maxval) const
d207 1
a207 1
void IA_Image<IA_IntPoint,int>::write_PGM(const char *fname) const
d220 1
a220 1
class blah : public IA_ClosureI<IA_IntPoint, int> {
d223 1
a223 1
    :IA_ClosureI<IA_IntPoint,int>(IA_IntPointSet()) {}
d225 2
a226 2
    int operator()(const IA_IntPoint &) const { return 0; }
    IA_ClosureI<IA_IntPoint,int>* clone_self() const { return 0; }
d231 4
a234 4
    IA_IntPoint		ip;
    IA_IntPointSet	ps;
    IA_Image<IA_IntPoint,int>	i1;
    IA_Image<IA_IntPoint,int>
d240 2
a241 2
	i7(ps, (int(*)(const IA_IntPoint&))0),
	i10(IA_CoreImage<IA_IntPoint,int>());
d246 1
a246 1
    (IA_CoreImage<IA_IntPoint,int>&)i1 = 2;
d253 1
a253 1
    cout << (IA_CoreImage<IA_IntPoint,int>&)i1;
d256 2
a257 2
    IA_Image<IA_IntPoint,int>::read_IAA("");
    IA_Image<IA_IntPoint,int>::read_IAA("","");
d263 2
a264 2
    IA_IVIter<IA_IntPoint, int>	iter1(i1), iter2;
    IA_IPIter<IA_IntPoint, int>	iter3(i2), iter4;
d274 2
a275 2
    compose(i1, (IA_IntPoint(*)(const IA_IntPoint&))0);
    compose(i1, *(IA_Closure<IA_IntPoint, IA_IntPoint>*)0);
@


1.7
log
@ValueSet has been replaced by container class Set.
abs is now available on Int images.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.6 1994/01/31 15:46:30 thoth Exp thoth $";
d14 4
a209 60

//
// below are included the implementations of every image-image
// and image-scalar operation we could think of for integer images.
//

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;
}

inline int isqrt(int v)
{
    return (int) (sqrt((double) v));
}

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

template <class T>
inline T abs(T v)
{
    return (v>=0)?(v):(-v);
}

inline int pseudo_div(int a, int b)
{
    return (b==0) ? 0 : (a/b);
}


#define  const_reduce_int_int_reduce_plus
inline int const_reduce_reduce_plus(unsigned sz, int arg)
{
    return sz * arg;
}

#define const_reduce_int_int_max
inline int const_reduce_max(unsigned, int arg)
{
    return arg;
}

#define const_reduce_int_int_min
inline int const_reduce_min(unsigned, int arg)
{
    return arg;
}

#include "IntImageOps.c"
@


1.6
log
@read_PGM now can return the maxval.
pseudo_division is now available.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.5 1994/01/07 15:10:00 thoth Exp thoth $";
d14 4
d235 6
d333 1
a333 1
    IA_ValueSet<int>	vs(i1.range());
@


1.5
log
@Image class is now CoreImage and named image types are
Image<P,T>.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.4 1993/12/29 17:03:42 thoth Exp $";
d14 4
d80 2
d101 2
a102 1
IA_Image<IA_IntPoint,int> IA_Image<IA_IntPoint,int>::read_PGM(istream &i)
d106 4
a109 2
    if (i.get()=='P' && ((code=i.get())=='5' || code == '2')
	&& i>>wsc>>width>>wsc>>height>>wsc>>maxval) {
d111 1
a111 1
	    int	ch = i.get();
d113 1
a113 1
		i.putback(ch);
d119 1
a119 1
	    if (!i.read(tmp, size)) {
d129 1
a129 1
		if (!(i >> data[i])) {
d145 2
a146 1
IA_Image<IA_IntPoint,int> IA_Image<IA_IntPoint,int>::read_PGM(const char *fname)
d149 1
a149 1
    return read_PGM(in);
d154 2
d230 6
@


1.4
log
@write_PGM functions will no longer calculate a maxval of 0.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.3 1993/11/17 18:23:26 thoth Exp $";
d14 3
d95 1
a95 1
IA_IntDiscreteImage IA_IntDiscreteImage::read_PGM(istream &i)
d113 1
a113 1
		return IA_IntDiscreteImage();
d120 1
a120 1
		if (!cin >> data[i]) {
d123 1
a123 1
		    return IA_IntDiscreteImage();
d127 1
a127 1
	return IA_IntDiscreteImage
d132 1
a132 1
	return IA_IntDiscreteImage();
d136 1
a136 1
IA_IntDiscreteImage IA_IntDiscreteImage::read_PGM(const char *fname)
d142 1
a142 1
ostream &IA_IntDiscreteImage::write_PGM(ostream &o, unsigned maxval) const
d172 1
a172 1
ostream &IA_IntDiscreteImage::write_PGM(ostream &o) const
d178 1
a178 1
void IA_IntDiscreteImage::write_PGM(const char *fname, unsigned maxval) const
d184 1
a184 1
void IA_IntDiscreteImage::write_PGM(const char *fname) const
d258 2
a259 2
    IA_IntDiscreteImage	i1;
    IA_IntDiscreteImage
d266 1
a266 1
	i10(IA_Image<IA_IntPoint,int>());
d271 1
a271 1
    (IA_Image<IA_IntPoint,int>&)i1 = 2;
d278 1
a278 1
    cout << (IA_Image<IA_IntPoint,int>&)i1;
d281 2
a282 2
    IA_IntDiscreteImage::read_IAA("");
    IA_IntDiscreteImage::read_IAA("","");
@


1.3
log
@IPSIter is now PSIter<IntPoint>.
restriction functions now go in the individual image implementation modules.
read_PGM and write_PGM now support P2 ASCII images.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.2 1993/10/05 19:33:08 thoth Exp thoth $";
d14 5
d71 1
d83 4
d171 2
a172 1
    return write_PGM(o,max(*this));
d184 2
a185 1
    write_PGM(out, max(*this));
@


1.2
log
@Move to new Closure naming convention.
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDI.c,v 1.1 1993/09/15 12:54:51 thoth Exp thoth $";
d14 3
d55 1
a55 1
#include	"IPSIter.h"
d71 11
d85 3
a87 3
    if (i.get()=='P' && i.get()=='5' && i>>ws>>width>>height>>maxval) {
	const unsigned	size=width*height;
	unsigned char	*tmp = new unsigned char[size];
d93 1
a93 2
	if (!i.read(tmp, size))
	    return IA_IntDiscreteImage();
d95 22
a116 5
	for (unsigned i=0; i<size; i++)
	    data[i] = tmp[i];
	delete[] tmp;
	return     IA_IntDiscreteImage (IA_IntPointSet(IA_IntPoint(0,0), IA_IntPoint(height-1,width-1)),
					data, size, 1);
d118 1
d133 7
a139 2
    o<<"P5\n"<<width[1] << " " << width[0] << " " << maxval << "\n";
    IA_IPSIter	iter(boxydomain);
d142 2
d145 10
a154 1
	o.put((char) ( domain().contains(ip)?(*this)(ip):0));
@


1.1
log
@Initial revision
@
text
@d10 1
a10 1
static char IntDI_rcsid[] = "$Id: IntDiscreteImage.c,v 1.9 93/05/27 11:36:28 thoth Exp $";
d13 4
a16 1
// $Log:	IntDiscreteImage.c,v $
d57 1
a57 1
#include	"OtherI.h"
d183 1
a183 1
class blah : public IA_OtherI<IA_IntPoint, int> {
d186 1
a186 1
    :IA_OtherI<IA_IntPoint,int>(IA_IntPointSet()) {}
d189 1
a189 1
    IA_OtherI<IA_IntPoint,int>* clone_self() const { return 0; }
@
