diff Framework/Volumes/ImageBuffer3D.cpp @ 87:4a541cd4fa83 wasm

OrthancVolumeImageLoader
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 May 2017 15:31:58 +0200
parents 28956ed68280
children e0ddd8cad909
line wrap: on
line diff
--- a/Framework/Volumes/ImageBuffer3D.cpp	Fri May 26 13:42:50 2017 +0200
+++ b/Framework/Volumes/ImageBuffer3D.cpp	Fri May 26 15:31:58 2017 +0200
@@ -24,6 +24,8 @@
 #include "../../Resources/Orthanc/Core/Images/ImageProcessing.h"
 #include "../../Resources/Orthanc/Core/OrthancException.h"
 
+#include <string.h>
+
 namespace OrthancStone
 {
   Orthanc::ImageAccessor ImageBuffer3D::GetAxialSliceAccessor(unsigned int slice,
@@ -122,14 +124,12 @@
 
   void ImageBuffer3D::Clear()
   {
-    WriteLock lock(mutex_);
-    Orthanc::ImageProcessing::Set(image_, 0);
+    memset(image_.GetBuffer(), 0, image_.GetHeight() * image_.GetPitch());
   }
 
 
   void ImageBuffer3D::SetAxialGeometry(const SliceGeometry& geometry)
   {
-    WriteLock lock(mutex_);
     axialGeometry_ = geometry;
   }
 
@@ -146,7 +146,6 @@
     }
 
     {
-      WriteLock lock(mutex_);
       GeometryToolbox::AssignVector(voxelDimensions_, x, y, z);
     }
   }
@@ -154,8 +153,6 @@
 
   Vector ImageBuffer3D::GetVoxelDimensions(VolumeProjection projection)
   {
-    ReadLock lock(mutex_);
-
     Vector result;
     switch (projection)
     {
@@ -260,8 +257,7 @@
 
   ImageBuffer3D::SliceReader::SliceReader(ImageBuffer3D& that,
                                           VolumeProjection projection,
-                                          unsigned int slice) :
-  lock_(that.mutex_)
+                                          unsigned int slice)
   {
     switch (projection)
     {
@@ -286,10 +282,13 @@
 
   void ImageBuffer3D::SliceWriter::Flush()
   {
-    if (sagittal_.get() != NULL)
+    if (modified_)
     {
-      // TODO
-      throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);          
+      if (sagittal_.get() != NULL)
+      {
+        // TODO
+        throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);          
+      }
     }
   }
 
@@ -297,7 +296,7 @@
   ImageBuffer3D::SliceWriter::SliceWriter(ImageBuffer3D& that,
                                           VolumeProjection projection,
                                           unsigned int slice) :
-  lock_(that.mutex_)
+  modified_(false)
   {
     switch (projection)
     {