comparison Core/DicomParsing/IDicomTranscoder.h @ 3944:aae045f802f4 transcoding

preparing simplified interface for IDicomTranscoder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 19 May 2020 10:17:06 +0200
parents 7dc5e7e0045d
children 0b3256c3ee14
comparison
equal deleted inserted replaced
3943:b26d25d3c1c7 3944:aae045f802f4
45 { 45 {
46 /** 46 /**
47 * WARNING: This class might be called from several threads at 47 * WARNING: This class might be called from several threads at
48 * once. Make sure to implement proper locking. 48 * once. Make sure to implement proper locking.
49 **/ 49 **/
50
51 class ParsedDicomFile;
50 52
51 class IDicomTranscoder : public boost::noncopyable 53 class IDicomTranscoder : public boost::noncopyable
52 { 54 {
53 public: 55 public:
56 class DicomImage : public boost::noncopyable
57 {
58 private:
59 std::unique_ptr<DcmFileFormat> parsed_;
60 std::unique_ptr<std::string> buffer_;
61
62 void Parse();
63
64 void Serialize();
65
66 DcmFileFormat* ReleaseParsed();
67
68 public:
69 void Clear();
70
71 // Calling this method will invalidate the "ParsedDicomFile" object
72 void AcquireParsed(ParsedDicomFile& parsed);
73
74 void AcquireParsed(DcmFileFormat* parsed);
75
76 void AcquireParsed(DicomImage& other);
77
78 void AcquireBuffer(std::string& buffer /* will be swapped */);
79
80 void AcquireBuffer(DicomImage& other);
81
82 DcmFileFormat& GetParsed();
83
84 const void* GetBufferData();
85
86 size_t GetBufferSize();
87 };
88
89
54 virtual ~IDicomTranscoder() 90 virtual ~IDicomTranscoder()
55 { 91 {
56 } 92 }
93
94
95 virtual bool Transcode(DicomImage& target,
96 bool& hasSopInstanceUidChanged /* out */,
97 DicomImage& source /* in, "GetParsed()" possibly modified */,
98 const std::set<DicomTransferSyntax>& allowedSyntaxes,
99 bool allowNewSopInstanceUid) = 0;
100
101
57 102
58 virtual bool TranscodeParsedToBuffer(std::string& target /* out */, 103 virtual bool TranscodeParsedToBuffer(std::string& target /* out */,
59 bool& hasSopInstanceUidChanged /* out */, 104 bool& hasSopInstanceUidChanged /* out */,
60 DcmFileFormat& dicom /* in, possibly modified */, 105 DcmFileFormat& dicom /* in, possibly modified */,
61 DicomTransferSyntax targetSyntax, 106 DicomTransferSyntax targetSyntax,