home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
vis-ftp.cs.umass.edu
/
vis-ftp.cs.umass.edu.tar
/
vis-ftp.cs.umass.edu
/
pub
/
Software
/
ASCENDER
/
ascendMar8.tar
/
UMass
/
BoldtNew
/
LLVS
/
extractpl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-01-31
|
3KB
|
93 lines
/*
* ------------------------------------------------------------------
* extractpl.c - Function to extract a sub-image
* Created by Robert Heller on Wed Feb 5 08:30:11 1992
* ------------------------------------------------------------------
* Modification History:
* ------------------------------------------------------------------
* Contents:
* ------------------------------------------------------------------
*
* Copyright (c) 1992 by University of Massachuetts
* All Rights Reserved
*
*/
#include <stdio.h>
#include <llvs_per_plane.h>
void extract_plane(inplane,inplane_info,outplane,outplane_info,limits)
PLANE *inplane, *outplane;
PLANE_INFO *inplane_info, *outplane_info;
LIMITS *limits;
{
int runlevel, indeltalev, outdeltalev;
int current_row, current_column, in_row, in_col, out_row, out_col;
int ipixel, iback;
float fpixel, fback;
/* compute delta level */
runlevel = limits->level;
indeltalev = runlevel - inplane_info->level;
outdeltalev = runlevel - outplane_info->level;
/* grab background value */
if (inplane_info->datatype == FLOAT) {
fback = inplane_info->background.flonum;
/* row loop */
for (current_row = limits->startrow;
current_row <= limits->endrow;
current_row += limits->deltarow) {
/* translate row offset */
TRANSLEVEL(in_row, current_row, indeltalev,
inplane_info->row_location);
TRANSLEVEL(out_row, current_row, outdeltalev,
outplane_info->row_location);
/* column loop */
for (current_column = limits->startcol;
current_column <= limits->endcol;
current_column += limits->deltacol) {
/* translate column offsets */
TRANSLEVEL(in_col, current_column, indeltalev,
inplane_info->column_location);
TRANSLEVEL(out_col, current_column, outdeltalev,
outplane_info->column_location);
/* fetch pixel */
GET_PIXEL(fpixel, fback, inplane, in_row,
in_col,(*inplane_info));
SET_PIXEL(fpixel, outplane, out_row, out_col,
(*outplane_info));
}
}
} else {
iback = inplane_info->background.fixnum;
/* row loop */
for (current_row = limits->startrow;
current_row <= limits->endrow;
current_row += limits->deltarow) {
/* translate row offset */
TRANSLEVEL(in_row, current_row, indeltalev,
inplane_info->row_location);
TRANSLEVEL(out_row, current_row, outdeltalev,
outplane_info->row_location);
/* column loop */
for (current_column = limits->startcol;
current_column <= limits->endcol;
current_column += limits->deltacol) {
/* translate column offsets */
TRANSLEVEL(in_col, current_column, indeltalev,
inplane_info->column_location);
TRANSLEVEL(out_col, current_column, outdeltalev,
outplane_info->column_location);
/* fetch pixel */
GET_PIXEL(ipixel, iback, inplane, in_row,
in_col,(*inplane_info));
SET_PIXEL(ipixel, outplane, out_row, out_col,
(*outplane_info));
}
}
}
}