Can I convert a TID300 Measurement object to a DcmDataset?
Moderator: Moderator Team
Can I convert a TID300 Measurement object to a DcmDataset?
I'm using the version 3.6.3 of dcmtk. I would like to save diffrent measurements in dicom with the Template 300 Measurement. My question is:
Is there a possibility to convert a measurement object to a DcmDataset? Or are there any other similar formats to convert it?
Is there a possibility to convert a measurement object to a DcmDataset? Or are there any other similar formats to convert it?
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Can I convert a TID300 Measurement object to a DcmDatase
TID300_Measurement is a sub-template that can be inserted into a root template (or the internally stored sub-tree can be inserted into a document tree) and then into an instance of DSRDocument. The latter provides a write() method that outputs its content to a DcmDataset. In principle, you could also write the DSRDocumentTree into a DcmDataset but this would probably make no sense.
Re: Can I convert a TID300 Measurement object to a DcmDatase
I try creating a TID1500 Measurement Report and save the measurement also as TID300 Measurement in the measurement group. The report and the group as well as the measurement is valid. But when I want to verify the measurement reading the dataset there is no measurement group and also no measurement in the dataset. Also when I save the dataset to a dcm file, there is only the sr header but no measurement information.
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Can I convert a TID300 Measurement object to a DcmDatase
Did you actually insert the TID1500_MeasurementReport into the DSRDocument instance (e.g. using setTreeFromRootTemplate())? Could you post a minimal example that demonstrates what you've described?
Re: Can I convert a TID300 Measurement object to a DcmDatase
Code: Select all
TID1500_MeasurementReport report( CMR_CID7021::ImagingMeasurementReport );
status = report.addIndividualMeasurements( true );
auto group = report.getIndividualMeasurements();
char* uid = new char[100];
dcmGenerateUniqueIdentifier( uid );
status = group.setTrackingUniqueIdentifier( uid, true );
status = group.setTrackingIdentifier( "Diameter1" );
const CMR_SRNumericMeasurementValueWithUnits<CID7181_AbstractMultiDimensionalImageModelComponentUnits>
value("12", CID7181_AbstractMultiDimensionalImageModelComponentUnits::EnumType::Millimeter, true);
status = group.addMeasurement(CID7469_GenericIntensityAndSizeMeasurements::EnumType::Diameter, value, true);
auto measurement = group.getMeasurement();
/* add spatial coordinates and real world value map to measurement (for the beginning I only added those items) */
DSRDocument* doc = new DSRDocument();
DcmFileFormat fileformat;
if ( doc->setTreeFromRootTemplate( report ).good() )
doc->print( cout, DSRTypes::PF_printConceptNameCodes );
status = doc->write( *fileformat.getDataset() );
if ( status.good() )
{
status = fileformat.saveFile( "test.dcm", EXS_LittleEndianExplicit );
}
The 'status' is always good. I also added an observer context, a language and a procedure reported to the report. If I call
Code: Select all
report.isValid();
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Can I convert a TID300 Measurement object to a DcmDatase
I guess that the "auto" keyword in your code creates a local variable of the required type (i.e. a copy). However, what you actually need is a reference in order to modify the internally managed measurements (i.e. "auto &" or the respective by-reference type, which is what prefer).
-
- DCMTK Developer
- Posts: 2548
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Re: Can I convert a TID300 Measurement object to a DcmDatase
Btw, instead of CID7469_GenericIntensityAndSizeMeasurements::EnumType::Diameter you could also write CMR_CID7469::Diameter, which is much shorter.
Re: Can I convert a TID300 Measurement object to a DcmDatase
Thank you very much!!
Who is online
Users browsing this forum: Bing [Bot] and 1 guest