00001 /* 00002 * 00003 * Copyright (C) 1996-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: dcmwlm 00015 * 00016 * Author: Thomas Wilkens 00017 * 00018 * Purpose: Class for managing file system interaction. 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-10-14 13:16:39 $ 00022 * CVS/RCS Revision: $Revision: 1.18 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 #ifndef WlmFileSystemInteractionManager_h 00030 #define WlmFileSystemInteractionManager_h 00031 00032 #include "dcmtk/config/osconfig.h" 00033 #include "dcmtk/ofstd/ofstring.h" 00034 #include "dcmtk/ofstd/oftypes.h" /* for OFBool */ 00035 00036 template <class T> class OFOrderedSet; 00037 struct WlmSuperiorSequenceInfoType; 00038 class DcmDataset; 00039 class DcmTagKey; 00040 class OFConsole; 00041 class OFCondition; 00042 class DcmItem; 00043 00048 class WlmFileSystemInteractionManager 00049 { 00050 private: 00054 WlmFileSystemInteractionManager(const WlmFileSystemInteractionManager &old); 00055 00059 WlmFileSystemInteractionManager &operator=(const WlmFileSystemInteractionManager &obj); 00060 00061 protected: 00063 OFString dfPath; 00065 OFBool enableRejectionOfIncompleteWlFiles; 00067 OFString calledApplicationEntityTitle; 00069 DcmDataset **matchingRecords; 00071 unsigned long numOfMatchingRecords; 00072 00078 void DetermineWorklistFiles( OFOrderedSet<OFString> &worklistFiles ); 00079 00085 OFBool IsWorklistFile( const char *fname ); 00086 00121 OFBool DatasetIsComplete( DcmDataset *dataset ); 00122 00130 OFBool ReferencedStudyOrPatientSequenceIsAbsentOrExistentButNonEmptyAndIncomplete( DcmTagKey sequenceTagKey, DcmItem *dset ); 00131 00138 OFBool DescriptionAndCodeSequenceAttributesAreIncomplete( DcmTagKey descriptionTagKey, DcmTagKey codeSequenceTagKey, DcmItem *dset ); 00139 00145 OFBool AttributeIsAbsentOrEmpty( DcmTagKey elemTagKey, DcmItem *dset ); 00146 00153 OFBool DatasetMatchesSearchMask( DcmDataset *dataset, DcmDataset *searchMask ); 00154 00160 void DetermineMatchingKeyAttributeValues( DcmDataset *dataset, const char **&matchingKeyAttrValues ); 00161 00168 OFBool ScheduledStationAETitlesMatch( const char *datasetValue, const char *searchMaskValue ); 00169 00179 OFBool ScheduledProcedureStepStartDateTimesMatch( const char *datasetDateValue, const char *datasetTimeValue, const char *searchMaskDateValue, const char *searchMaskTimeValue ); 00180 00187 OFBool ModalitiesMatch( const char *datasetValue, const char *searchMaskValue ); 00188 00195 OFBool ScheduledPerformingPhysicianNamesMatch( const char *datasetValue, const char *searchMaskValue ); 00196 00203 OFBool PatientsNamesMatch( const char *datasetValue, const char *searchMaskValue ); 00204 00211 OFBool PatientsIDsMatch( const char *datasetValue, const char *searchMaskValue ); 00212 00219 OFBool AccessionNumbersMatch( const char *datasetValue, const char *searchMaskValue ); 00220 00227 OFBool RequestedProcedureIdsMatch( const char *datasetValue, const char *searchMaskValue ); 00228 00235 OFBool ReferringPhysicianNamesMatch( const char *datasetValue, const char *searchMaskValue ); 00236 00243 OFBool PatientsSexesMatch( const char *datasetValue, const char *searchMaskValue ); 00244 00251 OFBool RequestingPhysiciansMatch( const char *datasetValue, const char *searchMaskValue ); 00252 00259 OFBool AdmissionIdsMatch( const char *datasetValue, const char *searchMaskValue ); 00260 00267 OFBool RequestedProcedurePrioritiesMatch( const char *datasetValue, const char *searchMaskValue ); 00268 00275 OFBool PatientsBirthDatesMatch( const char *datasetValue, const char *searchMaskValue ); 00276 00286 OFBool DateTimeRangeMatch( const char *datasetDateValue, const char *datasetTimeValue, const char *searchMaskDateValue, const char *searchMaskTimeValue ); 00287 00295 OFBool DateRangeMatch( const char *datasetDateValue, const char *searchMaskDateValue ); 00296 00304 OFBool TimeRangeMatch( const char *datasetTimeValue, const char *searchMaskTimeValue ); 00305 00315 OFBool DateTimeSingleValueMatch( const char *datasetDateValue, const char *datasetTimeValue, const char *searchMaskDateValue, const char *searchMaskTimeValue ); 00316 00324 OFBool DateSingleValueMatch( const char *datasetDateValue, const char *searchMaskDateValue ); 00325 00333 OFBool TimeSingleValueMatch( const char *datasetTimeValue, const char *searchMaskTimeValue ); 00334 00342 OFBool CaseSensitiveSingleValueMatch( const char *datasetValue, const char *searchMaskValue ); 00343 00350 OFBool WildcardMatch( const char *datasetValue, const char *searchMaskValue ); 00351 00361 OFBool MatchStarSymbol( const char *dv, const char *sv ); 00362 00371 void ExtractValuesFromRange( const char *range, char *&lower, char *&upper ); 00372 00373 public: 00376 WlmFileSystemInteractionManager(); 00377 00380 ~WlmFileSystemInteractionManager(); 00381 00385 void SetEnableRejectionOfIncompleteWlFiles( OFBool value ); 00386 00391 OFCondition ConnectToFileSystem( const OFString& dfPathv ); 00392 00396 OFCondition DisconnectFromFileSystem(); 00397 00405 OFBool IsCalledApplicationEntityTitleSupported( const OFString& calledApplicationEntityTitlev ); 00406 00414 unsigned long DetermineMatchingRecords( DcmDataset *searchMask ); 00415 00431 unsigned long GetNumberOfSequenceItemsForMatchingRecord( DcmTagKey sequenceTag, WlmSuperiorSequenceInfoType *superiorSequenceArray, unsigned long numOfSuperiorSequences, unsigned long idx ); 00432 00443 void GetAttributeValueForMatchingRecord( DcmTagKey tag, WlmSuperiorSequenceInfoType *superiorSequenceArray, unsigned long numOfSuperiorSequences, unsigned long idx, char *&value ); 00444 00448 void ClearMatchingRecords(); 00449 }; 00450 00451 #endif 00452 00453 /* 00454 ** CVS Log 00455 ** $Log: wlfsim.h,v $ 00456 ** Revision 1.18 2010-10-14 13:16:39 joergr 00457 ** Updated copyright header. Added reference to COPYRIGHT file. 00458 ** 00459 ** Revision 1.17 2010-08-09 13:29:39 joergr 00460 ** Updated data dictionary to 2009 edition of the DICOM standard. From now on, 00461 ** the official "keyword" is used for the attribute name which results in a 00462 ** number of minor changes (e.g. "PatientsName" is now called "PatientName"). 00463 ** 00464 ** Revision 1.16 2009-11-24 10:40:01 uli 00465 ** Switched to logging mechanism provided by the "new" oflog module. 00466 ** 00467 ** Revision 1.15 2009-11-02 15:50:25 joergr 00468 ** Changed forward declaration from "class" to "struct" in order to avoid 00469 ** warning messages reported by VisualStudio 2008. 00470 ** 00471 ** Revision 1.14 2009-09-30 08:40:34 uli 00472 ** Make dcmwlm's include headers self-sufficient by including all 00473 ** needed headers directly. 00474 ** 00475 ** Revision 1.13 2006-12-15 14:49:21 onken 00476 ** Removed excessive use char* and C-array in favour of OFString and 00477 ** OFList. Simplified some implementation details. 00478 ** 00479 ** Revision 1.12 2006/01/27 15:06:32 joergr 00480 ** Fixed issue with missing type 2 attributes in worklist files being reported 00481 ** as incomplete. Now, the attributes are inserted automatically if required. 00482 ** Removed email address from CVS log. 00483 ** 00484 ** Revision 1.11 2005/12/08 16:05:42 meichel 00485 ** Changed include path schema for all DCMTK header files 00486 ** 00487 ** Revision 1.10 2005/09/23 12:56:40 wilkens 00488 ** Added attribute PatientsBirthDate as a matching key attribute to wlmscpfs. 00489 ** 00490 ** Revision 1.9 2005/06/16 08:06:51 meichel 00491 ** Removed redundant class name, needed for gcc 3.4 00492 ** 00493 ** Revision 1.8 2005/05/04 11:34:31 wilkens 00494 ** Added two command line options --enable-file-reject (default) and 00495 ** --disable-file-reject to wlmscpfs: these options can be used to enable or 00496 ** disable a file rejection mechanism which makes sure only complete worklist files 00497 ** will be used during the matching process. A worklist file is considered to be 00498 ** complete if it contains all necessary type 1 information which the SCP might 00499 ** have to return to an SCU in a C-Find response message. 00500 ** 00501 ** Revision 1.7 2004/01/07 08:32:28 wilkens 00502 ** Added new sequence type return key attributes to wlmscpfs. Fixed bug that for 00503 ** equally named attributes in sequences always the same value will be returned. 00504 ** Added functionality that also more than one item will be returned in sequence 00505 ** type return key attributes. 00506 ** 00507 ** Revision 1.6 2003/12/23 13:04:36 wilkens 00508 ** Integrated new matching key attributes into wlmscpfs. 00509 ** 00510 ** Revision 1.5 2003/07/02 09:17:55 wilkens 00511 ** Updated documentation to get rid of doxygen warnings. 00512 ** 00513 ** Revision 1.4 2002/12/16 11:08:35 wilkens 00514 ** Added missing #include "osconfig.h" to certain files. 00515 ** 00516 ** Revision 1.3 2002/12/09 13:41:43 joergr 00517 ** Renamed parameter to avoid name clash with global function index(). 00518 ** Added private undefined copy constructor and/or assignment operator. 00519 ** 00520 ** Revision 1.2 2002/08/12 10:56:08 wilkens 00521 ** Made some modifications in in order to be able to create a new application 00522 ** which contains both wlmscpdb and ppsscpdb and another application which 00523 ** contains both wlmscpfs and ppsscpfs. 00524 ** 00525 ** Revision 1.1 2002/08/05 09:09:58 wilkens 00526 ** Modfified the project's structure in order to be able to create a new 00527 ** application which contains both wlmscpdb and ppsscpdb. 00528 ** 00529 ** Revision 1.1 2002/07/17 13:10:21 wilkens 00530 ** Corrected some minor logical errors in the wlmscpdb sources and completely 00531 ** updated the wlmscpfs so that it does not use the original wlistctn sources 00532 ** any more but standard wlm sources which are now used by all three variants 00533 ** of wlmscps. 00534 ** 00535 ** 00536 */