Class NonCacheImageDBConnection

  • All Implemented Interfaces:
    ISTImageDBConnection
    Direct Known Subclasses:
    ImageDBConnection

    public class NonCacheImageDBConnection
    extends Object
    implements ISTImageDBConnection
    This class is used to access images, image parameters, sparse descriptors for images, and some additional header data for images from the database created by the ImageDBCreator.
    Author:
    Dustin Kempton, Data Mining Lab, Georgia State University
    • Constructor Summary

      Constructors 
      Constructor Description
      NonCacheImageDBConnection​(DataSource dsourc, IImgParamNormalizer normalizer, int paramDim, int paramDownSample, org.slf4j.Logger logger)
      Constructor that defines the parameter dimension and down sampling used to match the input coordinates with the reduced dimensionality parameter space.
      NonCacheImageDBConnection​(DataSource dsourc, IImgParamNormalizer normalizer, org.slf4j.Logger logger)
      Constructor that assumes default values for parameter down sample and the number of parameters for each image cell.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void finalize()  
      BufferedImage getFirstFullImage​(org.joda.time.Interval period, Waveband wavelength)
      Gets the first full resolution image in the database that happens after the start time of the input interval, at a given wavelength.
      BufferedImage getFirstImage​(org.joda.time.Interval period, Waveband wavelength)
      Gets the first thumbnail image in the database that happens after the start time of the input interval, at a given wavelength.
      smile.math.matrix.SparseMatrix getFirstImageSparseVectForId​(org.joda.time.Interval period, int id)
      Gets only the top level sparse image descriptor for the image with the given id, in the given month.
      BufferedImage getFullImgForId​(org.joda.time.Interval period, int id)
      Gets the full resolution image in the month that the period begins that has the passed in id value.
      ImageDBFitsHeaderData getHeaderForId​(org.joda.time.Interval period, int id)
      Gets the header information for the image in the month that the period begins that has the passed in id value.
      ImageDBDateIdPair[] getImageIdsForInterval​(org.joda.time.Interval period, Waveband wavelength)
      Gets the image ids from the month that the input period begins through either the end of the period or the end of the month, which ever comes first.
      smile.math.matrix.DenseMatrix[] getImageParamForEv​(ISpatialTemporalObj event, ImageDBWaveParamPair[] params, boolean leftSide)
      Gets the image parameters for the given image parameter wavelength pair array that intersect the MBR of the IEvent passed in.
      smile.math.matrix.DenseMatrix[] getImageParamForId​(org.joda.time.Interval period, int id)
      Gets the full disk set of image parameters for all image parameters of the image with the given id in the month that the given input period starts.
      double[][][] getImageParamForWave​(ISpatialTemporalObj event, Waveband wavelength, boolean leftSide)
      Gets the image parameters for the given wavelength that intersect the MBR of the IEvent that is passed in.
      smile.math.matrix.SparseMatrix[] getImageSparseVectForId​(org.joda.time.Interval period, int id)
      Gets all of the sparse image descriptor vectors for the image with the given id, in the given month.
      BufferedImage getImgForId​(org.joda.time.Interval period, int id)
      Gets the thumbnail image in the month that the period begins that has the passed in id value.
    • Constructor Detail

      • NonCacheImageDBConnection

        public NonCacheImageDBConnection​(DataSource dsourc,
                                         IImgParamNormalizer normalizer,
                                         org.slf4j.Logger logger)
        Constructor that assumes default values for parameter down sample and the number of parameters for each image cell. Those values are a division by 64 for all coordinates of input events, and 10 image parameters per cell location.
        Parameters:
        dsourc - The data source connection that is used to connect to the database.
        normalizer - The image parameter normalizer, can be null, and if it is, then no normalization is performed on the parameters before return. Else, parameters are normalized prior to return using this object.
        logger - Logger used to report errors that occurred while processing data requests.
      • NonCacheImageDBConnection

        public NonCacheImageDBConnection​(DataSource dsourc,
                                         IImgParamNormalizer normalizer,
                                         int paramDim,
                                         int paramDownSample,
                                         org.slf4j.Logger logger)
        Constructor that defines the parameter dimension and down sampling used to match the input coordinates with the reduced dimensionality parameter space.
        Parameters:
        dsourc - The data source connection that is used to connect to the database.
        normalizer - The image parameter normalizer, can be null, and if it is, then no normalization is performed on the parameters before return. Else, parameters are normalized prior to return using this object.
        paramDim - The depth of image parameters (I.E. the number calculated) at each cell location.
        paramDownSample - The divisor used to match the input coordinates with the reduced dimensionality parameter space.
        logger - Logger used to report errors that occurred while processing data requests.
    • Method Detail

      • getImageParamForWave

        public double[][][] getImageParamForWave​(ISpatialTemporalObj event,
                                                 Waveband wavelength,
                                                 boolean leftSide)
                                          throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets the image parameters for the given wavelength that intersect the MBR of the IEvent that is passed in. The parameters are in the form [x][y][paramId]
        Specified by:
        getImageParamForWave in interface ISTImageDBConnection
        Parameters:
        event - The event that we want the image parameters for.
        wavelength - The wavelength of image that we want the parameters of.
        leftSide - If left side, we use the end time of the IEvent, if not we use the begin time.
        Returns:
        The image parameters that intersect the MBR.
        Throws:
        SQLException
      • getFirstImage

        public BufferedImage getFirstImage​(org.joda.time.Interval period,
                                           Waveband wavelength)
                                    throws SQLException,
                                           IOException
        Description copied from interface: ISTImageDBConnection
        Gets the first thumbnail image in the database that happens after the start time of the input interval, at a given wavelength.
        Specified by:
        getFirstImage in interface ISTImageDBConnection
        Parameters:
        period - The period to start the search from.
        wavelength - The wavelength of Image we wish to get.
        Returns:
        The first image starting after the period begin time.
        Throws:
        SQLException - If something went wrong with the server.
        IOException - If something went wrong with the decoding of the image.
      • getFirstFullImage

        public BufferedImage getFirstFullImage​(org.joda.time.Interval period,
                                               Waveband wavelength)
                                        throws SQLException,
                                               IOException
        Description copied from interface: ISTImageDBConnection
        Gets the first full resolution image in the database that happens after the start time of the input interval, at a given wavelength.
        Specified by:
        getFirstFullImage in interface ISTImageDBConnection
        Parameters:
        period - The period to start the search from.
        wavelength - The wavelength of Image we wish to get.
        Returns:
        The first image starting after the period begin time.
        Throws:
        SQLException - If something went wrong with the server.
        IOException - If something went wrong with the decoding of the image.
      • getImageParamForEv

        public smile.math.matrix.DenseMatrix[] getImageParamForEv​(ISpatialTemporalObj event,
                                                                  ImageDBWaveParamPair[] params,
                                                                  boolean leftSide)
                                                           throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets the image parameters for the given image parameter wavelength pair array that intersect the MBR of the IEvent passed in. The parameters are in the from that each matrix represents a particular image parameter at a given wavelength that corresponds to the position they were in on the params array.
        Specified by:
        getImageParamForEv in interface ISTImageDBConnection
        Parameters:
        event - The event that we want the image parameters for.
        params - The array of specific parameter/wavelength pairs that we wish to get.
        leftSide - If left side, we use the end time of the IEvent, if not we use the begin time.
        Returns:
        The image parameters that intersect the MBR.
        Throws:
        SQLException
      • getImageIdsForInterval

        public ImageDBDateIdPair[] getImageIdsForInterval​(org.joda.time.Interval period,
                                                          Waveband wavelength)
                                                   throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets the image ids from the month that the input period begins through either the end of the period or the end of the month, which ever comes first. The ids will be for the input wavelength of images only.
        Specified by:
        getImageIdsForInterval in interface ISTImageDBConnection
        Parameters:
        period - The period over which we wish to get Ids for.
        wavelength - The wavelength of images we wish to get Ids for.
        Returns:
        The Date and Id pairs of all the images in the range and of the input wavelength.
        Throws:
        SQLException
      • getImageParamForId

        public smile.math.matrix.DenseMatrix[] getImageParamForId​(org.joda.time.Interval period,
                                                                  int id)
                                                           throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets the full disk set of image parameters for all image parameters of the image with the given id in the month that the given input period starts.
        Specified by:
        getImageParamForId in interface ISTImageDBConnection
        Parameters:
        period - The month in which we wish to get the parameters for.
        id - The id of the image in the given month.
        Returns:
        The set of full disk parameters for the image with the given id.
        Throws:
        SQLException
      • getImageSparseVectForId

        public smile.math.matrix.SparseMatrix[] getImageSparseVectForId​(org.joda.time.Interval period,
                                                                        int id)
                                                                 throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets all of the sparse image descriptor vectors for the image with the given id, in the given month.
        Specified by:
        getImageSparseVectForId in interface ISTImageDBConnection
        Parameters:
        period - The month we wish to query from
        id - The id of the image we wish to query.
        Returns:
        The set of all sparse image descriptors for the given image.
        Throws:
        SQLException - When something with the server failed.
      • getFirstImageSparseVectForId

        public smile.math.matrix.SparseMatrix getFirstImageSparseVectForId​(org.joda.time.Interval period,
                                                                           int id)
                                                                    throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets only the top level sparse image descriptor for the image with the given id, in the given month.
        Specified by:
        getFirstImageSparseVectForId in interface ISTImageDBConnection
        Parameters:
        period - The month we wish to query.
        id - The id of the image we wish to query.
        Returns:
        The top level descriptor for the given image.
        Throws:
        SQLException - When something with the server failed.
      • getImgForId

        public BufferedImage getImgForId​(org.joda.time.Interval period,
                                         int id)
                                  throws SQLException,
                                         IOException
        Description copied from interface: ISTImageDBConnection
        Gets the thumbnail image in the month that the period begins that has the passed in id value.
        Specified by:
        getImgForId in interface ISTImageDBConnection
        Parameters:
        period - The month in which to get the image.
        id - The id associated with the image we wish to get.
        Returns:
        The buffered image with the given id from the given month.
        Throws:
        SQLException - If something went wrong with the server.
        IOException - If something went wrong with decoding of the image
      • getFullImgForId

        public BufferedImage getFullImgForId​(org.joda.time.Interval period,
                                             int id)
                                      throws SQLException,
                                             IOException
        Description copied from interface: ISTImageDBConnection
        Gets the full resolution image in the month that the period begins that has the passed in id value.
        Specified by:
        getFullImgForId in interface ISTImageDBConnection
        Parameters:
        period - The month in which to get the image.
        id - The id associated with the image we wish to get.
        Returns:
        The buffered image with the given id from the given month.
        Throws:
        SQLException - If something went wrong with the server.
        IOException - If something went wrong with decoding of the image
      • getHeaderForId

        public ImageDBFitsHeaderData getHeaderForId​(org.joda.time.Interval period,
                                                    int id)
                                             throws SQLException
        Description copied from interface: ISTImageDBConnection
        Gets the header information for the image in the month that the period begins that has the passed in id value.
        Specified by:
        getHeaderForId in interface ISTImageDBConnection
        Parameters:
        period - The month in which to get the image header.
        id - The id associated with the image header we wish to get.
        Returns:
        The header for the image in the month requested.
        Throws:
        SQLException - When something with the serve failed.