Can not save SR file: "invalid value"

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Can not save SR file: "invalid value"

#1 Post by kamil »

Hi, I follow the http://support.dcmtk.org/wiki/dcmtk/howto/mammocadsr to create a SR file, the sample works, but my code faild.

Here is my code:

Code: Select all

if (doc != NULL)
	{

		doc->createNewDocument(DSRTypes::DT_XRayRadiationDoseSR);

		doc->setPatientName("Last Name^First Name");
		doc->setPatientSex("M");
		doc->setManufacturer("OFFIS e.V.");
		doc->setReferringPhysicianName("Last Name^First Name");


		doc->getTree().addContentItem(DSRTypes::RT_isRoot, DSRTypes::VT_Container);
		doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("113701", "DCM", "X-Ray Radiation Dose Report"));
		doc->getTree().getCurrentContentItem().setTemplateIdentification("10011","DCMR"); 

		DcmFileFormat *fileformat = new DcmFileFormat();
		DcmDataset *dataset = NULL;
		if (fileformat != NULL)
			dataset = fileformat->getDataset();
		if (dataset != NULL)
		{
			OFCondition condRes = doc->write(*dataset);
			if (condRes.good())
				fileformat->saveFile("d:\\SRTest.dcm", EXS_LittleEndianExplicit);
		}
		delete fileformat;
The "condRes" refers to "ECC_invalid value", any suggestion? Thanks!
PS: when I change the "doc->createNewDocument(DSRTypes::DT_XRayRadiationDoseSR)" to doc->createNewDocument(DSRTypes::DT_MammographyCadSR), it still works well, why?

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

Re: Can not save SR file: "invalid value"

#2 Post by J. Riesmeier »

The "condRes" refers to "ECC_invalid value", any suggestion?
What does the debug logger say?
when I change the "doc->createNewDocument(DSRTypes::DT_XRayRadiationDoseSR)" to doc->createNewDocument(DSRTypes::DT_MammographyCadSR), it still works well, why?
I thought it does not work at all? Please note that the dcmsr module (currently) only checks IOD-specific restrictions but no templates.

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Re: Can not save SR file: "invalid value"

#3 Post by kamil »

J. Riesmeier wrote:
The "condRes" refers to "ECC_invalid value", any suggestion?
What does the debug logger say?
W: ManufacturerModelName (0008,1090) absent in EnhancedGeneralEquipmentModule (type 1)

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

Re: Can not save SR file: "invalid value"

#4 Post by J. Riesmeier »

So, here you have the answer :)

The X-Ray Radiation Dose SR IOD defines the Enhanced General Equipment Module as being "mandatory", and in this module the "ManufacturerModelName" is required. The solution is easy: Just provide all required (type 1) attributes with a non-empty, valid value, and you should be able to write the SR document to a DICOM dataset and then to a DICOM file.

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Re: Can not save SR file: "invalid value"

#5 Post by kamil »

J. Riesmeier wrote:So, here you have the answer :)

The X-Ray Radiation Dose SR IOD defines the Enhanced General Equipment Module as being "mandatory", and in this module the "ManufacturerModelName" is required. The solution is easy: Just provide all required (type 1) attributes with a non-empty, valid value, and you should be able to write the SR document to a DICOM dataset and then to a DICOM file.
you mean not only Enhanced General Equipment Module? All the TYPE1 tag of "M" Usage in DICOM PS 3.3 A.35.8.3 X-Ray RADIATION DOSE SR IOD MODULES?

Like this:?

Code: Select all

//Patient Module
...
//General Study Module
...
//SR Document Module
...
//General Equipment Module
...
// Enhanced General Equipment Module
dataset->putAndInsertString(DCM_ManufacturerModelName, "ModelName");

//and so on....
OFCondition condRes = doc->write(*dataset);
but after I only added(not include other Module),

Code: Select all

dataset->putAndInsertString(DCM_ManufacturerModelName, "ModelName");
it still infor me "W: ManufacturerModelName (0008,1090) absent in EnhancedGeneralEquipmentModule (type 1)" which I already added. Dose this normal?

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

Re: Can not save SR file: "invalid value"

#6 Post by J. Riesmeier »

No, you have to use DSRDocument::setManufacturerModelName() in order to set the value before you write the SR document to a DICOM dataset. And, of course, this also applies to the other three attributes of the Enhanced General Equipment Module. Here's a list from the DSRDocument header file:

Code: Select all

    // --- Enhanced General Equipment Module (M - for some IODs) ---

    // Manufacturer: (LO, 1, 1)
    //  - see 'General Equipment Module'
    // Manufacturer's Model Name: (LO, 1, 1)
    //  - see 'General Equipment Module'
    // Device Serial Number: (LO, 1, 1)
    //  - see 'General Equipment Module'
    // Software Version(s): (LO, 1-n, 1)
    //  - see 'General Equipment Module'

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

Re: Can not save SR file: "invalid value"

#7 Post by kamil »

J. Riesmeier wrote:No, you have to use DSRDocument::setManufacturerModelName() in order to set the value before you write the SR document to a DICOM dataset. And, of course, this also applies to the other three attributes of the Enhanced General Equipment Module. Here's a list from the DSRDocument header file:

Code: Select all

    // --- Enhanced General Equipment Module (M - for some IODs) ---

    //  Manufacturer: (LO, 1, 1)
        //  - see 'General Equipment Module'
    // Manufacturer's Model Name: (LO, 1, 1)
        //  - see 'General Equipment Module'
    // Device Serial Number: (LO, 1, 1)
        //  - see 'General Equipment Module'
    // Software Version(s): (LO, 1-n, 1)
        //  - see 'General Equipment Module'
Hi, after I added the following code, it works:

Code: Select all

doc->setManufacturer("Manufacturer");
doc->setManufacturerModelName("ModelName");
doc->setDeviceSerialNumber(OFString("0001"));
doc->setSoftwareVersions(OFString("v1.0.0.0"));
btw: this constraint is strange, because it do not include other "Mandatory" Modules "type 1" tag, only the "Enhanced General Equipment Module".
But thank you for your patient rely anyway!

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

Re: Can not save SR file: "invalid value"

#8 Post by J. Riesmeier »

btw: this constraint is strange, because it do not include other "Mandatory" Modules "type 1" tag, only the "Enhanced General Equipment Module".
Of course, all other type 1 requirements are also checked, but most of these attribute are either set automatically (by default) or by some other method you've called.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest