dcmqrtis.h

00001 /*
00002  *
00003  *  Copyright (C) 1993-2005, OFFIS
00004  *
00005  *  This software and supporting documentation were developed by
00006  *
00007  *    Kuratorium OFFIS e.V.
00008  *    Healthcare Information and Communication Systems
00009  *    Escherweg 2
00010  *    D-26121 Oldenburg, Germany
00011  *
00012  *  THIS SOFTWARE IS MADE AVAILABLE,  AS IS,  AND OFFIS MAKES NO  WARRANTY
00013  *  REGARDING  THE  SOFTWARE,  ITS  PERFORMANCE,  ITS  MERCHANTABILITY  OR
00014  *  FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES  OR
00015  *  ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND
00016  *  PERFORMANCE OF THE SOFTWARE IS WITH THE USER.
00017  *
00018  *  Module:  dcmqrdb
00019  *
00020  *  Author:  Andrew Hewett
00021  *
00022  *  Purpose: TI Common Constants, Types, Globals and Functions
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2005/12/08 16:04:28 $
00026  *  Source File:      $Source: /share/dicom/cvs-depot/dcmtk/dcmqrdb/include/dcmtk/dcmqrdb/dcmqrtis.h,v $
00027  *  CVS/RCS Revision: $Revision: 1.4 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 #ifndef DCMQRTIS_H
00035 #define DCMQRTIS_H
00036 
00037 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00038 
00039 #include "dcmtk/dcmnet/dicom.h"
00040 #include "dcmtk/dcmnet/cond.h"
00041 #include "dcmtk/dcmnet/assoc.h"
00042 #include "dcmtk/dcmnet/dimse.h"
00043 #include "dcmtk/ofstd/ofcmdln.h"
00044 #include "dcmtk/dcmqrdb/dcmqrcnf.h"
00045 
00046 class DcmQueryRetrieveDatabaseHandle;
00047 
00048 /*
00049  * Constants
00050  */
00051 
00052 #define TI_MAXPEERS       100
00053 #define TI_MAXDATABASES   100
00054 #define TI_MAXSTUDIES    1000
00055 #define TI_MAXSERIES      500
00056 #define TI_MAXIMAGES     1000
00057 
00058 /*
00059  * Type definitions
00060  */
00061 
00062 struct TI_ImageEntry
00063 {
00064     DIC_UI  sopInstanceUID;
00065     DIC_IS  imageNumber;
00066     int   intImageNumber;
00067 } ;
00068 
00069 struct TI_SeriesEntry
00070 {
00071     DIC_UI  seriesInstanceUID;
00072     DIC_IS  seriesNumber;
00073     int   intSeriesNumber;
00074     DIC_CS  modality;
00075     TI_ImageEntry *images[TI_MAXIMAGES];  /* array of image pointers */
00076     int     imageCount;
00077 
00078     time_t lastQueryTime; /* time we last queried db */
00079 };
00080 
00081 struct TI_StudyEntry
00082 {
00083     DIC_UI  studyInstanceUID;
00084     DIC_CS  studyID;
00085     DIC_PN  patientsName;
00086     DIC_LO  patientID;
00087     TI_SeriesEntry  *series[TI_MAXSERIES];  /* array of series pointers */
00088     int     seriesCount;
00089     time_t lastQueryTime; /* time we last queried db */
00090 };
00091 
00092 
00093 struct TI_DBEntry
00094 {
00095     const char *title;  /* the CTN AE Title associated with this DB */
00096 
00097     const char **peerTitles;  /* peer titles which can read this database
00098        * and thus we can comminicate with */
00099     int peerTitleCount; /* number of peer titles */
00100 
00101     DcmQueryRetrieveDatabaseHandle *dbHandle;  /* handle to current db */
00102 
00103     TI_StudyEntry *studies[TI_MAXSTUDIES]; /* array of study pointers */
00104     int     studyCount;
00105 
00106     int currentStudy; /* index of current study */
00107     int currentSeries;  /* index of current series in current study */
00108     int currentImage; /* index of current image in current study */
00109 
00110     time_t lastQueryTime; /* time we last queried db */
00111 
00112     OFBool isRemoteDB;  /* true if DB is remote */
00113 };
00114 
00115 struct TI_GenericCallbackStruct
00116 {
00117     TI_DBEntry *db;
00118     TI_StudyEntry *study;
00119     TI_SeriesEntry *series;
00120 };
00121 
00122 typedef OFBool (*TI_GenericEntryCallbackFunction)(TI_GenericCallbackStruct *cbstruct, DcmDataset *reply);
00123 
00126 class DcmQueryRetrieveTelnetInitiator
00127 {
00128 public:
00129 
00133     DcmQueryRetrieveTelnetInitiator(DcmQueryRetrieveConfig &cfg);
00134 
00137     void TI_userInput();
00138 
00143     OFBool addPeerName(const char *peerName, const char *configFileName);
00144 
00147     void printConfig();
00148 
00152     OFBool TI_detachAssociation(OFBool abortFlag);
00153     
00157     void setAETitle(const char *ae)
00158     {
00159       myAETitle = ae;
00160     }
00161     
00165     void setMaxPDU(OFCmdUnsignedInt pdu)
00166     {
00167       maxReceivePDULength = pdu;
00168     }
00169 
00172     void activateFirstPeer()
00173     {
00174       peerHostName = peerNames[0];
00175     }
00176     
00181     T_ASC_Network **accessNet()
00182     {
00183       return &net;
00184     }
00185     
00187     int getdbCount() const
00188     {
00189       return dbCount;
00190     }
00191 
00197     void createConfigEntries(
00198       const char *configFileName,
00199       int remoteDBTitlesCount,
00200       const char **remoteDBTitles);
00201 
00205     void setXferSyntax(E_TransferSyntax xfer) { networkTransferSyntax = xfer; }
00206    
00211     void setDebug (OFBool is_verbose, OFBool is_debug)
00212     {
00213       verbose = is_verbose;
00214       debug = is_debug;
00215     }
00216 
00221     void setBlockMode(T_DIMSE_BlockingMode blockMode, int timeout)
00222     {
00223       blockMode_ = blockMode;
00224       dimse_timeout_ = timeout;
00225     }
00226     
00227 private:
00228     
00229     OFBool TI_attachAssociation();
00230     OFBool TI_changeAssociation();
00231     OFBool TI_sendEcho();
00232     OFBool TI_storeImage(char *sopClass, char *sopInstance, char * imgFile);
00233     OFBool TI_remoteFindQuery(
00234         TI_DBEntry *db, DcmDataset *query,
00235         TI_GenericEntryCallbackFunction callbackFunction,
00236         TI_GenericCallbackStruct *callbackData);
00237     OFBool TI_title(int arg, const char * /*cmdbuf*/ );
00238     OFBool TI_attachDB(TI_DBEntry *db);
00239     OFBool TI_database(int arg, const char * /*cmdbuf*/ );
00240     OFBool TI_echo(int arg, const char * /*cmdbuf*/ );
00241     OFBool TI_quit(int arg, const char * /*cmdbuf*/ );
00242     OFBool TI_actualizeStudies();
00243     OFBool TI_study(int arg, const char * /*cmdbuf*/ );
00244     OFBool TI_actualizeSeries();
00245     OFBool TI_series(int arg, const char * /*cmdbuf*/ );
00246     OFBool TI_actualizeImages();
00247     OFBool TI_image(int arg, const char * /*cmdbuf*/ );
00248     OFBool TI_buildStudies(TI_DBEntry *db);
00249     OFBool TI_buildSeries(TI_DBEntry *db, TI_StudyEntry *study);
00250     OFBool TI_buildRemoteImages(TI_DBEntry *db, TI_StudyEntry *study, TI_SeriesEntry *series);
00251     OFBool TI_buildImages(TI_DBEntry *db, TI_StudyEntry *study, TI_SeriesEntry *series);
00252     OFBool TI_sendStudy(int arg, const char * /*cmdbuf*/ );
00253     OFBool TI_sendSeries(int arg, const char * /*cmdbuf*/ );
00254     OFBool TI_sendImage(int arg, const char * /*cmdbuf*/ );
00255     OFBool TI_send(int /*arg*/, const char *cmdbuf);
00256     OFBool TI_shortHelp(int /*arg*/ , const char * /*cmdbuf*/ );
00257     OFBool TI_help(int arg, const char * /*cmdbuf*/ );
00258     OFBool TI_buildRemoteStudies(TI_DBEntry *db);
00259     OFBool TI_buildRemoteSeries(TI_DBEntry *db, TI_StudyEntry *study);
00260     OFBool TI_dbReadable(const char *dbTitle);
00261     time_t TI_dbModifyTime(const char *dbTitle);
00262     OFCondition addPresentationContexts(T_ASC_Parameters *params);
00263 
00264     OFBool findDBPeerTitles(
00265       const char *configFileName,
00266       TI_DBEntry *dbEntry, 
00267       const char *peer);
00268     
00270     TI_DBEntry **dbEntries;
00271     
00273     int dbCount;
00274     
00276     const char *peerHostName;
00277     
00279     const char *peerNames[TI_MAXPEERS];
00280 
00282     int peerNamesCount;
00283 
00285     const char *myAETitle;
00286 
00288     T_ASC_Network *net;
00289 
00291     T_ASC_Association *assoc;
00292 
00294     OFCmdUnsignedInt maxReceivePDULength;
00295 
00297     int currentdb;
00298     
00300     const char *currentPeerTitle;
00301 
00303     DcmQueryRetrieveConfig& config;
00304 
00306     E_TransferSyntax networkTransferSyntax;
00307 
00309     OFBool verbose;
00310 
00312     OFBool debug;
00313 
00315     T_DIMSE_BlockingMode blockMode_;
00316     
00318     int dimse_timeout_;
00319     
00320 };
00321 
00322 
00323 #endif
00324 
00325 /*
00326  * CVS Log
00327  * $Log: dcmqrtis.h,v $
00328  * Revision 1.4  2005/12/08 16:04:28  meichel
00329  * Changed include path schema for all DCMTK header files
00330  *
00331  * Revision 1.3  2005/11/17 13:44:37  meichel
00332  * Added command line options for DIMSE and ACSE timeouts
00333  *
00334  * Revision 1.2  2005/06/16 08:03:51  meichel
00335  * Fixed typo in method name
00336  *
00337  * Revision 1.1  2005/03/30 13:34:50  meichel
00338  * Initial release of module dcmqrdb that will replace module imagectn.
00339  *   It provides a clear interface between the Q/R DICOM front-end and the
00340  *   database back-end. The imagectn code has been re-factored into a minimal
00341  *   class structure.
00342  *
00343  *
00344  */


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5