How to write Dcm file for RT Structure Set
Moderator: Moderator Team
-
- Posts: 12
- Joined: Thu, 2021-03-18, 08:57
How to write Dcm file for RT Structure Set
Hello dcmtk team,
I am new to dcmtk and Dicom.
I populated all the tags of an DRTStructureSetIOD object. Now I want to write this object to a dcm file. Assuming rtStruct is my fully populated DRTStructureSetIOD object, is the following the correct way to do it?
DcmFileFormat fileformat;
auto status = rtStruct.write(*fileformat.getDataset());
auto fileMetaData = fileformat.getMetaInfo();
// Set all the file meta data //
if (status.good())
{
status = fileformat.saveFile(dcmFileName);
}
Thanks for your help.
I am new to dcmtk and Dicom.
I populated all the tags of an DRTStructureSetIOD object. Now I want to write this object to a dcm file. Assuming rtStruct is my fully populated DRTStructureSetIOD object, is the following the correct way to do it?
DcmFileFormat fileformat;
auto status = rtStruct.write(*fileformat.getDataset());
auto fileMetaData = fileformat.getMetaInfo();
// Set all the file meta data //
if (status.good())
{
status = fileformat.saveFile(dcmFileName);
}
Thanks for your help.
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: How to write Dcm file for RT Structure Set
Basically, yes, but there is no need to specify the element values of the file meta information manually (as this is done automatically when calling saveFile()).
-
- Posts: 12
- Joined: Thu, 2021-03-18, 08:57
Re: How to write Dcm file for RT Structure Set
Thank you. How about tags like ImplementationVersionName or ImplementationClassUID or MediaStorageSOPInstanceUID that are specific to the manufacturer? Do we not set these tags in the file meta data?
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: How to write Dcm file for RT Structure Set
If you use the DCMTK, ImplementationVersionName and ImplementationClassUID should be the ones of the DCMTK, i.e. they are added automatically. The values can be found in "dcmdata/include/dcuid.h":How about tags like ImplementationVersionName or ImplementationClassUID or MediaStorageSOPInstanceUID that are specific to the manufacturer? Do we not set these tags in the file meta data?
Code: Select all
/// implementation version name for this version of the toolkit
#define OFFIS_DTK_IMPLEMENTATION_VERSION_NAME "OFFIS_DCMTK_" PACKAGE_VERSION_NUMBER_TO_STRING(PACKAGE_VERSION_NUMBER)
[...]
/// Implementation class UID for this release of the toolkit
#define OFFIS_IMPLEMENTATION_CLASS_UID OFFIS_UID_ROOT ".0." OFFIS_DCMTK_VERSION_STRING
-
- Posts: 12
- Joined: Thu, 2021-03-18, 08:57
-
- Posts: 12
- Joined: Thu, 2021-03-18, 08:57
Re: How to write Dcm file for RT Structure Set
The following line of code returns OF_ok
but the saveFile returns a status of OF_error with code 7 and text "Illegal call, perhaps wrong parameters". rtStruct is of type DRTStructureSetIOD and rtStruct.isValid() is true.
The dcm file is created in the location specified but is empty.
Would really appreciate if you can help me understand what the illegal call means. Thanks!
Code: Select all
auto status = rtStruct.write(*fileformat.getDataset());
Code: Select all
OFFilename dcmFile("D:\\test.dcm");
status = fileformat.saveFile(dcmFile);
Would really appreciate if you can help me understand what the illegal call means. Thanks!
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: How to write Dcm file for RT Structure Set
What is the output to the debug logger? It might also be useful to enable the trace logger...
-
- Posts: 12
- Joined: Thu, 2021-03-18, 08:57
Re: How to write Dcm file for RT Structure Set
Seems like I needed to set the Transfer Syntax. I am able to now write the file. I am yet to verify the contents. Thank you!
Who is online
Users browsing this forum: No registered users and 1 guest