changeset 1072:391fb6d6905d

OrthancMultiframeVolumeLoader asks volume image to compute range + added IsContextLost to wasm viewport + added "computeRange" bool property to DicomVolumeImage + added ability to ask the MPR slicer for its source volume (to retrieve voxel value range)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 16 Oct 2019 15:43:21 +0200
parents 6dd90b8d1589
children 287ec78f63b4
files Framework/Loaders/OrthancMultiframeVolumeLoader.cpp Framework/Scene2D/LookupTableTextureSceneLayer.cpp Framework/Viewport/WebAssemblyViewport.h Framework/Volumes/DicomVolumeImage.cpp Framework/Volumes/DicomVolumeImage.h Framework/Volumes/DicomVolumeImageMPRSlicer.h
diffstat 6 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Loaders/OrthancMultiframeVolumeLoader.cpp	Tue Oct 15 14:30:19 2019 +0200
+++ b/Framework/Loaders/OrthancMultiframeVolumeLoader.cpp	Wed Oct 16 15:43:21 2019 +0200
@@ -112,8 +112,6 @@
     }
   };
 
-
-
   class OrthancMultiframeVolumeLoader::LoadTransferSyntax : public State
   {
   public:
@@ -229,7 +227,7 @@
       geometry.SetAxialGeometry(parameters.GetGeometry());
       geometry.SetVoxelDimensions(parameters.GetPixelSpacingX(),
                                   parameters.GetPixelSpacingY(), spacingZ);
-      volume_->Initialize(geometry, format);
+      volume_->Initialize(geometry, format, true /* Do compute range */);
     }
 
     volume_->GetPixelData().Clear();
--- a/Framework/Scene2D/LookupTableTextureSceneLayer.cpp	Tue Oct 15 14:30:19 2019 +0200
+++ b/Framework/Scene2D/LookupTableTextureSceneLayer.cpp	Wed Oct 16 15:43:21 2019 +0200
@@ -52,7 +52,7 @@
       SetTexture(t.release());
     }
 
-    SetLookupTableGrayscale();
+    SetLookupTableGrayscale(); // simple ramp between 0 and 255
     SetRange(0, 1);
   }
 
@@ -158,7 +158,8 @@
   {
     Orthanc::ImageProcessing::GetMinMaxFloatValue(minValue_, maxValue_, GetTexture());
     assert(minValue_ <= maxValue_);
-    
+    // TODO: debug to be removed
+    LOG(ERROR) << "LookupTableTextureSceneLayer::FitRange(): minValue_ = " << minValue_ << " maxValue_ = " << maxValue_;
     IncrementRevision();
   }
 
@@ -168,6 +169,8 @@
     std::auto_ptr<LookupTableTextureSceneLayer> cloned
       (new LookupTableTextureSceneLayer(GetTexture()));
 
+
+    // TODO: why is windowing_ not copied??????
     cloned->CopyParameters(*this);
     cloned->minValue_ = minValue_;
     cloned->maxValue_ = maxValue_;
--- a/Framework/Viewport/WebAssemblyViewport.h	Tue Oct 15 14:30:19 2019 +0200
+++ b/Framework/Viewport/WebAssemblyViewport.h	Wed Oct 16 15:43:21 2019 +0200
@@ -73,6 +73,11 @@
       return (compositor_.get() != NULL);
     }
     
+    bool IsContextLost()
+    {
+      return context_.IsContextLost();
+    }
+
     virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE;
 
     virtual void Refresh() ORTHANC_OVERRIDE;
--- a/Framework/Volumes/DicomVolumeImage.cpp	Tue Oct 15 14:30:19 2019 +0200
+++ b/Framework/Volumes/DicomVolumeImage.cpp	Wed Oct 16 15:43:21 2019 +0200
@@ -36,12 +36,14 @@
   }
     
 
-  void DicomVolumeImage::Initialize(const VolumeImageGeometry& geometry,
-                                    Orthanc::PixelFormat format)
+  void DicomVolumeImage::Initialize(
+    const VolumeImageGeometry& geometry,
+    Orthanc::PixelFormat format, 
+    bool computeRange)
   {
     geometry_.reset(new VolumeImageGeometry(geometry));
     image_.reset(new ImageBuffer3D(format, geometry_->GetWidth(), geometry_->GetHeight(),
-                                   geometry_->GetDepth(), false /* don't compute range */));
+                                   geometry_->GetDepth(), computeRange));
 
     revision_ ++;
   }
--- a/Framework/Volumes/DicomVolumeImage.h	Tue Oct 15 14:30:19 2019 +0200
+++ b/Framework/Volumes/DicomVolumeImage.h	Wed Oct 16 15:43:21 2019 +0200
@@ -67,7 +67,7 @@
     }
 
     void Initialize(const VolumeImageGeometry& geometry,
-                    Orthanc::PixelFormat format);
+                    Orthanc::PixelFormat format, bool computeRange = false);
 
     void SetDicomParameters(const DicomInstanceParameters& parameters);
     
--- a/Framework/Volumes/DicomVolumeImageMPRSlicer.h	Tue Oct 15 14:30:19 2019 +0200
+++ b/Framework/Volumes/DicomVolumeImageMPRSlicer.h	Wed Oct 16 15:43:21 2019 +0200
@@ -89,6 +89,11 @@
     {
     }
 
+    boost::shared_ptr<const DicomVolumeImage> GetVolume() const
+    {
+      return volume_;
+    }
+
     virtual ~DicomVolumeImageMPRSlicer();
 
     virtual IExtractedSlice* ExtractSlice(const CoordinateSystem3D& cuttingPlane) ORTHANC_OVERRIDE;