DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
This class maintains database handles based on the classical "index.dat" file. More...
Public Member Functions | |
DcmQueryRetrieveIndexDatabaseHandle (const char *storageArea, long maxStudiesPerStorageArea, long maxBytesPerStudy, OFCondition &result) | |
Constructor. | |
~DcmQueryRetrieveIndexDatabaseHandle () | |
Destructor. | |
void | setIdentifierChecking (OFBool checkFind, OFBool checkMove) |
Configure the DB module to perform (or not perform) checking of FIND and MOVE request identifiers. | |
OFCondition | makeNewStoreFileName (const char *SOPClassUID, const char *SOPInstanceUID, char *newImageFileName) |
create a filename under which a DICOM object that is currently being received through a C-STORE operation can be stored. | |
OFCondition | storeRequest (const char *SOPClassUID, const char *SOPInstanceUID, const char *imageFileName, DcmQueryRetrieveDatabaseStatus *status, OFBool isNew=OFTrue) |
register the given DICOM object, which has been received through a C-STORE operation and stored in a file, in the database. | |
OFCondition | startFindRequest (const char *SOPClassUID, DcmDataset *findRequestIdentifiers, DcmQueryRetrieveDatabaseStatus *status) |
initiate FIND operation using the given SOP class UID (which identifies the query model) and DICOM dataset containing find request identifiers. | |
OFCondition | nextFindResponse (DcmDataset **findResponseIdentifiers, DcmQueryRetrieveDatabaseStatus *status) |
return the next available FIND response as a new DICOM dataset. | |
OFCondition | cancelFindRequest (DcmQueryRetrieveDatabaseStatus *status) |
cancel the ongoing FIND request, stop and reset every running operation associated with this request, delete existing temporary files. | |
OFCondition | startMoveRequest (const char *SOPClassUID, DcmDataset *moveRequestIdentifiers, DcmQueryRetrieveDatabaseStatus *status) |
initiate MOVE operation using the given SOP class UID (which identifies the retrieve model) and DICOM dataset containing move request identifiers. | |
OFCondition | nextMoveResponse (char *SOPClassUID, char *SOPInstanceUID, char *imageFileName, unsigned short *numberOfRemainingSubOperations, DcmQueryRetrieveDatabaseStatus *status) |
Constructs the information required for the next available C-MOVE sub-operation (the image SOP class UID, SOP Instance UID and an imageFileName containing the requested data). | |
OFCondition | cancelMoveRequest (DcmQueryRetrieveDatabaseStatus *status) |
cancel the ongoing MOVE request, stop and reset every running operation associated with this request, delete existing temporary files. | |
OFCondition | pruneInvalidRecords () |
Prune invalid records from the database. | |
void | enableQuotaSystem (OFBool enable) |
enable/disable the DB quota system (default: enabled) which causes images to be deleted if certain boundaries (number of studies, bytes per study) are exceeded. | |
OFBool | findSOPInstance (const char *storeArea, const OFString &sopClassUID, const OFString &sopInstanceUID) |
search for a SOP class and SOP instance UIDs in index file. | |
OFCondition | deleteImageFile (char *imgFile) |
deletes the given file only if the quota mechanism is enabled. | |
OFCondition | DB_lock (OFBool exclusive) |
create lock on database | |
OFCondition | DB_unlock () |
release lock on database | |
OFCondition | DB_IdxGetNext (int *idx, IdxRecord *idxRec) |
Get next Index record that is in use (i.e. | |
OFCondition | DB_IdxInitLoop (int *idx) |
seek to beginning of image records in index file | |
OFCondition | DB_IdxRead (int idx, IdxRecord *idxRec) |
read index record at given index | |
OFCondition | DB_GetStudyDesc (StudyDescRecord *pStudyDesc) |
get study descriptor record from start of index file | |
OFCondition | DB_StudyDescChange (StudyDescRecord *pStudyDesc) |
write study descriptor record to start of index file | |
OFCondition | DB_IdxRemove (int idx) |
deactivate index record at given index by setting an empty filename | |
OFCondition | instanceReviewed (int idx) |
clear the "is new" flag for the instance with the given index | |
const char * | getStorageArea () const |
return name of storage area | |
const char * | getIndexFilename () const |
return path to index file | |
Static Public Member Functions | |
static void | printIndexFile (char *storeArea) |
dump database index file to stdout. | |
Private Member Functions | |
DcmQueryRetrieveIndexDatabaseHandle (const DcmQueryRetrieveIndexDatabaseHandle &other) | |
private undefined copy constructor | |
DcmQueryRetrieveIndexDatabaseHandle & | operator= (const DcmQueryRetrieveIndexDatabaseHandle &other) |
private undefined assignment operator | |
OFCondition | removeDuplicateImage (const char *SOPInstanceUID, const char *StudyInstanceUID, StudyDescRecord *pStudyDesc, const char *newImageFileName) |
int | deleteOldestStudy (StudyDescRecord *pStudyDesc) |
OFCondition | deleteOldestImages (StudyDescRecord *pStudyDesc, int StudyNum, char *StudyUID, long RequiredSize) |
int | matchDate (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt) |
int | matchTime (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt) |
int | matchUID (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt) |
int | matchStrings (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt) |
int | matchOther (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt) |
int | dbmatch (DB_SmallDcmElmt *mod, DB_SmallDcmElmt *elt) |
void | makeResponseList (DB_Private_Handle *phandle, IdxRecord *idxRec) |
int | matchStudyUIDInStudyDesc (StudyDescRecord *pStudyDesc, char *StudyUID, int maxStudiesAllowed) |
OFCondition | checkupinStudyDesc (StudyDescRecord *pStudyDesc, char *StudyUID, long imageSize) |
OFCondition | hierarchicalCompare (DB_Private_Handle *phandle, IdxRecord *idxRec, DB_LEVEL level, DB_LEVEL infLevel, int *match) |
OFCondition | testFindRequestList (DB_ElementList *findRequestList, DB_LEVEL queryLevel, DB_LEVEL infLevel, DB_LEVEL lowestLevel) |
OFCondition | testMoveRequestList (DB_ElementList *findRequestList, DB_LEVEL queryLevel, DB_LEVEL infLevel, DB_LEVEL lowestLevel) |
Private Attributes | |
DB_Private_Handle * | handle_ |
database handle | |
OFBool | quotaSystemEnabled |
flag indicating whether or not the quota system is enabled | |
OFBool | doCheckFindIdentifier |
flag indicating whether or not the check function for FIND requests is enabled | |
OFBool | doCheckMoveIdentifier |
flag indicating whether or not the check function for MOVE requests is enabled | |
OFFilenameCreator | fnamecreator |
helper object for file name creation |
This class maintains database handles based on the classical "index.dat" file.
A database handle maintains a connection to a database and encapsulates database support for store, find and move/get operations.
DcmQueryRetrieveIndexDatabaseHandle::DcmQueryRetrieveIndexDatabaseHandle | ( | const char * | storageArea, |
long | maxStudiesPerStorageArea, | ||
long | maxBytesPerStudy, | ||
OFCondition & | result | ||
) |
Constructor.
Creates and initializes a index file handle for the given database storage area (storageArea).
storageArea | name of storage area, must not be NULL |
maxStudiesPerStorageArea | maximum number of studies for this storage area, needed to correctly parse the index file. |
maxBytesPerStudy | maximum number of bytes per study, for quota mechanism |
result | upon successful initialization of the database handle, EC_Normal is returned in this parameter, otherwise an error code is returned. |
Destructor.
Destroys handle, cancels any ongoing request if necessary, deletes temporary files used for C-STORE and sub-operations of C-MOVE.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::cancelFindRequest | ( | DcmQueryRetrieveDatabaseStatus * | status | ) | [virtual] |
cancel the ongoing FIND request, stop and reset every running operation associated with this request, delete existing temporary files.
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-FIND-RSP message is set. |
Implements DcmQueryRetrieveDatabaseHandle.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::cancelMoveRequest | ( | DcmQueryRetrieveDatabaseStatus * | status | ) | [virtual] |
cancel the ongoing MOVE request, stop and reset every running operation associated with this request, delete existing temporary files.
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-MOVE-RSP message is set. |
Implements DcmQueryRetrieveDatabaseHandle.
get study descriptor record from start of index file
pStudyDesc | pointer to study record descriptor structure |
OFCondition DcmQueryRetrieveIndexDatabaseHandle::DB_IdxGetNext | ( | int * | idx, |
IdxRecord * | idxRec | ||
) |
Get next Index record that is in use (i.e.
references a non-empty a filename)
idx | pointer to index number, updated upon successful return |
idxRec | pointer to index record structure |
seek to beginning of image records in index file
idx | initialized to -1 |
OFCondition DcmQueryRetrieveIndexDatabaseHandle::DB_IdxRead | ( | int | idx, |
IdxRecord * | idxRec | ||
) |
read index record at given index
idx | index |
idxRec | pointer to index record |
deactivate index record at given index by setting an empty filename
idx | index |
OFCondition DcmQueryRetrieveIndexDatabaseHandle::DB_lock | ( | OFBool | exclusive | ) |
create lock on database
exclusive | exclusive/shared lock flag |
write study descriptor record to start of index file
pStudyDesc | pointer to study record descriptor structure |
OFCondition DcmQueryRetrieveIndexDatabaseHandle::deleteImageFile | ( | char * | imgFile | ) |
deletes the given file only if the quota mechanism is enabled.
The image is not de-registered from the database by this routine.
imgFile | file name (path) to the file to be deleted. |
OFBool DcmQueryRetrieveIndexDatabaseHandle::findSOPInstance | ( | const char * | storeArea, |
const OFString & | sopClassUID, | ||
const OFString & | sopInstanceUID | ||
) |
search for a SOP class and SOP instance UIDs in index file.
storeArea | name of storage area, must not be NULL |
sopClassUID | SOP Class UID to search for |
sopInstanceUID | SOP Instance UID to search for |
clear the "is new" flag for the instance with the given index
idx | index |
OFCondition DcmQueryRetrieveIndexDatabaseHandle::makeNewStoreFileName | ( | const char * | SOPClassUID, |
const char * | SOPInstanceUID, | ||
char * | newImageFileName | ||
) | [virtual] |
create a filename under which a DICOM object that is currently being received through a C-STORE operation can be stored.
SOPClassUID | SOP class UID of DICOM instance |
SOPInstanceUID | SOP instance UID of DICOM instance |
newImageFileName | file name is returned in this parameter. Memory must be provided by the caller and should be at least MAXPATHLEN+1 characters. The file name generated should be an absolute file name. |
Implements DcmQueryRetrieveDatabaseHandle.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::nextFindResponse | ( | DcmDataset ** | findResponseIdentifiers, |
DcmQueryRetrieveDatabaseStatus * | status | ||
) | [virtual] |
return the next available FIND response as a new DICOM dataset.
findResponseIdentifiers | DICOM dataset returned in this parameter. The caller is responsible for destroying the findResponseIdentifiers when no longer needed. |
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-FIND-RSP message is set. Status will be PENDING if more FIND responses will be generated or SUCCESS if no more FIND responses will be generated (SUCCESS indicates the completion of a operation), or another status code upon failure. |
Implements DcmQueryRetrieveDatabaseHandle.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::nextMoveResponse | ( | char * | SOPClassUID, |
char * | SOPInstanceUID, | ||
char * | imageFileName, | ||
unsigned short * | numberOfRemainingSubOperations, | ||
DcmQueryRetrieveDatabaseStatus * | status | ||
) | [virtual] |
Constructs the information required for the next available C-MOVE sub-operation (the image SOP class UID, SOP Instance UID and an imageFileName containing the requested data).
SOPClassUID | pointer to string of at least 65 characters into which the SOP class UID for the next DICOM object to be transferred is copied. |
SOPInstanceUID | pointer to string of at least 65 characters into which the SOP instance UID for the next DICOM object to be transferred is copied. |
imageFileName | pointer to string of at least MAXPATHLEN+1 characters into which the file path for the next DICOM object to be transferred is copied. |
numberOfRemainingSubOperations | On return, this parameter will contain the number of suboperations still remaining for the request (this number is needed by move responses with PENDING status). |
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-MOVE-RSP message is set. Status will be PENDING if more MOVE responses will be generated or SUCCESS if no more MOVE responses will be generated (SUCCESS indicates the completion of a operation), or another status code upon failure. |
Implements DcmQueryRetrieveDatabaseHandle.
static void DcmQueryRetrieveIndexDatabaseHandle::printIndexFile | ( | char * | storeArea | ) | [static] |
dump database index file to stdout.
storeArea | name of storage area, must not be NULL |
Prune invalid records from the database.
Records referring to non-existant image files are invalid.
Implements DcmQueryRetrieveDatabaseHandle.
void DcmQueryRetrieveIndexDatabaseHandle::setIdentifierChecking | ( | OFBool | checkFind, |
OFBool | checkMove | ||
) | [virtual] |
Configure the DB module to perform (or not perform) checking of FIND and MOVE request identifiers.
Default is no checking.
checkFind | checking for C-FIND parameters |
checkMove | checking for C-MOVE parameters |
Implements DcmQueryRetrieveDatabaseHandle.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::startFindRequest | ( | const char * | SOPClassUID, |
DcmDataset * | findRequestIdentifiers, | ||
DcmQueryRetrieveDatabaseStatus * | status | ||
) | [virtual] |
initiate FIND operation using the given SOP class UID (which identifies the query model) and DICOM dataset containing find request identifiers.
SOPClassUID | SOP class UID of query service, identifies Q/R model |
findRequestIdentifiers | dataset containing request identifiers (i.e., the query) The caller retains responsibility for destroying the findRequestIdentifiers when no longer needed. |
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-FIND-RSP message is set. Status will be PENDING if any FIND responses will be generated or SUCCESS if no FIND responses will be generated (SUCCESS indicates the completion of a operation), or another status code upon failure. |
Implements DcmQueryRetrieveDatabaseHandle.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::startMoveRequest | ( | const char * | SOPClassUID, |
DcmDataset * | moveRequestIdentifiers, | ||
DcmQueryRetrieveDatabaseStatus * | status | ||
) | [virtual] |
initiate MOVE operation using the given SOP class UID (which identifies the retrieve model) and DICOM dataset containing move request identifiers.
SOPClassUID | SOP class UID of retrieve service, identifies Q/R model |
moveRequestIdentifiers | dataset containing request identifiers (i.e., the query) The caller retains responsibility for destroying the moveRequestIdentifiers when no longer needed. |
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-MOVE-RSP message is set. Status will be PENDING if any MOVE responses will be generated or SUCCESS if no MOVE responses will be generated (SUCCESS indicates the completion of a operation), or another status code upon failure. |
Implements DcmQueryRetrieveDatabaseHandle.
OFCondition DcmQueryRetrieveIndexDatabaseHandle::storeRequest | ( | const char * | SOPClassUID, |
const char * | SOPInstanceUID, | ||
const char * | imageFileName, | ||
DcmQueryRetrieveDatabaseStatus * | status, | ||
OFBool | isNew = OFTrue |
||
) | [virtual] |
register the given DICOM object, which has been received through a C-STORE operation and stored in a file, in the database.
SOPClassUID | SOP class UID of DICOM instance |
SOPInstanceUID | SOP instance UID of DICOM instance |
imageFileName | file name (full path) of DICOM instance |
status | pointer to DB status object in which a DIMSE status code suitable for use with the C-STORE-RSP message is set. |
isNew | if true, the instance is marked as "new" in the database, if such a flag is maintained in the database. |
Implements DcmQueryRetrieveDatabaseHandle.