iopen arguments

DanKarron at UCBVAX.BERKELEY.EDU DanKarron at UCBVAX.BERKELEY.EDU
Fri Mar 29 14:05:16 AEST 1991


I am using ipaste format to store medical images, and I am getting
core dumps when I use pixels with a color map index > 255. In medical pix
processing, the images are 12 bits, and I have to rescale (histogram equ and
divide) them to get them to fit in your image format.

Now what is the meaning of the arguments to iopen, and why are short pixels
with 16 bits of storage bombing out with more than 8 bits of value ?

I am guessing now, but the BPP(value) is Bytes Per Pixel ?

Here is the code from GyroPaste.c, which converts Phillips Gyroscan Magnetic
Resonance Images to sgi ipaste format. As it stands now, I have to scale
pixels to get ipaste and movie to work properly, but I don't scale pixels
to use my own 3d reconstruction program. I would really like ipaste to work
properly so that I can use it as a standard to put all of my work with
12 bit medical pictures.

Here is the code:

	if(getenv("COMPRESS_8_BITS"))
		for ( i = 0; i < npixels ; i++ )
			sp_pbuf[i] /= 16;
/* a hack to use sgi image tools */

	pixture=iopen(SgiImgFileTitle,"w",VERBATIM(2),3,xres,yres,Zsize);

/* what are the arguments to VERBATIM(value) ? */
/* what is the dim argument, no. 4  and what is the meaning of zsize ? */

	for(i=0,j=yres-1; j>=0; j--)
		{
			putrow(pixture,sp_pbuf+xres*j,i,0);
		if(rgb)
			{
			putrow(pixture,sp_pbuf+xres*j,i,1);
			putrow(pixture,sp_pbuf+xres*j,i,2);
			}
		i++;
		}
	iclose(pixture);

-------------------------------------------------------------------------------
Here is an example of converted files that crash ipaste and movie
xsize ysize zsize   min   max  bpp  type  storage name
  256   256     1     0   771   2  NORMAL  verb   01.sgi
  256   256     1     0  2570   2  NORMAL  verb   02.sgi
  256   256     1     0  2570   2  NORMAL  verb   03.sgi
  256   256     1     0  3084   2  NORMAL  verb   04.sgi
  256   256     1     0  3084   2  NORMAL  verb   05.sgi
  256   256     1     0  2570   2  NORMAL  verb   06.sgi
  256   256     1     0  2827   2  NORMAL  verb   07.sgi
  256   256     1     0  2827   2  NORMAL  verb   08.sgi
  256   256     1     0  3341   2  NORMAL  verb   09.sgi
  256   256     1     0  3855   2  NORMAL  verb   10.sgi
  256   256     1     0  3341   2  NORMAL  verb   11.sgi
  256   256     1     0  3084   2  NORMAL  verb   12.sgi
  256   256     1     0  3084   2  NORMAL  verb   13.sgi
  256   256     1     0  2056   2  NORMAL  verb   14.sgi
  256   256     1     0  1285   2  NORMAL  verb   15.sgi
karron:~/D.mri/D.LIN_POINTERS_TEST_1.90.09.26/0101:61movie *.sgi

crash !

Now if it set the COMPRESS_8_BITS environ flag, everything is cool, but
I have to throw away lots of info. I would rather set the BPP to 1 and make
smaller files if that is what I wanted to do. 

I can make my own tools, but I would rather be able to build on sgi
tools for this type of applications.

Cheers!

Dan.
| karron at nyu.edu (e-mail alias )         Dan Karron, Research Associate      |
| Phone: 212 263 5210 Fax: 212 263 7190  New York University Medical Center  |
| 560 First Avenue                       Digital Pager <1> (212) 397 9330    |
| New York, New York 10016               <2> 10896   <3> <your-number-here>  |



More information about the Comp.sys.sgi mailing list