Package edu.gsu.cs.dmlab.databases
Class ImageDBCreator
- java.lang.Object
-
- edu.gsu.cs.dmlab.databases.ImageDBCreator
-
- All Implemented Interfaces:
IImageDBCreator
public class ImageDBCreator extends Object implements IImageDBCreator
This class is used to insert various values into the database used for storing images, image parameters, sparse descriptors for images, and some additional header data for images.- Author:
- Dustin Kempton, Data Mining Lab, Georgia State University
-
-
Constructor Summary
Constructors Constructor Description ImageDBCreator(DataSource dsourc, int correctParamRowCount, int numParams, org.slf4j.Logger logger)
ImageDBCreator(DataSource dsourc, org.slf4j.Logger logger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkImagesExist(int id, org.joda.time.Interval period)
A function that checks the database to see if the images are in the database for the passed in identifier.boolean
checkParamsExist(int id, org.joda.time.Interval period)
A function that checks the database to see if the parameters are in the database for the passed in identifier.void
finalize()
int
insertFileDescript(Waveband wavelength, org.joda.time.Interval period)
Inserts the descriptor for a particular image.boolean
insertFileDescriptTables(org.joda.time.Interval period)
Creates the tables for holding images and image parameter data for the month represented by the start of the passed in interval.void
insertHeader(ImageDBFitsHeaderData header, int id, org.joda.time.Interval period)
Inserts the fits header information for the image matching the description id.void
insertImage(BufferedImage file, int id, org.joda.time.Interval period)
Inserts the image for a given descriptor.void
insertImageSparseVect(smile.math.matrix.SparseMatrix[] vectors, int id, org.joda.time.Interval period)
Inserts the image descriptor vectors for the image matching the description id.void
insertParams(double[][][] params, int id, org.joda.time.Interval period)
Inserts the image parameters for the image matching the description id.
-
-
-
Constructor Detail
-
ImageDBCreator
public ImageDBCreator(DataSource dsourc, org.slf4j.Logger logger)
-
ImageDBCreator
public ImageDBCreator(DataSource dsourc, int correctParamRowCount, int numParams, org.slf4j.Logger logger)
-
-
Method Detail
-
finalize
public void finalize() throws Throwable
-
insertFileDescriptTables
public boolean insertFileDescriptTables(org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
Creates the tables for holding images and image parameter data for the month represented by the start of the passed in interval.- Specified by:
insertFileDescriptTables
in interfaceIImageDBCreator
- Parameters:
period
- The period that the table corresponds with- Returns:
- True if table was created, else False.
- Throws:
SQLException
- If something went wrong with the connection.
-
insertFileDescript
public int insertFileDescript(Waveband wavelength, org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
Inserts the descriptor for a particular image.- Specified by:
insertFileDescript
in interfaceIImageDBCreator
- Parameters:
wavelength
- The wavelength of the image to be storedperiod
- The period of time that the image corresponds to.- Returns:
- The id for the image description
- Throws:
SQLException
- If the operation fails.
-
insertImage
public void insertImage(BufferedImage file, int id, org.joda.time.Interval period) throws SQLException, IOException
Description copied from interface:IImageDBCreator
Inserts the image for a given descriptor.- Specified by:
insertImage
in interfaceIImageDBCreator
- Parameters:
file
- The file containing the image.id
- The id of the image descriptor.period
- The period that the image corresponds to. This is used to determine which table to insert into, so it only needs to be in the same month.- Throws:
SQLException
- If the operation files.IOException
-
insertParams
public void insertParams(double[][][] params, int id, org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
Inserts the image parameters for the image matching the description id.- Specified by:
insertParams
in interfaceIImageDBCreator
- Parameters:
params
- The matrix containing the calculated image parameters.id
- The id of the image descriptor.period
- The period that the image corresponds to. This is used to determine which table to insert into, so it only needs to be in the same month.- Throws:
SQLException
- If the operation fails.
-
insertImageSparseVect
public void insertImageSparseVect(smile.math.matrix.SparseMatrix[] vectors, int id, org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
Inserts the image descriptor vectors for the image matching the description id.- Specified by:
insertImageSparseVect
in interfaceIImageDBCreator
- Parameters:
vectors
- Vectors used to describe the image.id
- The id of the image that the vectors describe.period
- The period that the image corresponds to. This is used to determine which table to insert into, so it only needs to be in the same month.- Throws:
SQLException
- If the operation fails.
-
insertHeader
public void insertHeader(ImageDBFitsHeaderData header, int id, org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
Inserts the fits header information for the image matching the description id.- Specified by:
insertHeader
in interfaceIImageDBCreator
- Parameters:
header
- The fits header data to insert.id
- The id of the image descriptor.period
- The period that the image corresponds to. This is used to determine which table to insert into, so it only needs to be in the same month.- Throws:
SQLException
- If the operation fails.
-
checkParamsExist
public boolean checkParamsExist(int id, org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
A function that checks the database to see if the parameters are in the database for the passed in identifier.- Specified by:
checkParamsExist
in interfaceIImageDBCreator
- Parameters:
id
- Identifier that shall be checked against.period
- The month that the image corresponds to.- Returns:
- True if there, false otherwise.
- Throws:
SQLException
- If the operation fails.
-
checkImagesExist
public boolean checkImagesExist(int id, org.joda.time.Interval period) throws SQLException
Description copied from interface:IImageDBCreator
A function that checks the database to see if the images are in the database for the passed in identifier.- Specified by:
checkImagesExist
in interfaceIImageDBCreator
- Parameters:
id
- Identifier that shall be checked against.period
- The month that the image corresponds to.- Returns:
- True if there, false otherwise.
- Throws:
SQLException
- If the operation fails.
-
-