changeset 2870:716dd24974ef

DicomImageInformation::Clone()
author am@osimis.io
date Mon, 08 Oct 2018 17:36:54 +0200
parents 2bd87764709c
children 6eebc2eb3168
files Core/DicomFormat/DicomImageInformation.cpp Core/DicomFormat/DicomImageInformation.h
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomFormat/DicomImageInformation.cpp	Mon Oct 08 17:20:44 2018 +0200
+++ b/Core/DicomFormat/DicomImageInformation.cpp	Mon Oct 08 17:36:54 2018 +0200
@@ -45,6 +45,7 @@
 #include <limits>
 #include <cassert>
 #include <stdio.h>
+#include <memory>
 
 namespace Orthanc
 {
@@ -213,6 +214,23 @@
     isSigned_ = (pixelRepresentation != 0 ? true : false);
   }
 
+  DicomImageInformation* DicomImageInformation::Clone() const
+  {
+    std::auto_ptr<DicomImageInformation> target(new DicomImageInformation);
+    target->width_ = width_;
+    target->height_ = height_;
+    target->samplesPerPixel_ = samplesPerPixel_;
+    target->numberOfFrames_ = numberOfFrames_;
+    target->isPlanar_ = isPlanar_;
+    target->isSigned_ = isSigned_;
+    target->bytesPerValue_ = bytesPerValue_;
+    target->bitsAllocated_ = bitsAllocated_;
+    target->bitsStored_ = bitsStored_;
+    target->highBit_ = highBit_;
+    target->photometric_ = photometric_;
+
+    return target.release();
+  }
 
   bool DicomImageInformation::ExtractPixelFormat(PixelFormat& format,
                                                  bool ignorePhotometricInterpretation) const
--- a/Core/DicomFormat/DicomImageInformation.h	Mon Oct 08 17:20:44 2018 +0200
+++ b/Core/DicomFormat/DicomImageInformation.h	Mon Oct 08 17:36:54 2018 +0200
@@ -57,9 +57,16 @@
 
     PhotometricInterpretation  photometric_;
 
+  protected:
+    explicit DicomImageInformation()
+    {
+    }
+
   public:
     explicit DicomImageInformation(const DicomMap& values);
 
+    DicomImageInformation* Clone() const;
+
     unsigned int GetWidth() const
     {
       return width_;