# Package com.pixelmed.database

package com.pixelmed.database

Abstracts any underlying database support for applications using the DICOM toolkit and needing access to persistent storage of entities in the DICOM information model.

The primary class of this package is the abstract `DatabaseInformationModel`. It provides general facilities for connecting to the underlying database, creating tables, inserting, modifying, deleting and selecting records. In addition it provdes abstract methods for describing the types of entities mapped to records in tables and their relationships.

Concrete implementations of the `DatabaseInformationModel` are provided for commonly used models, including the `PatientStudySeriesConcatenationInstanceModel` and the `StudySeriesInstanceModel`.

The models make use of specialized forms of the generic `com.pixelmed.dicom.DicomDictionary` in order to make sure particular DICOM attributes are mapped to the correct information entity (i.e. database table) appropriate to the model in use.

Tree and table browsers and models are provided that may be used to form the basis of application specific browsers.

The following is a simple example of how a database is created, populated by one or more DICOM files, and a browser created:

    public static void main(String arg[]) {
            try {
                    final DatabaseInformationModel d = new PatientStudySeriesConcatenationInstanceModel("test");
                    for (int j=0; j<arg.length; ++j) {
                            String fileName = arg[j];
                            DicomInputStream dfi = new DicomInputStream(new BufferedInputStream(new FileInputStream(fileName)));
                            AttributeList list = new AttributeList();
                            list.read(dfi);
                            dfi.close();
                            d.insertObject(list,fileName);
                    }
                    final JFrame frame = new JFrame();
                    frame.setSize(400,800);
                    frame.addWindowListener(new WindowAdapter() {
                            public void windowClosing(WindowEvent e) {
                                    frame.dispose();
                                    d.close();
                                    System.exit(0);
                            }
                    });
                    DatabaseTreeBrowser tree = new DatabaseTreeBrowser(d,frame);
                    frame.show();
            } catch (Exception e) {
                    System.out.println(e);
                    e.printStackTrace();
                    System.exit(0);
            }
    }

## Package Specification

## Related Documentation

For overviews, tutorials, examples, guides, and tool documentation, please see:

Classes
Class
Description
DatabaseApplicationProperties
This class provides common support to applications requiring properties related to database services.
DatabaseInformationModel
The `DatabaseInformationModel` class is an abstract class that contains the core functionality for storing, accessing and maintaining a persistent representation of selected attributes of composite objects.
DatabaseMediaImporter
DatabaseTreeBrowser
The `DatabaseTreeBrowser` class implements a Swing graphical user interface to browse the contents of `DatabaseInformationModel`.
DatabaseTreeModel
The `DatabaseTreeModel` class implements a `TreeModel` to abstract the contents of a database as a tree in order to provide support for a `DatabaseTreeBrowser`.
DatabaseTreeRecord
Instances of the `DatabaseTreeRecord` class represent nodes in a tree of the `DatabaseTreeModel` class, which in turn is used by the `DatabaseTreeBrowser` class.
DateTimeRangeMatch
DeleteFromDatabase
This class provides methods for removing entries from a database, all its children and any associated files that were copied into the database (rather than referenced).
DicomDatabaseInformationModel
The `DicomDatabaseInformationModel` class is an abstract class that specializes `DatabaseInformationModel` by adding methods specific to a typical DICOM composite object information model.
DicomDictionaryForMinimalPatientStudySeriesInstanceModel
The `DicomDictionaryForMinimalPatientStudySeriesInstanceModel` class supports a simple DICOM Patient/Study/Series/Concatenation/Instance model.
DicomDictionaryForPatientStudySeriesConcatenationInstanceModel
The `DicomDictionaryForPatientStudySeriesConcatenationInstanceModel` class supports a simple DICOM Patient/Study/Series/Concatenation/Instance model.
DicomDictionaryForStudySeriesInstanceModel
The `DicomDictionaryForStudySeriesInstanceModel` class supports a minimal DICOM Study/Series/Instance model.
MapTableBrowser
The `MapTableBrowser` class extends a `JTable` to browse a list of attributes and their values as a single row table with columns headed by the attribute descriptions (if supplied) or their names.
MapTableModel
The `MapTableModel` class extends a `AbstractTableModel` to abstract the contents of a database as a tree in order to provide support for a `MapTableBrowser`.
MinimalPatientStudySeriesInstanceModel
The `MinimalPatientStudySeriesInstanceModel` class supports a minimal DICOM Patient/Study/Series/Instance model.
PatientStudySeriesConcatenationInstanceModel
The `PatientStudySeriesConcatenationInstanceModel` class supports a simple DICOM Patient/Study/Series/Concatenation/Instance model.
RebuildDatabaseFromInstanceFiles
This class allows the reconstruction of a database from the stored instance files, such as when the database schema model has been changed.
StudySeriesInstanceModel
The `StudySeriesInstanceModel` class supports a minimal DICOM Study/Series/Instance model.
StudySeriesInstanceSelectiveMatchModel
The `StudySeriesInstanceSelectiveMatchModel` class supports a minimal DICOM Study/Series/Instance model.