# include "fits.h"

int fits_matrix_size (Header *header) {
  
  int i, Nrec, size;

  if (header[0].Naxes == 0) return (0);

  size = abs(header[0].bitpix / 8);

  for (i = 0; i < header[0].Naxes; i++)
    size *= header[0].Naxis[i];

  /* round up to next complete block */
  if (size % FT_RECORD_SIZE) {
    Nrec = 1 + (int) (size / FT_RECORD_SIZE);
    size = FT_RECORD_SIZE * Nrec;
  }

  return (size);
}
