Mercurial > hg > orthanc
comparison OrthancServer/FromDcmtkBridge.cpp @ 1004:a226e0959d8b lua-scripting
DicomInstanceToStore
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 08 Jul 2014 14:06:05 +0200 |
parents | 2f76b92addd4 |
children | e56c3ed8d738 |
comparison
equal
deleted
inserted
replaced
1003:1d35281d967c | 1004:a226e0959d8b |
---|---|
632 throw OrthancException(ErrorCode_ParameterOutOfRange); | 632 throw OrthancException(ErrorCode_ParameterOutOfRange); |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 bool FromDcmtkBridge::SaveToMemoryBuffer(std::string& buffer, | 636 bool FromDcmtkBridge::SaveToMemoryBuffer(std::string& buffer, |
637 DcmDataset* dataSet) | 637 DcmDataset& dataSet) |
638 { | 638 { |
639 // Determine the transfer syntax which shall be used to write the | 639 // Determine the transfer syntax which shall be used to write the |
640 // information to the file. We always switch to the Little Endian | 640 // information to the file. We always switch to the Little Endian |
641 // syntax, with explicit length. | 641 // syntax, with explicit length. |
642 | 642 |
647 * Note that up to Orthanc 0.7.1 (inclusive), the | 647 * Note that up to Orthanc 0.7.1 (inclusive), the |
648 * "EXS_LittleEndianExplicit" was always used to save the DICOM | 648 * "EXS_LittleEndianExplicit" was always used to save the DICOM |
649 * dataset into memory. We now keep the original transfer syntax | 649 * dataset into memory. We now keep the original transfer syntax |
650 * (if available). | 650 * (if available). |
651 **/ | 651 **/ |
652 E_TransferSyntax xfer = dataSet->getOriginalXfer(); | 652 E_TransferSyntax xfer = dataSet.getOriginalXfer(); |
653 if (xfer == EXS_Unknown) | 653 if (xfer == EXS_Unknown) |
654 { | 654 { |
655 // No information about the original transfer syntax: This is | 655 // No information about the original transfer syntax: This is |
656 // most probably a DICOM dataset that was read from memory. | 656 // most probably a DICOM dataset that was read from memory. |
657 xfer = EXS_LittleEndianExplicit; | 657 xfer = EXS_LittleEndianExplicit; |
658 } | 658 } |
659 | 659 |
660 E_EncodingType encodingType = /*opt_sequenceType*/ EET_ExplicitLength; | 660 E_EncodingType encodingType = /*opt_sequenceType*/ EET_ExplicitLength; |
661 | 661 |
662 // Create the meta-header information | 662 // Create the meta-header information |
663 DcmFileFormat ff(dataSet); | 663 DcmFileFormat ff(&dataSet); |
664 ff.validateMetaInfo(xfer); | 664 ff.validateMetaInfo(xfer); |
665 | 665 |
666 // Create a memory buffer with the proper size | 666 // Create a memory buffer with the proper size |
667 uint32_t s = ff.calcElementLength(xfer, encodingType); | 667 uint32_t s = ff.calcElementLength(xfer, encodingType); |
668 buffer.resize(s); | 668 buffer.resize(s); |