⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsrtypes.h

📁 转化为DIB位图再显示出来的dicom文件C++代码
💻 H
📖 第 1 页 / 共 5 页
字号:
    static const char *numberToString(const size_t number,                                      char *stringValue);    /** convert string to unsigned integer number     ** @param  stringValue  character string to be converted     ** @return resulting unsigned integer number if successful, 0 otherwise     */    static size_t stringToNumber(const char *stringValue);    /** convert character string to print string.     *  This method is used to convert character strings for text "print" output.  Newline characters     *  '\n' are replaced by "\\n", return characters '\r' by "\\r", etc.     ** @param  sourceString  source string to be converted     *  @param  printString   reference to character string where the result should be stored     ** @return reference to resulting 'printString' (might be empty if 'sourceString' was empty)     */    static const OFString &convertToPrintString(const OFString &sourceString,                                                OFString &printString);    /** convert character string to HTML/XML mnenonic string.     *  Characters with special meaning for HTML/XML (e.g. '<' and '&') are replace by the     *  corresponding mnenonics (e.g. "&lt;" and "&amp;").  If flag 'convertNonASCII' is OFTrue     *  all characters > #127 are also converted (useful if only HTML 3.2 is supported which does     *  not allow to specify the character set).     ** @param  sourceString     source string to be converted     *  @param  markupString     reference to character string where the result should be stored     *  @param  convertNonASCII  convert non-ASCII characters (> #127) to numeric value (&#nnn;)     *                           if OFTrue     *  @param  newlineAllowed   optional flag indicating whether newlines are allowed or not.     *                           If they are allowed the text "<br>" is used, "&para;" otherwise.     *                           The following combinations are accepted: LF, CR, LF CR, CF LF.     *  @param  xmlMode          convert to XML markup string if OFTrue, HTML string otherwise.     *                           LF and CR are encoded as "&#10;" and "&#13;" in XML mode, the     *                           flag 'newlineAllowed' has no meaning in this case.     ** @return reference to resulting 'markupString' (might be empty if 'sourceString' was empty)     */    static const OFString &convertToMarkupString(const OFString &sourceString,                                                 OFString &markupString,                                                 const OFBool convertNonASCII = OFFalse,                                                 const OFBool newlineAllowed = OFFalse,                                                 const OFBool xmlMode = OFFalse);    /** check string for valid UID format.     *  The string should be non-empty and consist only of interger numbers separated by "." where     *  the first and the last character of the string are always figures (0..9). Example: 1 or 1.2.3.     *  Please note that this test is not as strict as specified for value representation UI in the     *  DICOM standard (e.g. regarding even length padding or leading '0' for the numbers).     ** @param  stringValue  character string to be checked     ** @result OFTrue if 'string' conforms to UID format, OFFalse otherwise     */    static OFBool checkForValidUIDFormat(const OFString &stringValue);    /** create specified SR IOD content relationship contraint checker object.     *  Please note that the created object has to be deleted by the caller.     ** @param  documentType  associated SR document type for which the checker object is created     ** @return pointer to new IOD checker object if successful, NULL if document type is not supported     */    static DSRIODConstraintChecker *createIODConstraintChecker(const E_DocumentType documentType);    /** create specified document tree node.     *  This is a shortcut and the only location where document tree nodes are created.     *  It facilitates the introduction of new relationship/value types and the maintenance.     ** @param  relationshipType  relationship type of the node to be created     *  @param  valueType         value type of the node to be created     ** @return pointer to the new document tree nodeif successful, NULL otherwise     */    static DSRDocumentTreeNode *createDocumentTreeNode(const E_RelationshipType relationshipType,                                                       const E_ValueType valueType);    /** check if this element contains non-ASCII characters.     *  @return true if element contains non-ASCII characters, false otherwise     */    static OFBool elementContainsExtendedCharacters(DcmElement &elem);    /** check if this string contains non-ASCII characters.     *  @return true if element contains non-ASCII characters, false otherwise     */    static OFBool stringContainsExtendedCharacters(const OFString &s);  // --- DICOM data structure access functions ---    /** add given element to the dataset.     *  The element is only added if 'result' is EC_Normal and the 'delem' pointer is not NULL.     ** @param  result   reference to status variable (checked before adding and updated afterwards!)     *  @param  dataset  reference to DICOM dataset to which the element should be added     *  @param  delem    pointer to DICOM element which should be added     ** @return current value of 'result', EC_Normal if successful, an error code otherwise     */    static OFCondition addElementToDataset(OFCondition &result,                                           DcmItem &dataset,                                           DcmElement *delem);    /** remove given attribute from the sequence.     *  All occurrences of the attribute in all items of the sequence are removed.     ** @param  sequence  reference to DICOM sequence from which the attribute should be removed     *  @param  tagKey    DICOM tag specifying the attribute which should be removed     */    static void removeAttributeFromSequence(DcmSequenceOfItems &sequence,                                            const DcmTagKey &tagKey);    /** get element from dataset     ** @param  dataset  reference to DICOM dataset from which the element should be retrieved.     *                   (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)     *  @param  delem    reference to DICOM element which should be retrieved.  The return value     *                   is also stored in this parameter.     ** @return status, EC_Normal if successful, an error code otherwise     */    static OFCondition getElementFromDataset(DcmItem &dataset,                                             DcmElement &delem);    /** get sequence from dataset.     *  This method has been introduced in addition to the above one since in this case all     *  items contained in the sequence are also stored in the resulting parameter.     ** @param  dataset  reference to DICOM dataset from which the element should be retrieved.     *                   (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)     *  @param  dseq     reference to DICOM sequence which should be retrieved.  The return value     *                   is also stored in this parameter.     ** @return status, EC_Normal if successful, an error code otherwise     */    static OFCondition getSequenceFromDataset(DcmItem &dataset,                                              DcmSequenceOfItems &dseq);    /** get string value from element     ** @param  delem  DICOM element from which the string value should be retrieved     ** @return pointer to character string if successful, NULL otherwise     */    static const char *getStringValueFromElement(const DcmElement &delem);    /** get string value from element     ** @param  delem        reference to DICOM element from which the string value should be retrieved     *  @param  stringValue  reference to character string where the result should be stored     ** @return reference character string if successful, empty string otherwise     */    static const OFString &getStringValueFromElement(const DcmElement &delem,                                                     OFString &stringValue);    /** get string value from element and convert to "print" format     ** @param  delem        reference to DICOM element from which the string value should be retrieved     *  @param  stringValue  reference to character string where the result should be stored     ** @return reference character string if successful, empty string otherwise     */    static const OFString &getPrintStringFromElement(const DcmElement &delem,                                                     OFString &stringValue);    /** get string value from element and convert to HTML/XML     ** @param  delem            reference to DICOM element from which the string value should be retrieved     *  @param  stringValue      reference to character string where the result should be stored     *  @param  convertNonASCII  convert non-ASCII characters (> #127) to numeric value (&#nnn;) if OFTrue     ** @return reference character string if successful, empty string otherwise     */    static const OFString &getMarkupStringFromElement(const DcmElement &delem,                                                      OFString &stringValue,                                                      const OFBool convertNonASCII = OFFalse);    /** get string value from dataset     ** @param  dataset      reference to DICOM dataset from which the string should be retrieved.     *                       (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)     *  @param  tagKey       DICOM tag specifying the attribute from which the string should be retrieved     *  @param  stringValue  reference to character string in which the result should be stored.     *                       (This parameter is automatically cleared if the tag could not be found.)     ** @return status, EC_Normal if successful, an error code otherwise     */    static OFCondition getStringValueFromDataset(DcmItem &dataset,                                                 const DcmTagKey &tagKey,                                                 OFString &stringValue);    /** put string value to dataset     ** @param  dataset      reference to DICOM dataset to which the string should be put.     *  @param  tag          DICOM tag specifying the attribute to which the string should be put     *  @param  stringValue  character string specifying the value to be set     *  @param  allowEmpty   allow empty element to be inserted if OFTrue.     *                       Do not insert empty element otherwise.     ** @return status, EC_Normal if successful, an error code otherwise     */    static OFCondition putStringValueToDataset(DcmItem &dataset,                                               const DcmTag &tag,                                               const OFString &stringValue,                                               const OFBool allowEmpty = OFTrue);    /** check element value for correct value multipicity and type.     *  If the 'stream' parameter is valid a warning message is printed automatically if something     *  is wrong.     ** @param  delem       DICOM element to be checked     *  @param  vm          value multiplicity (valid value: "1", "1-n", "2", "2-2n"),     *                      interpreted as cardinality (number of items) for sequences     *  @param  type        value type (valid value: "1", "2", something else)     *  @param  stream      optional output stream used for warning messages     *  @param  searchCond  optional flag indicating the status of a previous 'search' function call     *  @param  moduleName  optional module name to be printed (default: "SR document" if NULL)     ** @return OFTrue if element value is correct, OFFalse otherwise     */    static OFBool checkElementValue(DcmElement &delem,                                    const OFString &vm,                                    const OFString &type,                                    OFConsole *stream = NULL,                                    const OFCondition &searchCond = EC_Normal,                                    const char *moduleName = NULL);    /** get element from dataset and check it for correct value multipicity and type.     *  If the 'stream' parameter is valid a warning message is printed automatically if something     *  is wrong.  This functions calls the above one to check the element value.     ** @param  dataset     reference to DICOM dataset from which the element should be retrieved.     *                      (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)     *  @param  delem       DICOM element used to store the value     *  @param  vm          value multiplicity (valid value: "1", "1-n", "2", "2-2n"),     *                      interpreted as cardinality (number of items) for sequences     *  @param  type        value type (valid value: "1", "2", something else which is not checked)     *  @param  stream      optional output stream used for warning messages     *  @param  moduleName  optional module name to be printed (default: "SR document" if NULL)     ** @return status, EC_Normal if element could be retrieved and value is correct, an error code otherwise     */    static OFCondition getAndCheckElementFromDataset(DcmItem &dataset,                                                     DcmElement &delem,                                                     const OFString &vm,                                                     const OFString &type,                                                     OFConsole *stream = NULL,                                                     const char *moduleName = NULL);    /** get string value from dataset and check it for correct value multipicity and type.     *  If the 'stream' parameter is valid a warning message is printed automatically if something     *  is wrong.  This functions calls the above one to check the element value.     ** @param  dataset      reference to DICOM dataset from which the element should be retrieved.     *                       (Would be 'const' if the methods from 'dcmdata' would also be 'const'.)     *  @param  tagKey       DICOM tag specifying the attribute from which the string should be retrieved     *  @param  stringValue  reference to character string in which the result should be stored.     *                       (This parameter is automatically cleared if the tag could not be found.)     *  @param  vm           value multiplicity (valid value: "1", "1-n", "2", "2-2n"),     *                       interpreted as cardinality (number of items) for sequences     *  @param  type         value type (valid value: "1", "2", something else which is not checked)     *  @param  stream       optional output stream used for warning messages     *  @param  moduleName   optional module name to be printed (default: "SR document" if NULL)     ** @return status, EC_Normal if element could be retrieved and value is correct, an error code otherwise     */    static OFCondition getAndCheckStringValueFromDataset(DcmItem &dataset,                                                         const DcmTagKey &tagKey,                                                         OFString &stringValue,                                                         const OFString &vm,                                                         const OFString &type,                                                         OFConsole *stream = NULL,                                                         const char *moduleName = NULL);  // --- output functions ---    /** print a message     ** @param  stream   output stream to which the warning message is printed     *  @param  message  message to be printed     */    static void printMessage(OFConsole *stream,                             const char *message);    /** print a warning message.     *  The prefix 'DCMSR - Warning: ' is automatically added to the message text.     ** @param  stream   output stream to which the warning message is printed     *  @param  message  warning message to be printed     */    static void printWarningMessage(OFConsole *stream,                                    const char *message);    /** print a error message.     *  The prefix 'DCMSR - Error: ' is automatically added to the message text.     ** @param  stream   output stream to which the error message is printed     *  @param  message  error message to be printed     */    static void printErrorMessage(OFConsole *stream,                                  const char *message);    /** print the warning message that the current content item is invalid/incomplete.     *  The value type (for DEBUG mode also the node ID) is added if the 'node' if specified.     ** @param  stream    output stream to which the warning message is printed (no message if NULL)     *  @param  action    text describing the current action (e.g. 'Reading'), 'Processing' if NULL     *  @param  node      pointer to document tree node for which the message should be printed     *  @param  location  position of the affected content item (e.g. '1.2.3', not printed if NULL)     */    static void printInvalidContentItemMessage(OFConsole *stream,                                               const char *action,                                               const DSRDocumentTreeNode *node,                                               const char *location = NULL);    /** print an error message for the current content item.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -