OFFIS DCMTK  Version 3.6.0
dcpath.h
1 /*
2  *
3  * Copyright (C) 2008-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Michael Onken
17  *
18  * Purpose: Class declarations for accessing DICOM dataset structures (items,
19  * sequences and leaf elements via string-based path access.
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:15:41 $
23  * CVS/RCS Revision: $Revision: 1.10 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef DCPATH_H
31 #define DCPATH_H
32 
33 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
34 
35 #include "dcmtk/dcmdata/dcdatset.h"
36 
37 
46 {
47 
48 public:
49 
52  DcmPathNode() : m_obj(NULL), m_itemNo(0) {}
53 
61  DcmPathNode(DcmObject* obj, Uint32 itemNo) : m_obj(obj), m_itemNo(itemNo) {}
62 
66 
69 
71  Uint32 m_itemNo;
72 
73 private:
74 
77  DcmPathNode(const DcmPathNode& rhs);
78 
81  DcmPathNode& operator=(const DcmPathNode& arg);
82 
83 };
84 
85 
94 class DcmPath
95 {
96 
97 public:
98 
101  DcmPath();
102 
107  DcmPath(const OFList<DcmPathNode*>& currentPath);
108 
114  void append(DcmPathNode* node);
115 
120  void deleteBackNode();
121 
125  OFListIterator(DcmPathNode*) begin();
126 
130  DcmPathNode* back();
131 
135  OFListIterator(DcmPathNode*) end();
136 
140  Uint32 size() const;
141 
145  OFBool empty() const;
146 
151  OFString toString() const;
152 
158  OFBool containsGroup(const Uint16& groupNo) const;
159 
168  static OFCondition separatePathNodes(const OFString& path, OFList<OFString>& result);
169 
183  static OFCondition parseItemNoFromPath(OFString& path, // inout
184  Uint32& itemNo, // out
185  OFBool& wasWildcard); // out
186 
196  static OFCondition parseTagFromPath(OFString& path, // inout
197  DcmTag& tag); // out
198 
204  ~DcmPath();
205 
206 private:
207 
210 
213  DcmPath(const DcmPath& rhs);
214 
217  DcmPath& operator=(const DcmPath& arg);
218 };
219 
220 
222 {
223 
224 public:
225 
229 
236  void setItemWildcardSupport(const OFBool& supported);
237 
238 
247  void checkPrivateReservations(const OFBool& doChecking);
248 
288  const OFString& path,
289  OFBool createIfNecessary = OFFalse);
290 
316  const OFString& path,
317  Uint32& numDeleted);
318 
326  Uint32 getResults(OFList<DcmPath*>& searchResults);
327 
328 
342  const OFString& overrideKey);
343 
348 
349 protected:
350 
385  OFString& path);
386 
420  OFString& path);
421 
433  static OFCondition deleteLastElemFromPath(DcmObject* objSearchedIn,
434  DcmPath *path,
435  DcmPathNode* toDelete);
436 
448  static OFCondition deleteLastItemFromPath(DcmObject* objSearchedIn,
449  DcmPath *path,
450  DcmPathNode* toDelete);
451 
462  DcmTag& tag);
469  static DcmTagKey calcPrivateReservationTag(const DcmTagKey &privateKey);
470 
479  void clear();
480 
481 private:
482 
485 
488 
492 
496 
500 
504 
508 
509 };
510 
511 
512 #endif // DCPATH_H
513 
514 /*
515 ** CVS/RCS Log:
516 ** $Log: dcpath.h,v $
517 ** Revision 1.10 2010-10-14 13:15:41 joergr
518 ** Updated copyright header. Added reference to COPYRIGHT file.
519 **
520 ** Revision 1.9 2010-08-09 13:02:56 joergr
521 ** Updated data dictionary to 2009 edition of the DICOM standard. From now on,
522 ** the official "keyword" is used for the attribute name which results in a
523 ** number of minor changes (e.g. "PatientsName" is now called "PatientName").
524 **
525 ** Revision 1.8 2009-11-04 09:58:07 uli
526 ** Switched to logging mechanism provided by the "new" oflog module
527 **
528 ** Revision 1.7 2009-09-29 12:55:17 uli
529 ** Include only the needed headers in dcpath.h and dcpath.cc
530 **
531 ** Revision 1.6 2009-07-10 13:12:30 onken
532 ** Added override key functionality used by tools like findscu to the more
533 ** central DcmPathProcessor class.
534 **
535 ** Revision 1.5 2009-07-08 16:09:30 onken
536 ** Cleaned up code for private reservation checking and added option for
537 ** disabling item wildcards for searching/creating tag paths.
538 **
539 ** Revision 1.4 2009-01-15 16:04:06 onken
540 ** Added options for handling of private tags and fixed bug for deleting
541 ** tags on main level.
542 **
543 ** Revision 1.3 2009-01-12 12:37:45 onken
544 ** Fixed iterators to also compile with STL classes being enabled.
545 **
546 ** Revision 1.2 2008-12-12 13:16:03 onken
547 ** Fixed doxygen documentation.
548 **
549 ** Revision 1.1 2008-12-12 11:44:40 onken
550 ** Moved path access functions to separate classes
551 **
552 */
OFList< DcmPath * > m_results
Internal list that represents the search results found.
Definition: dcpath.h:487
a class representing a list of DICOM elements in which each element has a different tag and elements ...
Definition: dcitem.h:51
class maintaining a attribute tag (group and element number)
Definition: dctagkey.h:46
~DcmPathProcessor()
Deconstructor, cleans up memory that was allocated for any search results.
OFCondition applyPathWithValue(DcmDataset *dataset, const OFString &overrideKey)
Helper function that applies a specified "override key" in path syntax to the given dataset...
OFBool m_createIfNecessary
Denotes whether missing items/sequences/attributes should be automatically inserted when using findAn...
Definition: dcpath.h:491
void checkPrivateReservations(const OFBool &doChecking)
Enables (class default: enabled) or disables checking of private reservations when inserting private ...
OFCondition findOrCreatePath(DcmObject *obj, const OFString &path, OFBool createIfNecessary=OFFalse)
Function that allows for finding and/or inserting a hierarchy of items and attributes as defined by a...
class representing a DICOM Sequence of Items (SQ).
Definition: dcsequen.h:47
OFCondition findOrDeletePath(DcmObject *obj, const OFString &path, Uint32 &numDeleted)
Function that allows for deleting elements and items from a DICOM object tree.
OFCondition findOrCreateItemPath(DcmItem *item, OFString &path)
Function that allows for finding and/or inserting a hierarchy of items and attributes as defined by a...
static OFCondition separatePathNodes(const OFString &path, OFList< OFString > &result)
Returns a string representation of each path node separately.
this class encapsulates an attribute tag (group, element) and a VR.
Definition: dctag.h:50
OFString toString() const
Returns a string representation of the path, e.
static OFCondition deleteLastElemFromPath(DcmObject *objSearchedIn, DcmPath *path, DcmPathNode *toDelete)
Helper function that looks at the last node in a given path and deletes the corresponding DICOM objec...
static OFCondition parseTagFromPath(OFString &path, DcmTag &tag)
Function that parses a tag from the beginning of a path string.
static OFCondition deleteLastItemFromPath(DcmObject *objSearchedIn, DcmPath *path, DcmPathNode *toDelete)
Helper function that looks at the last node in a given path and deletes the corresponding DICOM objec...
Abstract base class for most classes in module dcmdata.
Definition: dcobject.h:179
OFList< DcmPathNode * > m_currentPath
Internal list that is during search for keeping track of current path.
Definition: dcpath.h:484
DcmPathNode * back()
Returns last path component.
DcmPathNode()
Constructor.
Definition: dcpath.h:52
void deleteBackNode()
Removes last path node from path.
DcmPathNode & operator=(const DcmPathNode &arg)
Private undefined assignment operator.
OFCondition checkPrivateTagReservation(DcmItem *item, DcmTag &tag)
Checks in item, whether a private reservation for a given tag key exists (if not disabled).
~DcmPath()
Desctructor, cleans up memory of path nodes.
DcmPathProcessor()
Constructor, creates an empty search object.
DcmPath()
Constructor, creates an empty search result.
Class representing a path of DICOM objects.
Definition: dcpath.h:94
void append(DcmPathNode *node)
Appends a search node at the end of the search result path.
void clear()
Cleans up memory that was allocated for any search results.
OFBool empty() const
Returns whether path is empty, ie does not contain any path nodes.
Uint32 getResults(OFList< DcmPath * > &searchResults)
Returns the results from the search / creation call.
DcmPathProcessor & operator=(const DcmPathProcessor &arg)
Private undefined assignment operator.
Uint32 size() const
Returns number of path components.
~DcmPathNode()
Destructor.
Definition: dcpath.h:65
OFList< DcmPathNode * > m_path
Internal list representing the nodes in the path.
Definition: dcpath.h:209
Class representing a node in DcmPath.
Definition: dcpath.h:45
a class handling the DICOM dataset format (files without meta header)
Definition: dcdatset.h:46
DcmPathNode(DcmObject *obj, Uint32 itemNo)
Constructor.
Definition: dcpath.h:61
OFBool containsGroup(const Uint16 &groupNo) const
Returns whether the path contains tags of a given group.
OFBool m_itemWildcardsEnabled
Denotes, whether a path is accepted that contains wildcards.
Definition: dcpath.h:499
OFListIterator(DcmPathNode *) begin()
Returns iterator pointing to first path component.
Uint32 m_itemNo
The item number of the item in m_obj; only useful if m_obj is an item.
Definition: dcpath.h:71
static OFCondition parseItemNoFromPath(OFString &path, Uint32 &itemNo, OFBool &wasWildcard)
Helper function for findOrCreatePath().
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
static DcmTagKey calcPrivateReservationTag(const DcmTagKey &privateKey)
Returns the private reservation tag key for a given private tag.
DcmPath & operator=(const DcmPath &arg)
Private undefined assignment operator.
DcmObject * m_obj
Pointer to object this search node points to.
Definition: dcpath.h:68
void setItemWildcardSupport(const OFBool &supported)
Sets whether searching/creating paths will support wildcard for items.
OFCondition findOrCreateSequencePath(DcmSequenceOfItems *seq, OFString &path)
Function that allows for finding and/or inserting a hierarchy of items and attributes as defined by a...
General purpose class for condition codes.
Definition: ofcond.h:305
OFBool m_checkPrivateReservations
If enabled (default), any insertions of private tags will fail, if no corresponding reservation exist...
Definition: dcpath.h:495


Generated on Sun Aug 23 2015 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.9.1