00001 /* 00002 * 00003 * Copyright (C) 1994-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmnet 00015 * 00016 * Author: Marco Eichelberg / Andrew Hewett 00017 * 00018 * Purpose: Classes for Query/Retrieve Service Class User (C-FIND operation) 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:17:22 $ 00022 * CVS/RCS Revision: $Revision: 1.5 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 #ifndef DFINDSCU_H 00030 #define DFINDSCU_H 00031 00032 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00033 #include "dcmtk/ofstd/ofcond.h" /* for class OFCondition */ 00034 #include "dcmtk/dcmdata/dcxfer.h" /* for E_TransferSyntax */ 00035 #include "dcmtk/dcmnet/dimse.h" /* for T_DIMSE_BlockingMode */ 00036 00037 // forward declarations of classes and structs 00038 class DcmDataset; 00039 class DcmTransportLayer; 00040 class OFConsoleApplication; 00041 struct T_ASC_Association; 00042 struct T_ASC_Parameters; 00043 struct T_DIMSE_C_FindRQ; 00044 struct T_DIMSE_C_FindRSP; 00045 00058 class DcmFindSCUCallback 00059 { 00060 public: 00061 00063 DcmFindSCUCallback(); 00064 00066 virtual ~DcmFindSCUCallback() {} 00067 00074 virtual void callback( 00075 T_DIMSE_C_FindRQ *request, 00076 int responseCount, 00077 T_DIMSE_C_FindRSP *rsp, 00078 DcmDataset *responseIdentifiers) = 0; 00079 00085 void setAssociation(T_ASC_Association *assoc); 00086 00092 void setPresentationContextID(T_ASC_PresentationContextID presId); 00093 00094 protected: /* the two member variables are protected and can be accessed from derived classes */ 00095 00097 T_ASC_Association *assoc_; 00098 00100 T_ASC_PresentationContextID presId_; 00101 }; 00102 00103 00107 class DcmFindSCUDefaultCallback: public DcmFindSCUCallback 00108 { 00109 public: 00115 DcmFindSCUDefaultCallback( 00116 OFBool extractResponsesToFile, 00117 int cancelAfterNResponses); 00118 00120 virtual ~DcmFindSCUDefaultCallback() {} 00121 00128 virtual void callback( 00129 T_DIMSE_C_FindRQ *request, 00130 int responseCount, 00131 T_DIMSE_C_FindRSP *rsp, 00132 DcmDataset *responseIdentifiers); 00133 00134 private: 00135 00137 OFBool extractResponsesToFile_; 00138 00140 int cancelAfterNResponses_; 00141 }; 00142 00143 00149 class DcmFindSCU 00150 { 00151 public: 00152 00154 DcmFindSCU(); 00155 00157 virtual ~DcmFindSCU(); 00158 00163 OFCondition initializeNetwork(int acse_timeout); 00164 00176 OFCondition setTransportLayer(DcmTransportLayer *tLayer); 00177 00181 OFCondition dropNetwork(); 00182 00222 OFCondition performQuery( 00223 const char *peer, 00224 unsigned int port, 00225 const char *ourTitle, 00226 const char *peerTitle, 00227 const char *abstractSyntax, 00228 E_TransferSyntax preferredTransferSyntax, 00229 T_DIMSE_BlockingMode blockMode, 00230 int dimse_timeout, 00231 Uint32 maxReceivePDULength, 00232 OFBool secureConnection, 00233 OFBool abortAssociation, 00234 unsigned int repeatCount, 00235 OFBool extractResponsesToFile, 00236 int cancelAfterNResponses, 00237 OFList<OFString> *overrideKeys, 00238 DcmFindSCUCallback *callback = NULL, 00239 OFList<OFString> *fileNameList = NULL); 00240 00249 static OFBool writeToFile(const char* ofname, DcmDataset *dataset); 00250 00251 private: 00252 00264 OFCondition addPresentationContext( 00265 T_ASC_Parameters *params, 00266 const char *abstractSyntax, 00267 E_TransferSyntax preferredTransferSyntax); 00268 00288 OFCondition findSCU( 00289 T_ASC_Association * assoc, 00290 const char *fname, 00291 int repeatCount, 00292 const char *abstractSyntax, 00293 T_DIMSE_BlockingMode blockMode, 00294 int dimse_timeout, 00295 OFBool extractResponsesToFile, 00296 int cancelAfterNResponses, 00297 OFList<OFString> *overrideKeys, 00298 DcmFindSCUCallback *callback = NULL) const; 00299 00300 private: 00301 00303 T_ASC_Network *net_; 00304 00305 }; 00306 00307 #endif 00308 00309 /* 00310 * CVS Log 00311 * $Log: dfindscu.h,v $ 00312 * Revision 1.5 2010-10-14 13:17:22 joergr 00313 * Updated copyright header. Added reference to COPYRIGHT file. 00314 * 00315 * Revision 1.4 2009-11-18 11:53:58 uli 00316 * Switched to logging mechanism provided by the "new" oflog module. 00317 * 00318 * Revision 1.3 2009-07-10 13:21:04 onken 00319 * Moved override key functionality to DcmPathProcessor. 00320 * 00321 * Revision 1.2 2009-07-08 16:14:25 onken 00322 * Added support for specifying tag paths as override keys. 00323 * 00324 * Revision 1.1 2007-02-19 13:13:28 meichel 00325 * Refactored findscu code into class DcmFindSCU, which is now part of the dcmnet 00326 * library, and a short command line tool that only evaluates command line 00327 * parameters and then makes use of this class. This facilitates re-use of the 00328 * findscu code in other applications. 00329 * 00330 * 00331 */