diff 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
line wrap: on
line diff
--- a/Core/DicomParsing/IDicomTranscoder.h	Mon May 18 21:37:31 2020 +0200
+++ b/Core/DicomParsing/IDicomTranscoder.h	Tue May 19 10:17:06 2020 +0200
@@ -47,14 +47,59 @@
    * WARNING: This class might be called from several threads at
    * once. Make sure to implement proper locking.
    **/
+
+  class ParsedDicomFile;
   
   class IDicomTranscoder : public boost::noncopyable
   {
   public:
+    class DicomImage : public boost::noncopyable
+    {
+    private:
+      std::unique_ptr<DcmFileFormat>  parsed_;
+      std::unique_ptr<std::string>    buffer_;
+
+      void Parse();
+
+      void Serialize();
+
+      DcmFileFormat* ReleaseParsed();
+
+    public:
+      void Clear();
+      
+      // Calling this method will invalidate the "ParsedDicomFile" object
+      void AcquireParsed(ParsedDicomFile& parsed);
+      
+      void AcquireParsed(DcmFileFormat* parsed);
+
+      void AcquireParsed(DicomImage& other);
+
+      void AcquireBuffer(std::string& buffer /* will be swapped */);
+
+      void AcquireBuffer(DicomImage& other);
+
+      DcmFileFormat& GetParsed();
+
+      const void* GetBufferData();
+
+      size_t GetBufferSize();
+    };
+
+    
     virtual ~IDicomTranscoder()
     {
     }
 
+
+    virtual bool Transcode(DicomImage& target,
+                           bool& hasSopInstanceUidChanged /* out */,
+                           DicomImage& source /* in, "GetParsed()" possibly modified */,
+                           const std::set<DicomTransferSyntax>& allowedSyntaxes,
+                           bool allowNewSopInstanceUid) = 0;
+                           
+
+
     virtual bool TranscodeParsedToBuffer(std::string& target /* out */,
                                          bool& hasSopInstanceUidChanged /* out */,
                                          DcmFileFormat& dicom /* in, possibly modified */,