next up previous
Next: The FDL Up: Sample Functions Previous: aiss_sys_init

image_init

int image_init (a_Image *data)
{
  if(aiss_sys.sub==FALSE)      // these conditions set the size of the image
    {
      data->rows=aiss_sys.cds_rows;
      data->columns=aiss_sys.cds_columns;
      data->flags[10]='F';
    }
  else if(aiss_sys.sub==TRUE)
    {
      data->rows=aiss_sys.p_rows;
      data->columns=aiss_sys.p_columns;
      data->flags[10]='T';
    }
  else
    {
      printf("It would appear that the system configuration has not been read error 1.\n");
      return 1;
    }                         //display if init !called first

  data->bitpix=aiss_sys.bitpix;                  //copy over number of bits per pixel  
  data->pix_format=aiss_sys.d_type_default;      //copy image data type default


  /*********************************************************************
   This switch system allocates the proper size for payload based on the data type.
  ***********************************************************************/
  
  switch(data->pix_format)
    {
    case INT16: 
      {
	data->payload=calloc(data->rows*data->columns,sizeof(short));
	break;
      }
    case INT32:
      {
	data->payload=calloc(data->rows*data->columns,sizeof(long));
	break;
      }
    case INT8:
      {
	data->payload=calloc(data->rows*data->columns,sizeof(char));
	break;
      }
    case FP32:
      {
	data->payload=calloc(data->rows*data->columns,sizeof(float));
	break;
      }
    case FP64:
      {
	data->payload=calloc(data->rows*data->columns,sizeof(double));
	break;
      }
    default: 
      {
	printf("Image data type flag invalid.");
	return 1;
      }
    }
			     
return 0; 
}


Aaron Smith 2004-03-04