head	1.17;
access;
symbols
	bobbase:1.13
	bob:1.13.1
	r2_1:1.13
	r2_0:1.12
	r1_1_beta:1.12
	r1_1_alpha:1.11
	r1_0:1.11
	r0_11:1.10
	r0_10:1.9
	r0_9:1.6;
locks
	thoth:1.13.1.3; strict;
comment	@// @;


1.17
date	94.12.30.19.17.06;	author fjsoria;	state Exp;
branches;
next	1.16;

1.16
date	94.12.22.21.36.40;	author fjsoria;	state Exp;
branches;
next	1.15;

1.15
date	94.12.22.19.12.06;	author fjsoria;	state Exp;
branches;
next	1.14;

1.14
date	94.12.22.16.24.51;	author fjsoria;	state Exp;
branches;
next	1.13;

1.13
date	94.09.16.14.57.11;	author thoth;	state Exp;
branches
	1.13.1.1;
next	1.12;

1.12
date	94.07.25.17.26.39;	author thoth;	state Exp;
branches;
next	1.11;

1.11
date	94.05.17.12.53.27;	author thoth;	state Exp;
branches;
next	1.10;

1.10
date	94.03.14.15.48.33;	author thoth;	state Exp;
branches;
next	1.9;

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

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

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

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

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

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

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

1.2
date	93.09.24.11.36.35;	author jnw;	state Exp;
branches;
next	1.1;

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

1.13.1.1
date	94.12.28.16.46.34;	author thoth;	state Exp;
branches;
next	1.13.1.2;

1.13.1.2
date	95.01.09.18.15.45;	author thoth;	state Exp;
branches;
next	1.13.1.3;

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


desc
@Unsigned character discrete image implementation.
@


1.17
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 UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.16 1994/12/22 21:36:40 fjsoria Exp fjsoria $";

//
// $Log: UcharDI.c,v $
// Revision 1.16  1994/12/22  21:36:40  fjsoria
// static data member template fix
//
// Revision 1.15  1994/12/22  19:12:06  fjsoria
// added static data member for IA_VectorI
//
// Revision 1.14  1994/12/22  16:24:51  fjsoria
// friend template fixing
//
// Revision 1.13  1994/09/16  14:57:11  thoth
// more DOS-inspired renaming.
//
// Revision 1.12  1994/07/25  17:26:39  thoth
// Name sanitization
//
// Revision 1.11  1994/05/17  12:53:27  thoth
// Image Operations now get their own files.
//
// Revision 1.10  1994/03/14  15:48:33  thoth
// ValueSet has been replaced by container class Set.
//
// Revision 1.9  1994/01/31  15:49:53  thoth
// read_PGM now can return the maxval.
//
// Revision 1.8  1994/01/07  15:10:00  thoth
// Image class is now CoreImage and named image types are
// Image<P,T>.
//
// Revision 1.7  1993/12/29  17:06:11  thoth
// Workaround for woejus CFront bug.
// write_PGM functions will no longer calculate a maxval of 0.
//
// Revision 1.6  1993/11/17  18:27:13  thoth
// IPSIter is now PSIter<IntPoint>.
// restriction functions now go in the individual image implementation modules.
// PNM functions now throw errors.
// extensivep is now extensive.
//
// Revision 1.5  1993/10/20  18:34:27  thoth
// specializations for ostream methods that output the character as
// a number instead of a character.
//
// Revision 1.4  1993/10/05  19:33:08  thoth
// Move to new Closure naming convention.
//
// Revision 1.3  1993/09/27  15:56:38  thoth
// *** empty log message ***
//
// Revision 1.2  1993/09/24  11:36:35  jnw
// Fixed read_PGM to handle comments.
// Added display function
//
// Revision 1.1  93/09/15  12:57:04  thoth
// Initial revision
// 
// Revision 1.7  93/05/31  22:23:22  jnw
// Added instantiator for write_IAA
// 
// Revision 1.6  93/05/31  15:56:34  thoth
// write_PGM now supports maxval.
// 
// Revision 1.5  93/05/27  11:36:31  thoth
// Copyright Notices
// 
// Revision 1.4  93/05/26  17:03:15  thoth
// instantiate IAAIO
// 
// Revision 1.3  93/05/18  21:40:59  thoth
// IDM interface for Uchar DIs.
// support for min and max reduce operations.
// 
// Revision 1.2  93/04/17  18:48:15  thoth
// use IA_Point<int> instead of IntPoint
// 
// Revision 1.1  93/03/18  11:17:02  thoth
// Initial revision
// 

#include	"VectorI.h"
#include	"IntPoint.h"
#include	"PSIter.h"

// if we put this lonely bugger with its friends, the compiler issues
// syntax errors.  USL really needs to hire me.

ostream& IA_VectorI<IA_Point<int>,u_char>::print_this(ostream &o) const
{
    IA_PSIter<IA_Point<int> > iter(this->ps);
    IA_Point<int> p;
    int i;

    o << "VectorI - (point,value) pairs follow:\n";
    i = 0;
    while(iter(p)) {
	o << "(" << p << "," << (int)this->vec[i++] << ") ";
    }
    return o << "\n";
}

#include	"UcharDI.h"
#include	"ConstI.h"
#include	"ClosureI.h"
#include	"FuncI.h"
#include	"ErrorI.h"
#include	"ImageIter.h"

#include	<math.h>
#include	<fstream.h>
#include	<iostream.h>
#include	<unistd.h>
#include	<string.h>

#include	"Bit.h"

// definitions and data for display function

#define IMAGE_DISPLAY_ENV_VAR "IMAGE_DISPLAY"
#define DEFAULT_IMAGE_DISPLAY "xv"

#define SEPARATOR_STRING " "
#define CLEANUP_STRING "; rm -f "

static char display_filename[]= "/tmp/IA_display_XXXXXX";

//
//
//

#include "restrict.h"

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

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


// ws
// whitespace predicate
int ws(char c)
{
    switch (c) {
    case ' ':
    case '\t':
    case '\n': return 1;
    default: return 0;
    }
}

// wsc
// stream convenience function to skip white space and comment lines
// beginning with #
istream& wsc(istream &i)
{
    while (ws(i.peek())){
	if (i.peek() == '\n') {
	    i.get();
	    if (i.peek() == '#') {
		while(i.peek() != '\n') i.get();
	    } else {
		break;
	    }
	} else {
	    i.get();
	}
    }
    return i;
}

IA_Image<IA_Point<int>,u_char>
IA_Image<IA_Point<int>,u_char>::read_PGM(istream &i, int *maxval_ret)
{
    int	width, height,maxval;
    if (i.get()=='P' && i.get()=='5'
	&& i>>wsc>>width>>wsc>>height>>wsc>>maxval) {
	if (maxval_ret)
	    *maxval_ret = maxval;
	const unsigned	size=width*height;
	unsigned char	*data = new unsigned char[size];
	{
	    int	ch = i.get();
	    if (ch!='\n')
		i.putback(ch);
	}
	if (!i.read(data, size)) {
	    ia_throw(IA::PNM_IO_ERROR, __FILE__, __LINE__);
	    return IA_Image<IA_Point<int>,u_char>();
	}
	return     IA_Image<IA_Point<int>,u_char>
	  (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>,u_char>();
    }
}

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

ostream &IA_Image<IA_Point<int>,u_char>::write_PGM(ostream &o, unsigned maxval) const
{
    IA_Set<IA_Point<int> > boxydomain(domain().inf(),domain().sup());
    IA_Point<int>	width(domain().sup()-domain().inf()+1);
    o<<"P5\n"<<width[1] << " " << width[0] << " " << maxval << "\n";
    IA_PSIter<IA_Point<int> >	iter(boxydomain);
    IA_Point<int>	ip;

    while (iter(ip)) {
	if (domain().contains(ip))
	    o.put((char) (*this)(ip));
	else
	    o.put((char)0);
    }
    return o;
}

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

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

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

#if 0
void IA_Image<IA_Point<int>,u_char>::IDM_display(IDP::LinkID lid, const char *label)
{
    if (label==0)
	label="unlabeled";

    IA_Set<IA_Point<int> >	boxy(domain().inf(),domain().sup());
    IA_Point<int>	width = domain().sup()-domain().inf() +1;
    IA_Array<unsigned> dims(width.dim());
    for (unsigned i=0; i<width.dim(); i++)
	dims[i] = width[i];

    IA_Array<u_char>	vals(this->extend(IA_Image<IA_Point<int>,u_char>(boxy,(u_char)0)) .value_array());

    IDP::WriteImage(lid, label, IDP::U_BYTE, 1, dims, vals.data_start());
}
#endif


// display
//
// Forks a process to display a UcharDiscreteImage.
//
// Returns: the uid of the process      if the fork succeeded
//          -1                          if the fork failed
//
// display writes the image to a temp file in pgm format.
//
// User can set environment variable whose name is given by define constant
//        IMAGE_DISPLAY_ENV_VAR to specify what image display application
//        is to be used to display the pgm image.
//
// Default display application name is given by DEFINE constant
//        DEFAULT_IMAGE_DISPLAY
//

pid_t display(IA_Image<IA_Point<int>,u_char> img)
{
    char *display_program;
    pid_t pid;

    // always use a fresh tmp filename
    strcpy(display_filename + strlen(display_filename) - 6, "XXXXXX");

    // Get the image display program filename
    display_program = getenv(IMAGE_DISPLAY_ENV_VAR);
    if (!display_program) {
	display_program = DEFAULT_IMAGE_DISPLAY;
    }

    // Fork and exec the display program
    if ((pid=fork())==0){
	// pid is zero, so this is the child

	// Write the image to a tmp file with a unique pid
	img.write_PGM(mktemp(display_filename));

	char *buffer;
	buffer = new char [strlen(display_program) + strlen(SEPARATOR_STRING)
			   + strlen(display_filename) + strlen(CLEANUP_STRING)
			   + strlen(display_filename)];
	strcat(strcat(strcat(strcat(strcpy(buffer, display_program),
				    SEPARATOR_STRING),
			     display_filename),
		      CLEANUP_STRING),
	       display_filename);
	// should exec a csh -c
	system(buffer);
	exit(0);
    }
    return pid;
}

//
//
//

ostream& IA_VectorI<IA_Point<double>,u_char>::print_this(ostream &o) const
{
    IA_PSIter<IA_Point<double> > iter(this->ps);
    IA_Point<double> p;
    int i;

    o << "VectorI - (point,value) pairs follow:\n";
    i = 0;
    while(iter(p)) {
	o << "(" << p << "," << (int)this->vec[i++] << ") ";
    }
    return o << "\n";
}

//

ostream& IA_ConstI<IA_Point<int>,u_char>::print_this(ostream &o) const
{
    o << "Constant Image - Value : " << (int)this->value ;
    if (this->ps.extensive()){
	IA_PSIter<IA_Point<int> > iter(this->ps);
	IA_Point<int> p;
	o << ", Points follow\n";
	while(iter(p)) {
	    o << p << ", ";
	}
    } else {
	o << ", Comprehensive PointSet";
    }
    return o << "\n";
}

ostream& IA_ConstI<IA_Point<double>,u_char>::print_this(ostream &o) const
{
    o << "Constant Image - Value : " << (int)this->value ;
    if (this->ps.extensive()){
	IA_PSIter<IA_Point<double> > iter(this->ps);
	IA_Point<double> p;
	o << ", Points follow\n";
	while(iter(p)) {
	    o << p << ", ";
	}
    } else {
	o << ", Comprehensive PointSet";
    }
    return o << "\n";
}

//

ostream& IA_FunctionRefI<IA_Point<int>,u_char>::print_this(ostream& o) const
{
    o << "FunctionRefI -";
    if (this->ps.extensive()){
	IA_PSIter<IA_Point<int> > iter(this->ps);
	IA_Point<int> p;
	
	o << "(point,value) pairs follow:\n";
	while(iter(p)) {
	    o << "(" << p << "," << (int)(*this->func)(p) << ") ";
	}
    } else {
	o << " Function : " << (int)(this->func) <<
	    ", PointSet : Comprehensive";
    }
    return o << "\n";
}

ostream& IA_FunctionRefI<IA_Point<double>,u_char>::print_this(ostream& o) const
{
    o << "FunctionRefI -";
    if (this->ps.extensive()){
	IA_PSIter<IA_Point<double> > iter(this->ps);
	IA_Point<double> p;
	
	o << "(point,value) pairs follow:\n";
	while(iter(p)) {
	    o << "(" << p << "," << (int)(*this->func)(p) << ") ";
	}
    } else {
	o << " Function : " << (int)(this->func) <<
	    ", PointSet : Comprehensive";
    }
    return o << "\n";
}


//

static IA_Point<int>	phooey;

#if 0

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

//    IA_Image<IA_Point<int>,u_char>::read_IAA("");
//    IA_Image<IA_Point<int>,u_char>::read_IAA("","");
//
//    i1.write_IAA("");
//    i1.write_IAA("","");

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

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

#endif
@


1.16
log
@static data member template fix
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.15 1994/12/22 19:12:06 fjsoria Exp fjsoria $";
d15 3
d146 1
d151 2
@


1.15
log
@added static data member for IA_VectorI
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.14 1994/12/22 16:24:51 fjsoria Exp fjsoria $";
d15 3
d144 3
@


1.14
log
@friend template fixing
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.13 1994/09/16 14:57:11 thoth Exp fjsoria $";
d15 3
d138 4
@


1.13
log
@more DOS-inspired renaming.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.12 1994/07/25 17:26:39 thoth Exp thoth $";
d15 3
d244 1
a244 1
#if 1
@


1.13.1.1
log
@Image I/O is now ROF.
removed obsolete instantiation cruft.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.13 1994/09/16 14:57:11 thoth Exp thoth $";
a14 3
// Revision 1.13  1994/09/16  14:57:11  thoth
// more DOS-inspired renaming.
//
d171 1
a171 1
read_uchar_PGM(istream &i, int *maxval_ret)
d186 1
a186 1
	    ia_throw(Image_PNMIO_Exception(__FILE__, __LINE__));
d190 1
a190 1
	  (IA_boxy_pset(IA_Point<int>(0,0), IA_Point<int>(height-1,width-1)),
d193 1
a193 1
	ia_throw(Image_PNMIO_Exception(__FILE__, __LINE__));
d199 1
a199 1
read_uchar_PGM(const char *fname, int *maxval)
d202 1
a202 1
    return read_uchar_PGM(in, maxval);
d205 1
a205 2
ostream &write_PGM(const IA_Image<IA_Point<int>,u_char> &img,
		   ostream &o, unsigned maxval)
d207 2
a208 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);
d214 2
a215 2
	if (img.domain().contains(ip))
	    o.put((char) img(ip));
d222 1
a222 1
ostream &write_PGM(const IA_Image<IA_Point<int>,u_char> &img, ostream &o)
d224 2
a225 2
    const unsigned	m = max(img);
    return write_PGM(img, o,m>0?m:1);
d228 1
a228 2
void write_PGM(const IA_Image<IA_Point<int>,u_char> &img,
	       const char *fname, unsigned maxval)
d231 1
a231 1
    write_PGM(img, out, maxval);
d234 1
a234 2
void write_PGM(const IA_Image<IA_Point<int>,u_char> &img,
	       const char *fname)
d237 2
a238 2
    const unsigned	m = max(img);
    write_PGM(img, out, m>0?m:1);
d241 1
a241 1
#if 0
d253 1
a253 1
    IA_Array<u_char>	vals(::extend(*this, IA_Image<IA_Point<int>,u_char>(boxy,(u_char)0)) .value_array());
d296 1
a296 1
	write_PGM(img, mktemp(display_filename));
d408 51
@


1.13.1.2
log
@Make functions match prototype.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.13.1.1 1994/12/28 16:46:34 thoth Exp thoth $";
a14 4
// Revision 1.13.1.1  1994/12/28  16:46:34  thoth
// Image I/O is now ROF.
// removed obsolete instantiation cruft.
//
d208 1
a208 1
ostream &write_PGM(const IA_CoreImage<IA_Point<int>,u_char> &img,
d227 1
a227 1
ostream &write_PGM(const IA_CoreImage<IA_Point<int>,u_char> &img, ostream &o)
d233 1
a233 1
void write_PGM(const IA_CoreImage<IA_Point<int>,u_char> &img,
d240 1
a240 1
void write_PGM(const IA_CoreImage<IA_Point<int>,u_char> &img,
@


1.13.1.3
log
@CoreImage has been re-merged with Image.  All special stuff should be
friends of FBI now.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.13.1.2 1995/01/09 18:15:45 thoth Exp thoth $";
a14 3
// Revision 1.13.1.2  1995/01/09  18:15:45  thoth
// Make functions match prototype.
//
d212 1
a212 1
ostream &write_PGM(const IA_Image<IA_Point<int>,u_char> &img,
d231 1
a231 1
ostream &write_PGM(const IA_Image<IA_Point<int>,u_char> &img, ostream &o)
d237 1
a237 1
void write_PGM(const IA_Image<IA_Point<int>,u_char> &img,
d244 1
a244 1
void write_PGM(const IA_Image<IA_Point<int>,u_char> &img,
@


1.12
log
@Name sanitization
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.11 1994/05/17 12:53:27 thoth Exp $";
d15 3
d105 1
a105 1
#include	"FunctionI.h"
@


1.11
log
@Image Operations now get their own files.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.10 1994/03/14 15:48:33 thoth Exp thoth $";
d15 3
d72 1
a72 1
// use IA_IntPoint instead of IntPoint
d85 1
a85 1
ostream& IA_VectorI<IA_IntPoint,u_char>::print_this(ostream &o) const
d87 2
a88 2
    IA_PSIter<IA_IntPoint> iter(this->ps);
    IA_IntPoint p;
d167 2
a168 2
IA_Image<IA_IntPoint,u_char>
IA_Image<IA_IntPoint,u_char>::read_PGM(istream &i, int *maxval_ret)
d184 1
a184 1
	    return IA_Image<IA_IntPoint,u_char>();
d186 2
a187 2
	return     IA_Image<IA_IntPoint,u_char>
	  (IA_IntPointSet(IA_IntPoint(0,0), IA_IntPoint(height-1,width-1)),
d191 1
a191 1
	return IA_Image<IA_IntPoint,u_char>();
d195 2
a196 2
IA_Image<IA_IntPoint,u_char>
IA_Image<IA_IntPoint,u_char>::read_PGM(const char *fname, int *maxval)
d202 1
a202 1
ostream &IA_Image<IA_IntPoint,u_char>::write_PGM(ostream &o, unsigned maxval) const
d204 2
a205 2
    IA_IntPointSet boxydomain(domain().inf(),domain().sup());
    IA_IntPoint	width(domain().sup()-domain().inf()+1);
d207 2
a208 2
    IA_PSIter<IA_IntPoint>	iter(boxydomain);
    IA_IntPoint	ip;
d219 1
a219 1
ostream &IA_Image<IA_IntPoint,u_char>::write_PGM(ostream &o) const
d225 1
a225 1
void IA_Image<IA_IntPoint,u_char>::write_PGM(const char *fname, unsigned maxval) const
d231 1
a231 1
void IA_Image<IA_IntPoint,u_char>::write_PGM(const char *fname) const
d239 1
a239 1
void IA_Image<IA_IntPoint,u_char>::IDM_display(IDP::LinkID lid, const char *label)
d244 2
a245 2
    IA_IntPointSet	boxy(domain().inf(),domain().sup());
    IA_IntPoint	width = domain().sup()-domain().inf() +1;
d250 1
a250 1
    IA_Array<u_char>	vals(this->extend(IA_Image<IA_IntPoint,u_char>(boxy,(u_char)0)) .value_array());
d274 1
a274 1
pid_t display(IA_Image<IA_IntPoint,u_char> img)
d315 1
a315 1
ostream& IA_VectorI<IA_FloatPoint,u_char>::print_this(ostream &o) const
d317 2
a318 2
    IA_PSIter<IA_FloatPoint> iter(this->ps);
    IA_FloatPoint p;
d331 1
a331 1
ostream& IA_ConstI<IA_IntPoint,u_char>::print_this(ostream &o) const
d335 2
a336 2
	IA_PSIter<IA_IntPoint> iter(this->ps);
	IA_IntPoint p;
d347 1
a347 1
ostream& IA_ConstI<IA_FloatPoint,u_char>::print_this(ostream &o) const
d351 2
a352 2
	IA_PSIter<IA_FloatPoint> iter(this->ps);
	IA_FloatPoint p;
d365 1
a365 1
ostream& IA_FunctionRefI<IA_IntPoint,u_char>::print_this(ostream& o) const
d369 2
a370 2
	IA_PSIter<IA_IntPoint> iter(this->ps);
	IA_IntPoint p;
d383 1
a383 1
ostream& IA_FunctionRefI<IA_FloatPoint,u_char>::print_this(ostream& o) const
d387 2
a388 2
	IA_PSIter<IA_FloatPoint> iter(this->ps);
	IA_FloatPoint p;
d404 1
a404 1
static IA_IntPoint	phooey;
d408 1
a408 1
class blah : public IA_ClosureI<IA_IntPoint,u_char> {
d411 1
a411 1
    :IA_ClosureI<IA_IntPoint,u_char>(IA_IntPointSet()) {}
d413 2
a414 2
    u_char operator()(const IA_IntPoint &) const { return 0; }
    IA_ClosureI<IA_IntPoint,u_char>* clone_self() const { return 0; }
d418 4
a421 4
    IA_IntPoint		ip;
    IA_IntPointSet	ps;
    IA_Image<IA_IntPoint,u_char>	i1;
    IA_Image<IA_IntPoint,u_char>
d427 2
a428 2
	i7(ps, (u_char(*)(const IA_IntPoint&))0),
	i10(IA_CoreImage<IA_IntPoint,u_char>());
d430 1
a430 1
    (IA_CoreImage<IA_IntPoint,u_char>&)i1 = 2;
d437 1
a437 1
    cout << (IA_CoreImage<IA_IntPoint,u_char>&)i1;
d439 2
a440 2
//    IA_Image<IA_IntPoint,u_char>::read_IAA("");
//    IA_Image<IA_IntPoint,u_char>::read_IAA("","");
d445 2
a446 2
    IA_IVIter<IA_IntPoint, u_char>	iter1(i1), iter2;
    IA_IPIter<IA_IntPoint, u_char>	iter3(i2), iter4;
@


1.10
log
@ValueSet has been replaced by container class Set.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.9 1994/01/31 15:49:53 thoth Exp thoth $";
d15 3
a306 17

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

inline int max(int a, int b)
{
    return (a<b)?b:a;
}

inline int min(int a, int b)
{
    return (a<b)?a:b;
}

#include "UcharImageOps.c"
@


1.9
log
@read_PGM now can return the maxval.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.8 1994/01/07 15:10:00 thoth Exp thoth $";
d15 3
d461 1
a461 1
    IA_ValueSet<u_char>	vs(i1.range());
@


1.8
log
@Image class is now CoreImage and named image types are
Image<P,T>.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.7 1993/12/29 17:06:11 thoth Exp $";
d15 4
d103 1
d158 2
a159 1
IA_Image<IA_IntPoint,u_char> IA_Image<IA_IntPoint,u_char>::read_PGM(istream &i)
d164 2
d186 2
a187 1
IA_Image<IA_IntPoint,u_char> IA_Image<IA_IntPoint,u_char>::read_PGM(const char *fname)
d190 1
a190 1
    return read_PGM(in);
@


1.7
log
@Workaround for woejus CFront bug.
write_PGM functions will no longer calculate a maxval of 0.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.6 1993/11/17 18:27:13 thoth Exp thoth $";
d15 4
d153 1
a153 1
IA_UcharDiscreteImage IA_UcharDiscreteImage::read_PGM(istream &i)
d167 1
a167 1
	    return IA_UcharDiscreteImage();
d169 1
a169 1
	return     IA_UcharDiscreteImage
d174 1
a174 1
	return IA_UcharDiscreteImage();
d178 1
a178 1
IA_UcharDiscreteImage IA_UcharDiscreteImage::read_PGM(const char *fname)
d184 1
a184 1
ostream &IA_UcharDiscreteImage::write_PGM(ostream &o, unsigned maxval) const
d201 1
a201 1
ostream &IA_UcharDiscreteImage::write_PGM(ostream &o) const
d207 1
a207 1
void IA_UcharDiscreteImage::write_PGM(const char *fname, unsigned maxval) const
d213 1
a213 1
void IA_UcharDiscreteImage::write_PGM(const char *fname) const
d221 1
a221 1
void IA_UcharDiscreteImage::IDM_display(IDP::LinkID lid, const char *label)
d232 1
a232 1
    IA_Array<u_char>	vals(this->extend(IA_UcharDiscreteImage(boxy,(u_char)0)) .value_array());
d256 1
a256 1
pid_t display(IA_UcharDiscreteImage img)
d419 2
a420 2
    IA_UcharDiscreteImage	i1;
    IA_UcharDiscreteImage
d427 1
a427 1
	i10(IA_Image<IA_IntPoint,u_char>());
d429 1
a429 1
    (IA_Image<IA_IntPoint,u_char>&)i1 = 2;
d436 1
a436 1
    cout << (IA_Image<IA_IntPoint,u_char>&)i1;
d438 2
a439 2
//    IA_UcharDiscreteImage::read_IAA("");
//    IA_UcharDiscreteImage::read_IAA("","");
@


1.6
log
@IPSIter is now PSIter<IntPoint>.
restriction functions now go in the individual image implementation modules.
PNM functions now throw errors.
extensivep is now extensive.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.5 1993/10/20 18:34:27 thoth Exp thoth $";
d15 6
d61 21
a82 1
#include	"VectorI.h"
d85 1
a85 1
#include	"FuncRefI.h"
a87 1
#include	"PSIter.h"
d91 1
d95 1
d199 2
a200 1
    return write_PGM(o,max(*this));
d212 2
a213 1
    write_PGM(out, max(*this));
d216 1
a216 1
#if 0
d282 1
d284 1
a284 1
	abort();
a309 13
ostream& IA_VectorI<IA_IntPoint,u_char>::print_this(ostream &o) const
{
    IA_PSIter<IA_IntPoint> iter(this->ps);
    IA_IntPoint p;
    int i;

    o << "VectorI - (point,value) pairs follow:\n";
    i = 0;
    while(iter(p)) {
	o << "(" << p << "," << (int)this->vec[i++] << ") ";
    }
    return o << "\n";
}
d395 5
@


1.5
log
@specializations for ostream methods that output the character as
a number instead of a character.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.4 1993/10/05 19:33:08 thoth Exp thoth $";
d15 4
d62 1
a62 1
#include	"IPSIter.h"
d83 7
d134 2
a135 1
	if (!i.read(data, size))
d137 1
d142 1
d158 1
a158 1
    IA_IPSIter	iter(boxydomain);
d312 1
a312 1
    if (this->ps.extensivep()){
d328 1
a328 1
    if (this->ps.extensivep()){
d346 1
a346 1
    if (this->ps.extensivep()){
d364 1
a364 1
    if (this->ps.extensivep()){
@


1.4
log
@Move to new Closure naming convention.
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.3 1993/09/27 15:56:38 thoth Exp thoth $";
d15 3
d55 1
d265 99
@


1.3
log
@*** empty log message ***
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.2 1993/09/24 11:36:35 jnw Exp thoth $";
d15 3
d51 1
a51 1
#include	"OtherI.h"
d264 1
a264 1
class blah : public IA_OtherI<IA_IntPoint,u_char> {
d267 1
a267 1
    :IA_OtherI<IA_IntPoint,u_char>(IA_IntPointSet()) {}
d270 1
a270 1
    IA_OtherI<IA_IntPoint,u_char>* clone_self() const { return 0; }
@


1.2
log
@Fixed read_PGM to handle comments.
Added display function
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDI.c,v 1.1 93/09/15 12:57:04 thoth Exp Locker: jnw $";
d14 5
a18 1
// $Log:	UcharDI.c,v $
d55 1
a55 1
#include	<vfork.h>
@


1.1
log
@Initial revision
@
text
@d11 1
a11 1
static char UcharDI_rcsid[] = "$Id: UcharDiscreteImage.c,v 1.7 93/05/31 22:23:22 jnw Exp $";
d14 4
a17 1
// $Log:	UcharDiscreteImage.c,v $
d51 2
d54 10
d68 32
d103 2
a104 1
    if (i.get()=='P' && i.get()=='5' && i>>ws>>width>>height>>maxval) {
d179 54
@
