35 #include "dcmtk/config/osconfig.h" 37 #include "dcmtk/ofstd/ofglobal.h" 38 #include "dcmtk/dcmdata/dcerror.h" 39 #include "dcmtk/dcmdata/dcxfer.h" 40 #include "dcmtk/dcmdata/dctag.h" 41 #include "dcmtk/dcmdata/dcstack.h" 52 const Uint32 DCM_MaxReadLength = 4096;
55 const Uint32 DCM_TagInfoLength = 12;
58 const Uint32 DCM_OptPrintLineLength = 70;
61 const Uint32 DCM_OptPrintValueLength = 40;
64 const Uint32 DCM_OptPrintAttributeNameLength = 35;
229 virtual DcmEVR
ident()
const = 0;
254 virtual OFBool
isLeaf()
const = 0;
263 virtual void print(STD_NAMESPACE ostream &out,
264 const size_t flags = 0,
266 const char *pixelFileName = NULL,
267 size_t *pixelCounter = NULL) = 0;
317 virtual unsigned long getVM() = 0;
330 const E_EncodingType enctype) = 0;
339 virtual Uint32
getLength(
const E_TransferSyntax xfer = EXS_LittleEndianImplicit,
340 const E_EncodingType enctype = EET_UndefinedLength) = 0;
347 virtual OFBool
canWriteXfer(
const E_TransferSyntax newXfer,
348 const E_TransferSyntax oldXfer) = 0;
360 const E_TransferSyntax ixfer,
361 const E_GrpLenEncoding glenc = EGL_noChange,
362 const Uint32 maxReadLength = DCM_MaxReadLength) = 0;
372 const E_TransferSyntax oxfer,
373 const E_EncodingType enctype,
382 const size_t flags = 0);
392 const E_TransferSyntax oxfer,
393 const E_EncodingType enctype,
421 virtual OFBool
isEmpty(
const OFBool normalize = OFTrue);
462 const OFBool intoSub);
487 E_SearchMode mode = ESM_fromHere,
488 OFBool searchIntoSub = OFTrue);
542 const unsigned long printedLength = 0xffffffff ,
559 const char *info = NULL,
561 const OFBool isInfo = OFTrue);
572 const E_TransferSyntax oxfer);
581 const E_TransferSyntax oxfer,
582 Uint32 &writtenBytes)
const;
651 : dcmobj_(dcmobj), flags_(flags), level_(level)
687 static inline STD_NAMESPACE ostream& operator<<(STD_NAMESPACE ostream &stream,
DcmObject::PrintHelper obj)
689 obj.dcmobj_.
print(stream, obj.flags_, obj.level_);
virtual OFCondition writeXML(STD_NAMESPACE ostream &out, const size_t flags=0)
write object in XML format to a stream
virtual OFBool canWriteXfer(const E_TransferSyntax newXfer, const E_TransferSyntax oldXfer)=0
check if this DICOM object can be encoded in the given transfer syntax.
class maintaining a attribute tag (group and element number)
static OFCondition writeTag(DcmOutputStream &outStream, const DcmTag &tag, const E_TransferSyntax oxfer)
static helper function that writes a given attribute tag to a binary output stream using the byte ord...
DcmObject(const DcmTag &tag, const Uint32 len=0)
constructor.
void setTransferredBytes(Uint32 val)
set the number of transferred bytes for this object during serialization/deserialization ...
virtual OFCondition read(DcmInputStream &inStream, const E_TransferSyntax ixfer, const E_GrpLenEncoding glenc=EGL_noChange, const Uint32 maxReadLength=DCM_MaxReadLength)=0
read object from a stream.
const char * getTagName()
returns name of attribute tag.
virtual OFBool isSignable() const
returns true if the current object may be included in a digital signature
DcmTag Tag
the DICOM attribute tag and VR for this object
virtual OFCondition verify(const OFBool autocorrect=OFFalse)=0
check the currently stored element value
virtual OFCondition writeTagAndLength(DcmOutputStream &outStream, const E_TransferSyntax oxfer, Uint32 &writtenBytes) const
write tag, VR and length field to the given output stream
void setTagVR(DcmEVR vr)
set the VR for this attribute
virtual OFCondition copyFrom(const DcmObject &rhs)=0
Virtual object copying.
virtual OFCondition write(DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)=0
write object to a stream (abstract)
OFCondition errorFlag
error flag for this object.
DcmVR getVR() const
returns VR object by value
this class encapsulates an attribute tag (group, element) and a VR.
This class implements a buffering mechanism that is used when writing large elements that reside in f...
E_TransferState getTransferState() const
return the current transfer state of this object during serialization/deserialization ...
virtual OFCondition setVR(DcmEVR)
assign a new Value Representation (VR) to this object.
base class for output streams.
Uint16 getETag() const
return the element number of the attribute tag for this object
virtual void transferEnd(void)
finalize the transfer state of this object.
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 OFBool isEmpty(const OFBool normalize=OFTrue)
check if this object is empty
Abstract base class for most classes in module dcmdata.
Uint32 Length
the length of this attribute as read from stream, may be undefined length
virtual void printInfoLine(STD_NAMESPACE ostream &out, const size_t flags, const int level=0, const char *info=NULL, DcmTag *tag=NULL, const OFBool isInfo=OFTrue)
print given text with element information.
Uint16 getGTag() const
returns tag group
E_TransferState transferState() const
return the current transfer (read/write) state of this object.
virtual OFCondition loadAllDataIntoMemory()=0
this method loads all attribute values maintained by this object and all sub-objects (in case of a co...
DcmVR setVR(const DcmVR &avr)
set specific VR
virtual OFCondition clear()=0
clear (remove) attribute value
virtual OFBool containsUnknownVR() const
returns true if the object contains an element with Unknown VR at any nesting level ...
void setGroup(Uint16 g)
set group to given number
void printInfoLineEnd(STD_NAMESPACE ostream &out, const size_t flags, const unsigned long printedLength=0xffffffff, DcmTag *tag=NULL)
print end of the info line.
OFBool isaString() const
returns true if VR represents a string
void printInfoLineStart(STD_NAMESPACE ostream &out, const size_t flags, const int level, DcmTag *tag=NULL)
print beginning of the info line.
virtual void transferInit(void)
initialize the transfer state of this object.
Uint16 getETag() const
returns tag element
this class manages a stack of pointers to DcmObject instances.
virtual Uint32 calcElementLength(const E_TransferSyntax xfer, const E_EncodingType enctype)=0
calculate the length of this DICOM element when encoded with the given transfer syntax and the given ...
void setLengthField(Uint32 val)
set the current value of the Length field
const DcmTag & getTag() const
return const reference to the attribute tag for this object
virtual OFBool isLeaf() const =0
check if this element is a leaf node in a dataset tree.
virtual DcmObject * clone() const =0
clone method
OFBool isaString() const
check if this element is a string type, based on the VR.
const char * getTagName()
return the DICOM attribute tag name for this object.
virtual DcmEVR ident() const =0
return identifier for this class.
E_TransferState fTransferState
transfer state during read and write operations
helper class to print a DcmObject to an ostream using operator<<
virtual OFBool containsExtendedCharacters(const OFBool checkAllStrings=OFFalse)
check if this object contains non-ASCII characters
virtual OFCondition search(const DcmTagKey &xtag, DcmStack &resultStack, E_SearchMode mode=ESM_fromHere, OFBool searchIntoSub=OFTrue)
a complex, stack-based, hierarchical search method.
Uint16 getGTag() const
return the group number of the attribute tag for this object
virtual OFBool isAffectedBySpecificCharacterSet() const
check if this object is affected by SpecificCharacterSet
DcmEVR getVR() const
return the value representation assigned to this object.
virtual OFCondition writeSignatureFormat(DcmOutputStream &outStream, const E_TransferSyntax oxfer, const E_EncodingType enctype, DcmWriteCache *wcache)=0
special write method for creation of digital signatures (abstract)
virtual DcmObject * nextInContainer(const DcmObject *obj)
this method is only used in container classes derived from this class, that is, DcmItem and DcmSequen...
virtual unsigned long getVM()=0
return value multiplicity of the current object
void setTransferState(E_TransferState newState)
set the current transfer state of this object during serialization/deserialization ...
void setGTag(Uint16 gtag)
assign group tag (but not element tag) of the attribute tag for this object.
virtual Uint32 getLength(const E_TransferSyntax xfer=EXS_LittleEndianImplicit, const E_EncodingType enctype=EET_UndefinedLength)=0
calculate the value length (without attribute tag, VR and length field) of this DICOM element when en...
void printNestingLevel(STD_NAMESPACE ostream &out, const size_t flags, const int level)
print line indentation, e.g.
DcmObject & operator=(const DcmObject &obj)
copy assignment operator
virtual Uint32 getTagAndLengthSize(const E_TransferSyntax oxfer) const
return the number of bytes needed to serialize the tag, VR and length information of the current obje...
void incTransferredBytes(Uint32 val)
add to the number of transferred bytes for this object during serialization/deserialization ...
virtual ~DcmObject()
destructor
PrintHelper & operator=(PrintHelper &)
Undefined assignment operator.
DcmEVR getEVR() const
returns VR code
Uint32 getTransferredBytes() const
return the number of transferred bytes for this object during serialization/deserialization ...
Uint32 fTransferredBytes
number of bytes already read/written during transfer
Uint32 getLengthField() const
return the current value of the Length field (which is different from the functionality of the public...
Template class which allows to declare global objects that are protected by a Mutex if used in multi-...
virtual void print(STD_NAMESPACE ostream &out, const size_t flags=0, const int level=0, const char *pixelFileName=NULL, size_t *pixelCounter=NULL)=0
print object to a stream
General purpose class for condition codes.
PrintHelper(DcmObject &dcmobj, size_t flags=0, int level=0)
construct a PrintHelper