changeset 570:e77cbe4bb4c8 am-dev

fix + access to DicomFrameConverter members to allow serialization
author Alain Mazy <alain@mazy.be>
date Thu, 18 Apr 2019 15:46:07 +0200
parents ccd1a1ede305
children 848170ca4351
files Applications/Qt/QCairoWidget.cpp Framework/Toolbox/DicomFrameConverter.h
diffstat 2 files changed, 54 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Qt/QCairoWidget.cpp	Thu Apr 18 11:04:46 2019 +0200
+++ b/Applications/Qt/QCairoWidget.cpp	Thu Apr 18 15:46:07 2019 +0200
@@ -200,7 +200,7 @@
 
   if (event)
   {
-    surface_.SetSize(event->size().width(), event->size().height());
+    surface_.SetSize(event->size().width(), event->size().height(), true);
 
     image_.reset(new QImage(reinterpret_cast<uchar*>(surface_.GetBuffer()),
                             event->size().width(), 
--- a/Framework/Toolbox/DicomFrameConverter.h	Thu Apr 18 11:04:46 2019 +0200
+++ b/Framework/Toolbox/DicomFrameConverter.h	Thu Apr 18 15:46:07 2019 +0200
@@ -13,7 +13,7 @@
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Affero General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
@@ -63,13 +63,61 @@
     {
       // TODO: check whether this dtor is called or not
       // An MSVC warning explains that declaring an
-      // std::auto_ptr with a forward-declared type 
-      // prevents its dtor from being called. Does not 
+      // std::auto_ptr with a forward-declared type
+      // prevents its dtor from being called. Does not
       // seem an issue here (only POD types inside), but
-      // definitely something to keep an eye on. 
+      // definitely something to keep an eye on.
       (void)0;
     }
 
+    // AM: this is required to serialize/deserialize it
+    DicomFrameConverter(
+        bool isSigned,
+        bool isColor,
+        bool hasRescale,
+        double rescaleIntercept,
+        double rescaleSlope,
+        bool hasDefaultWindow,
+        double defaultWindowCenter,
+        double defaultWindowWidth,
+        Orthanc::PhotometricInterpretation photometric,
+        Orthanc::PixelFormat expectedPixelFormat
+        ):
+      isSigned_(isSigned),
+      isColor_(isColor),
+      hasRescale_(hasRescale),
+      rescaleIntercept_(rescaleIntercept),
+      rescaleSlope_(rescaleSlope),
+      hasDefaultWindow_(hasDefaultWindow),
+      defaultWindowCenter_(defaultWindowCenter),
+      defaultWindowWidth_(defaultWindowWidth),
+      photometric_(photometric),
+      expectedPixelFormat_(expectedPixelFormat)
+    {}
+
+    void GetParameters(bool& isSigned,
+                       bool& isColor,
+                       bool& hasRescale,
+                       double& rescaleIntercept,
+                       double& rescaleSlope,
+                       bool& hasDefaultWindow,
+                       double& defaultWindowCenter,
+                       double& defaultWindowWidth,
+                       Orthanc::PhotometricInterpretation& photometric,
+                       Orthanc::PixelFormat& expectedPixelFormat) const
+    {
+      isSigned = isSigned_;
+      isColor = isColor_;
+      hasRescale = hasRescale_;
+      rescaleIntercept = rescaleIntercept_;
+      rescaleSlope = rescaleSlope_;
+      hasDefaultWindow = hasDefaultWindow_;
+      defaultWindowCenter = defaultWindowCenter_;
+      defaultWindowWidth = defaultWindowWidth_;
+      photometric = photometric_;
+      expectedPixelFormat = expectedPixelFormat_;
+    }
+
     Orthanc::PixelFormat GetExpectedPixelFormat() const
     {
       return expectedPixelFormat_;
@@ -103,7 +151,7 @@
     {
       return rescaleIntercept_;
     }
-      
+
     double GetRescaleSlope() const
     {
       return rescaleSlope_;