DcmSignature signer; // signature handler
DcmItem *sigItem = DcmSignature::findFirstSignatureItem(*dataset, stack); while (sigItem) // browse through items that contain digital signatures {
signer.attach(sigItem); // each item may contain multiple signatures for (unsigned long l=0; l < signer.numberOfSignatures(); ++l) {
if (signer.selectSignature(l).good()) {
++counter;
if (signer.verifyCurrent().bad()) // verify signature corrupt_counter++; } }
signer.detach();
sigItem = DcmSignature::findNextSignatureItem(*dataset, stack); }
if (counter == 0)
cerr << \else
cerr << counter << \ << corrupt_counter << \}
--¸øÒ»¸öDICOMÎļþÔö¼ÓÇ©Ãû¡£ DcmFileFormat fileformat;
if (fileformat.loadFile(\{
DcmDataset *dataset = fileformat.getDataset();
SiCreatorProfile profile; // select the \SiRIPEMD160 mac; // use RIPEMD160 as MAC algorithm DcmSignature signer; // signature handler SiCertificate cert; // our certificate
if (cert.loadCertificate(\{
cerr << \
return; }
SiPrivateKey key; // private key, must be unencrypted here
if (key.loadPrivateKey(\{
cerr << \ return; }
signer.attach(dataset); // connect handler to data set if (signer.createSignature(key, cert, mac, profile).good()) {
fileformat.saveFile(\} }
Ê®¡¢dcmsr³ÌÐò°ü
dcmsrÊÇÒ»¸ö½á¹¹»¯±¨±í¿âºÍ¿ÉÓù¤¾ß¡£Õâ¸öÄ£¿é°üÀ¨Ò»Ð©ÀàÀ´¶Á¡¢Ð´¡¢´´½¨¡¢Ð޸ġ¢·ÃÎÊ¡¢´òÓ¡ºÍÏÔʾDICOM½á¹¹»¯±¨±íÎĵµ¡£ËùÖ§³ÖµÄSOPÀàÁбíÓÉDSRTypes::E_DocumentTypeÌṩ¡£ Ö÷Òª½Ó¿Ú£º
--DSRDocument: Interface class for 'dcmsr' (DICOM Structured Reporting Documents). This class supports reading, writing, creation, printing and rendering of DICOM SR documents (according to DICOM PS 3.x-2004, formerly known as Supplement 23). The list of supported SOP classes is available in file \ÔÚdsrdoc.hÖж¨Òå¡£
--DSRDocumentTree: ¹ÜÀíSRÎĵµÊ÷µÄÀà¡£ÔÚdsrdoctr.hÖж¨Òå¡£
--DSRContentItem: Interface class for content items. This class allows to access the document tree nodes without using any pointers. ÔÚdsrcitem.hÖж¨Òå¡£
--DSRCodedEntryValue: Class for coded entry values. ÔÚdsrcodvl.hÖж¨Òå¡£ ¹¤¾ß£º
dsr2html: Render DICOM SR file and data set to HTML dsr2xml: Convert DICOM SR file and data set to XML dsrdump: Dump DICOM SR file and data set xml2dsr: Convert DICOM SR file and data set to XML ¾ÙÀý£º
--ÔØÈëÒ»¸öDICOM½á¹¹»¯±¨±í£¬²¢ÒÔHTML¸ñʽÏÔʾÆäÄÚÈÝ¡£ DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile(\if (status.good()) {
DSRDocument document;
status = document.read(*fileformat.getDataset()); if (status.good()) {
status = document.renderHTML(cout);
if (status.bad())
cerr << \} else
cerr << \} else
cerr << \--´´½¨Ò»¸öDICOM½á¹¹»¯±¨¸æ£¬²¢½«Æä´æÎªÎļþ¡£ DSRDocument document;
document.setPatientsName(\/* ... */
document.getTree().addContentItem(DSRTypes::RT_isRoot, DSRTypes::VT_Container);
document.getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue(/* some code */));
document.getTree().addContentItem(DSRTypes::RT_hasObsContext, DSRTypes::VT_Code, DSRTypes::AM_belowCurrent); /* ... */
DcmFileFormat fileformat;
OFCondition status = document.write(*fileformat.getDataset()) if (status.good()) {
status = fileformat.saveFile(\if (status.bad())
cerr << \} else
cerr << \--¶ÁÈ¡ÎĵµÊ÷µÄÊôÐÔ£¬²¢Ö±½ÓÐ޸ġ£
DSRDocument document(DSRTypes::DT_KeyObjectDoc); /* ... */
document.getTree().addContentItem(DSRTypes::RT_isRoot, DSRTypes::VT_Container);
DSRCodedEntryValue *codePtr = document.getTree().getCurrentContentItem().getConceptNamePtr(); if (codePtr != NULL)
codePtr->setCode(\/* ... */
document.getTree().addContentItem(DSRTypes::RT_contains, DSRTypes::VT_Image); DSRImageReferenceValue *imagePtr =
document.getTree().getCurrentContentItem().getImageReferencePtr(); if (imagePtr != NULL) {
imagePtr->setValue(DSRImageReferenceValue(UID_UltrasoundMultiframeImageStorage, /* image UID */));
imagePtr->setPresentationState(DSRCompositeReferenceValue(UID_GrayscaleSoftcopyPresentationStateStorage, /* GSPS UID */));
imagePtr->getFrameList().addItem(2);
imagePtr->getFrameList().addItem(5); } /* ... */
ʮһ¡¢dcmtls³ÌÐò°ü
dcmtlsÊÇÍøÂç¿âµÄ°²È«À©Õ¹¡£This module contains classes that implement DICOM network communication tunneled through a Transport Layer Security (TLS) connection, conforming to the DICOM \external OpenSSL library. Ö÷Òª½Ó¿Ú£º
--DcmTLSTransportLayer: factory class which creates secure TLS transport layer connections and maintains the parameters common to all TLS transport connections in one application (e.g. the pool of trusted certificates, the key and certificate to be used for authentication and the list of ciphersuite to be used for association negotiation.)¡£ÔÚtlslayer.hÎļþÖж¨Òå¡£
--DcmTLSConnection: this class represents a TLS (Transport Layer Security) V1 based secure transport connection. ¾ÙÀý£º
--TLSµÄ¹ØÁªÇëÇóÓ¦ÓÃ
T_ASC_Network *net; // network initialization code not shown, T_ASC_Parameters *params; // we just assume these pointers to be valid // create TLS object that initializes the random generator through a file // \DcmTLSTransportLayer *tLayer = new DcmTLSTransportLayer( DICOM_APPLICATION_REQUESTOR, \
if (TCS_ok != tLayer->setPrivateKeyFile(\{
cerr << \return; }
if (TCS_ok != tLayer->setCertificateFile(\{
cerr << \return; }
// enable the TLS_RSA_WITH_3DES_EDE_CBC_SHA ciphersuite tLayer->setCipherSuites(SSL3_TXT_RSA_DES_192_CBC3_SHA);
Ïà¹ØÍÆ¼ö£º