Class FitsBreaker


  • public class FitsBreaker
    extends Object
    This class is designed to provide an easier access to the content of the FITS files. After constructing an instance of this class, the read function must be call for the file to be actually read. In this function, the given FITS image will be copied (cast and normalized if requested) to the field image. In addition, some important values of the FITS header, and the minimum and maximum valid values will be extracted and stored in appropriate fields of the class.

    Depending on the boolean argument of the constructor, isCompressed this class treats the given FITS file as either compressed or uncompressed. In the compressed format, the values of the image are originally stored as 2-Byte Integers, while in the uncompressed formats, the values are of type double. The process of compression is a non-lossy method (such as Rice) which multiplies the double values by a large number so that it can keep the values as integers without losing precision.
    The other boolean argument of the constructor, isOutsideDisk, is to provide the user with the option of ignoring the pixel values outside the Sun's disk. This are should be black, but due to the device noise, other values could be recorded. It is recommended to ignore those values. To calculate the acceptable region of the disk, the center of the disk (CRPIX1, CRPIX2) and the radius of the Sun in pixel (R_SUN) are used. These values will be extracted from each FITS file's header individually.
    Note: To check if a FITS file is compressed or not, the card "TTYPE1" should be read from the header. For example, TTYPE1 = 'COMPRESSED_DATA'. Another way to make sure if a file is compressed or not is that only in an uncompressed file, the cards NAXIS1 and NAXIS2 correspond to the width and height of the image.

    Some references:
    Author:
    Azim Ahmadzadeh, Data Mining Lab, Georgia State University
    • Constructor Detail

      • FitsBreaker

        public FitsBreaker​(boolean isCompressed,
                           boolean ignoreOutsideDisk)
        This constructor reads the fits file, gets some necessary information from its header, detects whether or not this file is compressed or not, and extract a 2D double array representing the (aia or hmi) image. If normalization of the values in the image array is needed, the output array will be min-max normalized based on the new min and new max passed to the method:
        processImage(double[][] im, double norm, double newMin, double newMax).
        Parameters:
        isCompressed - if true, the constructor reads the fits file assuming that it is compressed. (AIA images are compressed, while HMI files are not.)
        ignoreOutsideDisk - if true, all intensity values of pixels which lie outside the Sun's disk will be replaced with -1.
    • Method Detail

      • read

        public void read​(String fitsDir)
        Parameters:
        fitsDir -
      • getImage

        public double[][] getImage()
      • getMinValidValue

        public double getMinValidValue()
      • getMaxValidValue

        public double getMaxValidValue()
      • getNormalizedMin

        public double getNormalizedMin()
      • getNormalizedMax

        public double getNormalizedMax()
      • isOutsideDiskIgnored

        public boolean isOutsideDiskIgnored()