Why could not I read again DICOM SR that I created?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
kstn_hut_hat
Posts: 28
Joined: Mon, 2016-05-09, 08:32

Why could not I read again DICOM SR that I created?

#1 Post by kstn_hut_hat »

Hi everyone,
I created DICOM SR that contain Value Type TEXT. It had (0040,a160) Text Value - ございます.
Then I read it again. But not success.
Why?

Thank for supporting!

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Why could not I read again DICOM SR that I created?

#2 Post by J. Riesmeier »

I'm sorry but without more details I'll not be able to help you.

E.g., I would need to know:
  • Which version of the DCMTK you use.
  • How you've created the SR document.
  • What do you mean by "Then I read it again. But not success.".
  • What is the output of "dsrdump" on this SR document (in debug mode)...
First of all, I would recommend that you try it again with the latest DCMTK snapshot.

kstn_hut_hat
Posts: 28
Joined: Mon, 2016-05-09, 08:32

Re: Why could not I read again DICOM SR that I created?

#3 Post by kstn_hut_hat »

J. Riesmeier wrote:I'm sorry but without more details I'll not be able to help you.

E.g., I would need to know:
  • Which version of the DCMTK you use.
  • How you've created the SR document.
  • What do you mean by "Then I read it again. But not success.".
  • What is the output of "dsrdump" on this SR document (in debug mode)...
First of all, I would recommend that you try it again with the latest DCMTK snapshot.
My application uses dctm version 3.6.0
Step 1: I create a DICOM SR that contains content item "TEXT". This content item has value "ございます" (Japanese letters)
Code

Code: Select all

std::string input = "ございます"; // If I change input by my name or any string ("VietNam", "DCMTK" ,...)
std::string output;
DSRDocument * dcmSRDoc = new DSRDocument();
dcmSRDoc->createNewDocument(DSRTypes::DT_EnhancedSR);

// Init dcmSRDoc
// some codes here

dcmSRDoc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121206", "DCM", CodeMeaning);
dcmSRDoc->getTree().getCurrentContentItem().setCodeValue(DSRCodedEntryValue("121206", "DCM", CodeMeaning1);

// Add Content item TEXT
dcmSRDoc->getTree().addContentItem(DSRTypes::RT_hasProperties, DSRTypes::VT_Text, DSRTypes::AM_belowCurrent);
dcmSRDoc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121230", "DCM", "TEXT INPUT"));
// Encode input variable => output
Set Text Value
dcmSRDoc->getTree().getCurrentContentItem().setStringValue(output);
Step 2: Read the above DICOM SR.

Code: Select all

DcmFileFormat* FileFormat = new DcmFileFormat();
FileFormat->loadFile(DICOMSRFilePath);
DSRDocument* pDICOMSRDoc = new DSRDocument();
DcmDataset *dset = FileFormat ->getDataset();
OFCondition cond = pDICOMSRDoc->read(*dset, 0);
The cond variable is OF_error (Text: Invalid value)
Therefore, I could not get the information from the DICOM SR if I input the Japanese letters

J. Riesmeier
DCMTK Developer
Posts: 2503
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Why could not I read again DICOM SR that I created?

#4 Post by J. Riesmeier »

Following my previous posting, I would like to ask you to try the current DCMTK snapshot first. This version also allows you to disable the VR checker by calling "dcmEnableVRCheckerForStringValues.set(OFFalse)". The following excerpt is from "dcmtk/dcmdata/dcbytstr.h":

Code: Select all

/** This flag defines whether the VR checker is actually used by the various
 *  checkStringValue() methods.  Since this checker is currently limited to
 *  ASCII and Latin-1, and the detection of the character set might fail for
 *  incorrectly encoded DICOM datasets, this check can be disabled globally.
 *  Please note, however, that other checks (i.e. VM and max. value length)
 *  are still performed if the optional parameters are set accordingly.
 *  By default, the VR checker is enabled (value: "OFTrue").
 */
extern DCMTK_DCMDATA_EXPORT OFGlobal<OFBool> dcmEnableVRCheckerForStringValues;  /* default: OFTrue */

kstn_hut_hat
Posts: 28
Joined: Mon, 2016-05-09, 08:32

Re: Why could not I read again DICOM SR that I created?

#5 Post by kstn_hut_hat »

J. Riesmeier wrote:Following my previous posting, I would like to ask you to try the current DCMTK snapshot first. This version also allows you to disable the VR checker by calling "dcmEnableVRCheckerForStringValues.set(OFFalse)". The following excerpt is from "dcmtk/dcmdata/dcbytstr.h":

Code: Select all

/** This flag defines whether the VR checker is actually used by the various
 *  checkStringValue() methods.  Since this checker is currently limited to
 *  ASCII and Latin-1, and the detection of the character set might fail for
 *  incorrectly encoded DICOM datasets, this check can be disabled globally.
 *  Please note, however, that other checks (i.e. VM and max. value length)
 *  are still performed if the optional parameters are set accordingly.
 *  By default, the VR checker is enabled (value: "OFTrue").
 */
extern DCMTK_DCMDATA_EXPORT OFGlobal<OFBool> dcmEnableVRCheckerForStringValues;  /* default: OFTrue */
Thank pro.
I will try to do it

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 1 guest