DCMTK Create a Mammography CAD SR Document

阅读更多

 

Howto: Create a Mammography CAD SR Document

Here's an example that shows how to start from scratch:

Source Code

 

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmsr/dsrdoc.h"
#include "dcmtk/dcmdata/dcfilefo.h"
 
int main(int /*argc*/, char * /*argv*/ [])
{
  DSRDocument *doc = new DSRDocument();
  if (doc != NULL)
  {
    doc->createNewDocument(DSRTypes::DT_MammographyCadSR);
 
    doc->setPatientsName("Last Name^First Name");
    doc->setPatientsSex("O");
    doc->setManufacturer("OFFIS e.V.");
    doc->setReferringPhysiciansName("Last Name^First Name");
 
    doc->getTree().addContentItem(DSRTypes::RT_isRoot, DSRTypes::VT_Container);
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("111036", "DCM", "Mammography CAD Report"));
    doc->getTree().getCurrentContentItem().setTemplateIdentification("4000","DCMR"); 
 
    doc->getTree().addContentItem(DSRTypes::RT_hasConceptMod, DSRTypes::VT_Code, DSRTypes::AM_belowCurrent); 
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121049", "DCM", "Language of Content Item and Descendants"));
    doc->getTree().getCurrentContentItem().setCodeValue(DSRCodedEntryValue("eng","ISO639_2","English"));
 
    doc->getTree().addContentItem(DSRTypes::RT_hasConceptMod, DSRTypes::VT_Code, DSRTypes::AM_belowCurrent); 
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121046", "DCM", "Country of Language"));
    doc->getTree().getCurrentContentItem().setCodeValue(DSRCodedEntryValue("US","ISO3166_1","UNITED STATES"));
 
    doc->getTree().goUp();
 
    doc->getTree().addContentItem(DSRTypes::RT_contains, DSRTypes::VT_Container); 
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("111028", "DCM", "Image Library"));
 
    /* proceed with adding content items according to TID 4000 ... */
 
    DcmFileFormat *fileformat = new DcmFileFormat();
    DcmDataset *dataset = NULL;
    if (fileformat != NULL)
      dataset = fileformat->getDataset();
    if (dataset != NULL)
    {
      if (doc->write(*dataset).good())
        fileformat->saveFile("mamcadsr.dcm", EXS_LittleEndianExplicit);
    }
    delete fileformat;
  }
  delete doc;
 
  return 0; 
}

 Dump

The resulting output (from dsrdump) looks like this:

 

Mammography CAD SR Document

Patient            : Last Name^First Name (O)
Referring Physician: Last Name^First Name
Manufacturer       : OFFIS e.V.
Completion Flag    : PARTIAL
Verification Flag  : UNVERIFIED
Content Date/Time  : 20080710 175805

  # TID 4000 (DCMR)
  
    
   


Note:

 

Detailed Description

Interface class for 'dcmsr' (DICOM Structured Reporting Documents).

This class supports reading, writing, creation, printing and rendering of DICOM Structured Reporting (SR) documents. The list of supported SOP classes is available in file "dsrtypes.h".

 

 

------------------------------------------------------------------

柳北风儿

http://qimo601.iteye.com

转载:http://support.dcmtk.org/wiki/dcmtk/howto/mammocadsr

你可能感兴趣的:(DCMTK,DICOM)