imgwrfptiff

Capsim Block Documentation

Short Description

Writes an input image to a TIFF file as floating point. Also store the current colormap.

Top
Input Connections
Port Type Name
0 image_t x
Top
Parameters
Num Description Type Name Default Value
0 Name of output file file fileName output.tif
Top
States
Num Type Name Initial Value Description
0 int fp
1 int ibufs
2 int obufs
3 int pwidth
4 int pheight
5 image_t img
6 float** mat_PP
Top

Declarations


 

	int i,j,k,ii;
	unsigned short pixel;
	float	fpixel;



Top

Initialization Code



 

	if((ibufs = NO_INPUT_BUFFERS()) != 1) {
		fprintf(stdout,"imgwrfptiff: no input buffer\n");
		return(1);
	}
	if((obufs = NO_OUTPUT_BUFFERS()) > ibufs) {
		fprintf(stdout,"imgwrfptiff: more output than input buffers\n");
		return(2);
	}
	for(j=0; j
    
Top

Main Code



 

        /* This mode synchronizes all input buffers */
for(ii = MIN_AVAIL(); ii>0; ii--) {
        IT_IN(0);
	img=x(0);
	pheight=img.height;
	pwidth=img.width;
	mat_PP=img.image_PP;
	fprintf(stderr,"imgwrfptiff to produce %d x  %d image file\n",pwidth,pheight);
	if(IIP_WriteFloatTIFF(mat_PP,pwidth,pheight,fileName)) {
                fprintf(stderr,"imgwrfptiff: can't write TIFF image\n");
                return(4);
        }

	if(obufs==1) {
                if(IT_OUT(0)) {
			KrnOverflow("imgwrfptiff",0);
			return(99);
		}
                OUTIMAGE(0,0) = img;
        }
}
	
return(0);





Top

Wrapup Code



 





Top

License



/*  Capsim (r) Text Mode Kernel (TMK) Star Library (Blocks)
    Copyright (C) 1989-2002  XCAD Corporation 

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    http://capsimtmk.sourceforge.net
    XCAD Corporation
    Raleigh, North Carolina */
*/


Top

Description



 

/**********************************************************************
			imgwrfptiff()
***********************************************************************
Writes an input image to a TIFF file as floating point. Also store the current
colormap.
If multiple images are received, they overwrite the previous on.
This star can later be modified so that multiple images are stored in a singe
TIFF file (with multiple directories). Or stored in multiple TIFF files
with the file name changing in some manner.
Auto fan out is supported.
Programmer:  Sasan Ardalan 
Date:	October 14, 1993
*/