33 #include "dcmtk/config/osconfig.h"
35 #include "dcmtk/ofstd/offile.h"
36 #include "dcmtk/dcmdata/dctypes.h"
37 #include "dcmtk/dcmdata/dcobject.h"
38 #include "dcmtk/dcmdata/dclist.h"
39 #include "dcmtk/dcmdata/dcpcache.h"
66 const Uint32 len = 0);
108 virtual DcmEVR
ident()
const;
113 virtual unsigned long getVM();
118 virtual unsigned long card()
const;
126 virtual OFBool
isLeaf()
const {
return OFFalse; }
135 virtual void print(STD_NAMESPACE ostream&out,
136 const size_t flags = 0,
138 const char *pixelFileName = NULL,
139 size_t *pixelCounter = NULL);
158 const E_EncodingType enctype);
172 virtual Uint32
getLength(
const E_TransferSyntax xfer = EXS_LittleEndianImplicit,
173 const E_EncodingType enctype = EET_UndefinedLength);
190 virtual OFBool
canWriteXfer(
const E_TransferSyntax newXfer,
191 const E_TransferSyntax oldXfer);
207 const E_TransferSyntax ixfer,
208 const E_GrpLenEncoding glenc = EGL_noChange,
209 const Uint32 maxReadLength = DCM_MaxReadLength);
220 const E_TransferSyntax oxfer,
221 const E_EncodingType enctype,
230 const size_t flags = 0);
241 const E_TransferSyntax oxfer,
242 const E_EncodingType enctype,
278 OFBool replaceOld = OFFalse,
279 OFBool checkInsertOrder = OFFalse);
304 const OFBool intoSub);
324 virtual DcmElement *
remove(
const unsigned long num);
346 virtual OFBool
isEmpty(
const OFBool normalize = OFTrue);
383 E_SearchMode mode = ESM_fromHere,
384 OFBool searchIntoSub = OFTrue );
424 const E_PaddingEncoding padenc = EPD_noChange,
425 const E_TransferSyntax xfer = EXS_Unknown,
426 const E_EncodingType enctype = EET_ExplicitLength,
427 const Uint32 padlen = 0,
428 const Uint32 subPadlen = 0,
429 Uint32 instanceLength = 0);
439 OFBool searchIntoSub = OFFalse);
449 OFBool searchIntoSub = OFFalse);
464 const OFBool searchIntoSub = OFFalse,
465 const OFBool createCopy = OFFalse);
489 const OFBool searchIntoSub = OFFalse);
509 const unsigned long pos = 0,
510 const OFBool searchIntoSub = OFFalse);
527 const OFBool searchIntoSub = OFFalse);
540 const unsigned long pos = 0,
541 const OFBool searchIntoSub = OFFalse);
554 unsigned long *count = NULL,
555 const OFBool searchIntoSub = OFFalse);
568 const unsigned long pos = 0,
569 const OFBool searchIntoSub = OFFalse);
581 const Uint16 *&value,
582 unsigned long *count = NULL,
583 const OFBool searchIntoSub = OFFalse);
596 const unsigned long pos = 0,
597 const OFBool searchIntoSub = OFFalse);
609 const Sint16 *&value,
610 unsigned long *count = NULL,
611 const OFBool searchIntoSub = OFFalse);
624 const unsigned long pos = 0,
625 const OFBool searchIntoSub = OFFalse);
637 const Uint32 *&value,
638 unsigned long *count = NULL,
639 const OFBool searchIntoSub = OFFalse);
652 const unsigned long pos = 0,
653 const OFBool searchIntoSub = OFFalse);
665 const Sint32 *&value,
666 unsigned long *count = NULL,
667 const OFBool searchIntoSub = OFFalse);
680 const unsigned long pos = 0,
681 const OFBool searchIntoSub = OFFalse);
694 const unsigned long pos = 0,
695 const OFBool searchIntoSub = OFFalse);
707 const Float32 *&value,
708 unsigned long *count = NULL,
709 const OFBool searchIntoSub = OFFalse);
722 const unsigned long pos = 0,
723 const OFBool searchIntoSub = OFFalse);
735 const Float64 *&value,
736 unsigned long *count = NULL,
737 const OFBool searchIntoSub = OFFalse);
751 const OFBool searchIntoSub = OFFalse,
752 const OFBool createCopy = OFFalse);
767 const signed long itemNum = 0,
768 const OFBool createCopy = OFFalse);
787 const signed long itemNum = 0);
804 const OFBool replaceOld = OFTrue);
815 const OFBool allOccurrences = OFFalse,
816 const OFBool searchIntoSub = OFFalse);
825 const signed long itemNum);
840 const OFBool replaceOld = OFTrue);
851 const OFBool replaceOld = OFTrue);
863 const unsigned long count,
864 const OFBool replaceOld = OFTrue);
877 const unsigned long pos = 0,
878 const OFBool replaceOld = OFTrue);
890 const unsigned long count,
891 const OFBool replaceOld = OFTrue);
904 const unsigned long pos = 0,
905 const OFBool replaceOld = OFTrue);
917 const unsigned long count,
918 const OFBool replaceOld = OFTrue);
931 const unsigned long pos = 0,
932 const OFBool replaceOld = OFTrue);
945 const unsigned long pos = 0,
946 const OFBool replaceOld = OFTrue);
959 const unsigned long pos = 0,
960 const OFBool replaceOld = OFTrue);
973 const unsigned long pos = 0,
974 const OFBool replaceOld = OFTrue);
987 const OFBool replaceOld = OFTrue);
1003 const signed long itemNum = -2);
1043 const E_TransferSyntax xfer,
1066 const Uint32 newLength,
1067 const E_TransferSyntax xfer,
1068 const E_GrpLenEncoding glenc,
1069 const Uint32 maxReadLength = DCM_MaxReadLength);
1107 OFBool searchIntoSub );
1115 static OFBool
foundVR(
const Uint8* atposition);
1137 const Uint32 length,
1150 const Uint32 length = 0);
1159 const Uint32 length = 0);
virtual OFBool isAffectedBySpecificCharacterSet() const
check if this object is affected by SpecificCharacterSet at any nesting level.
a class representing a list of DICOM elements in which each element has a different tag and elements ...
class maintaining a attribute tag (group and element number)
E_TransferSyntax checkTransferSyntax(DcmInputStream &inStream)
This function reads the first 6 bytes from the input stream and determines the transfer syntax which ...
OFCondition findAndGetOFStringArray(const DcmTagKey &tagKey, OFString &value, const OFBool searchIntoSub=OFFalse)
find element and get value as a C++ string (all components).
OFCondition findAndGetUint16(const DcmTagKey &tagKey, Uint16 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as an unsigned 16-bit integer.
DcmPrivateTagCache privateCreatorCache
cache for private creator tags and names
OFCondition findAndGetSint16Array(const DcmTagKey &tagKey, const Sint16 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of signed 16-bit integers.
abstract base class for all DICOM elements
class representing a DICOM Sequence of Items (SQ).
OFCondition findAndGetElements(const DcmTagKey &tagKey, DcmStack &resultStack)
find all elements matching a particular tag and return references to them on a stack.
DcmItem()
default constructor
OFCondition putAndInsertFloat64(const DcmTag &tag, const Float64 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
virtual OFCondition nextObject(DcmStack &stack, const OFBool intoSub)
this method enables a stack based, depth-first traversal of a complete hierarchical DICOM dataset (th...
virtual OFCondition copyFrom(const DcmObject &rhs)
Virtual object copying.
OFCondition putAndInsertUint16Array(const DcmTag &tag, const Uint16 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
OFCondition putAndInsertUint32(const DcmTag &tag, const Uint32 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
OFCondition findAndGetSint32(const DcmTagKey &tagKey, Sint32 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as a signed 32-bit integer.
OFCondition putAndInsertSint16Array(const DcmTag &tag, const Sint16 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
virtual Uint32 calcElementLength(const E_TransferSyntax xfer, const E_EncodingType enctype)
calculate the length of this DICOM element when encoded with the given transfer syntax and the given ...
OFCondition findAndGetFloat64Array(const DcmTagKey &tagKey, const Float64 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of 64-bit floating point values.
virtual DcmObject * clone() const
clone method
OFCondition putAndInsertUint16(const DcmTag &tag, const Uint16 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
virtual OFCondition write(DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
write object to a stream
OFCondition putAndInsertString(const DcmTag &tag, const char *value, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
this class encapsulates an attribute tag (group, element) and a VR.
OFCondition findAndGetUint8(const DcmTagKey &tagKey, Uint8 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as an unsigned 8-bit integer.
virtual Uint32 getLength(const E_TransferSyntax xfer=EXS_LittleEndianImplicit, const E_EncodingType enctype=EET_UndefinedLength)
calculate the value length (without attribute tag, VR and length field) of this DICOM element when en...
OFCondition searchSubFromHere(const DcmTagKey &tag, DcmStack &resultStack, OFBool searchIntoSub)
helper function for search().
This class implements a buffering mechanism that is used when writing large elements that reside in f...
base class for output streams.
virtual OFCondition read(DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)
This function reads the information of all attributes which are captured in the input stream and capt...
OFCondition findAndGetFloat64(const DcmTagKey &tagKey, Float64 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as a 64-bit floating point.
Abstract base class for most classes in module dcmdata.
OFCondition findAndGetUint8Array(const DcmTagKey &tagKey, const Uint8 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of unsigned 8-bit integers.
OFCondition findAndGetString(const DcmTagKey &tagKey, const char *&value, const OFBool searchIntoSub=OFFalse)
find element and get value as a reference to a C string.
OFBool tagExists(const DcmTagKey &key, OFBool searchIntoSub=OFFalse)
check if an element with the given attribute tag exists in the dataset
OFCondition findAndGetFloat32(const DcmTagKey &tagKey, Float32 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as a 32-bit floating point.
virtual DcmEVR ident() const
get type identifier
virtual void print(STD_NAMESPACE ostream &out, const size_t flags=0, const int level=0, const char *pixelFileName=NULL, size_t *pixelCounter=NULL)
print all elements of the item to a stream
static OFBool foundVR(const Uint8 *atposition)
helper function that interprets the given pointer as a pointer to an array of two characters and chec...
OFCondition findOrCreateSequenceItem(const DcmTag &seqTag, DcmItem *&item, const signed long itemNum=0)
looks up the given sequence in the current dataset and returns the given item.
OFCondition findAndGetUint32(const DcmTagKey &tagKey, Uint32 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as an unsigned 32-bit integer.
OFCondition putAndInsertFloat32(const DcmTag &tag, const Float32 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
void checkAndUpdateVR(DcmItem &item, DcmTag &tag)
check whether the given tag requires some special handling regarding the VR (i.e. ...
OFCondition findAndGetFloat32Array(const DcmTagKey &tagKey, const Float32 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of 32-bit floating point values.
OFCondition findAndDeleteSequenceItem(const DcmTagKey &seqTagKey, const signed long itemNum)
looks up the given sequence in the current dataset and deletes the given item.
virtual OFCondition writeSignatureFormat(DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)
special write method for creation of digital signatures
virtual OFBool isLeaf() const
check if this element is a leaf node in a dataset tree.
this class implements a cache of Private Creator elements and corresponding reserved tag numbers...
OFCondition findAndDeleteElement(const DcmTagKey &tagKey, const OFBool allOccurrences=OFFalse, const OFBool searchIntoSub=OFFalse)
find element, remove it from the dataset and free the associated memory.
OFCondition putAndInsertSint16(const DcmTag &tag, const Sint16 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
OFCondition findAndGetSequenceItem(const DcmTagKey &seqTagKey, DcmItem *&item, const signed long itemNum=0, const OFBool createCopy=OFFalse)
looks up and returns a given sequence item, if it exists.
virtual OFCondition clear()
clear (remove) attribute value
OFCondition putAndInsertUint8Array(const DcmTag &tag, const Uint8 *value, const unsigned long count, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
OFCondition findAndGetElement(const DcmTagKey &tagKey, DcmElement *&element, const OFBool searchIntoSub=OFFalse, const OFBool createCopy=OFFalse)
find element and get a pointer to it (or copy it).
this class manages a stack of pointers to DcmObject instances.
virtual OFCondition loadAllDataIntoMemory()
this method loads all attribute values maintained by this object and all sub-objects (in case of a co...
OFCondition findAndGetSint32Array(const DcmTagKey &tagKey, const Sint32 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of signed 32-bit integers.
virtual OFCondition writeXML(STD_NAMESPACE ostream &out, const size_t flags=0)
write object in XML format
OFCondition findAndGetSint16(const DcmTagKey &tagKey, Sint16 &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as a signed 16-bit integer.
virtual OFCondition verify(const OFBool autocorrect=OFFalse)
check the currently stored element value
OFCondition findAndGetUint32Array(const DcmTagKey &tagKey, const Uint32 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of unsigned 32-bit integers.
virtual OFCondition insert(DcmElement *elem, OFBool replaceOld=OFFalse, OFBool checkInsertOrder=OFFalse)
insert a new element into the list of elements maintained by this item.
virtual void transferInit()
initialize the transfer state of this object.
OFCondition findAndGetOFString(const DcmTagKey &tagKey, OFString &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as a C++ string (only one component).
OFCondition findAndGetLongInt(const DcmTagKey &tagKey, long int &value, const unsigned long pos=0, const OFBool searchIntoSub=OFFalse)
find element and get value as a (signed) long integer.
OFCondition findAndGetUint16Array(const DcmTagKey &tagKey, const Uint16 *&value, unsigned long *count=NULL, const OFBool searchIntoSub=OFFalse)
find element and get value as an array of unsigned 16-bit integers.
virtual OFBool isEmpty(const OFBool normalize=OFTrue)
check if this item is empty
virtual OFBool canWriteXfer(const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer)
check if this DICOM object can be encoded in the given transfer syntax.
DcmList * elementList
the list of elements maintained by this object
virtual OFBool containsUnknownVR() const
returns true if the object contains an element with Unknown VR at any nesting level ...
OFCondition insertEmptyElement(const DcmTag &tag, const OFBool replaceOld=OFTrue)
create a new element (with no value) and insert it into the dataset/item.
virtual OFBool containsExtendedCharacters(const OFBool checkAllStrings=OFFalse)
check if this object contains non-ASCII characters at any nesting level
OFBool tagExistsWithValue(const DcmTagKey &key, OFBool searchIntoSub=OFFalse)
check if an element with the given attribute tag exists in the dataset and has a non-empty value (i...
OFBool lastElementComplete
flag used during suspended I/O.
virtual OFCondition search(const DcmTagKey &xtag, DcmStack &resultStack, E_SearchMode mode=ESM_fromHere, OFBool searchIntoSub=OFTrue)
a complex, stack-based, hierarchical search method.
OFCondition findAndInsertCopyOfElement(const DcmTagKey &tagKey, DcmItem *destItem, const OFBool replaceOld=OFTrue)
find element, create a copy and insert it into the given destination dataset.
OFCondition findAndGetSequence(const DcmTagKey &seqTagKey, DcmSequenceOfItems *&sequence, const OFBool searchIntoSub=OFFalse, const OFBool createCopy=OFFalse)
looks up and returns a given sequence.
virtual DcmObject * nextInContainer(const DcmObject *obj)
this method is only used in container classes, that is, DcmItem and DcmSequenceOfItems.
offile_off_t fStartPosition
used during reading.
a simple string class that implements a subset of std::string.
OFCondition putAndInsertSint32(const DcmTag &tag, const Sint32 value, const unsigned long pos=0, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
virtual void transferEnd()
finalize the transfer state of this object.
OFCondition readSubElement(DcmInputStream &inStream, DcmTag &newTag, const Uint32 newLength, const E_TransferSyntax xfer, const E_GrpLenEncoding glenc, const Uint32 maxReadLength=DCM_MaxReadLength)
This function creates a new DcmElement object on the basis of the newTag and newLength information wh...
OFCondition readTagAndLength(DcmInputStream &inStream, const E_TransferSyntax xfer, DcmTag &tag, Uint32 &length, Uint32 &bytesRead)
This function reads tag and length information from inStream and returns this information to the call...
virtual OFCondition computeGroupLengthAndPadding(const E_GrpLenEncoding glenc, const E_PaddingEncoding padenc=EPD_noChange, const E_TransferSyntax xfer=EXS_Unknown, const E_EncodingType enctype=EET_ExplicitLength, const Uint32 padlen=0, const Uint32 subPadlen=0, Uint32 instanceLength=0)
This function takes care of group length and padding elements in the current element list according t...
virtual ~DcmItem()
destructor
OFCondition insertSequenceItem(const DcmTag &seqTag, DcmItem *item, const signed long itemNum=-2)
looks up the given sequence in the current dataset and inserts the given item.
virtual DcmElement * getElement(const unsigned long num)
access an element from the item.
double-linked list class that maintains pointers to DcmObject instances.
virtual unsigned long card() const
get cardinality of this item
DcmItem & operator=(const DcmItem &obj)
assignment operator.
OFCondition putAndInsertOFStringArray(const DcmTag &tag, const OFString &value, const OFBool replaceOld=OFTrue)
create a new element, put specified value to it and insert the element into the dataset/item.
General purpose class for condition codes.
virtual unsigned long getVM()
get value multiplicity