changeset 1417:afdd5be8731c loader-injection-feature

when CT slices are loaded, it is now possible to act on this by implementing the ISlicePostProcessor interface and inject it in the loader.
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 11 May 2020 17:38:29 +0200
parents d959bc8f6c1b
children 4e7751a4b603
files Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Mon May 11 17:37:30 2020 +0200
+++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Mon May 11 17:38:29 2020 +0200
@@ -362,6 +362,9 @@
         // the 3D plane corresponding to the slice
         OrthancStone::CoordinateSystem3D geometry = instance->GetGeometry();
         slices.AddSlice(geometry, instance.release());
+
+        if (slicePostProcessor_)
+          slicePostProcessor_->ProcessCTDicomSlice(dicom);
       }
 
       seriesGeometry_.ComputeGeometry(slices);
--- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h	Mon May 11 17:37:30 2020 +0200
+++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.h	Mon May 11 17:38:29 2020 +0200
@@ -57,6 +57,12 @@
     static const unsigned int QUALITY_02 = 2;
         
     class ExtractedSlice;
+
+    class ISlicePostProcessor
+    {
+    public:
+      virtual void ProcessCTDicomSlice(const Orthanc::DicomMap& dicom) = 0;
+    };
     
     /** Helper class internal to OrthancSeriesVolumeProgressiveLoader */
     class SeriesGeometry : public boost::noncopyable
@@ -121,6 +127,8 @@
     std::vector<unsigned int>     slicesQuality_;
     bool                          volumeImageReadyInHighQuality_;
     
+    boost::shared_ptr<ISlicePostProcessor>  slicePostProcessor_;
+
     OrthancSeriesVolumeProgressiveLoader(
       OrthancStone::ILoadersContext& loadersContext,
       boost::shared_ptr<OrthancStone::DicomVolumeImage> volume,
@@ -141,6 +149,12 @@
 
     void SetSimultaneousDownloads(unsigned int count);
 
+    void SetDicomSlicePostProcessor(boost::shared_ptr<ISlicePostProcessor> slicePostProcessor)
+    {
+      // this will delete the previously stored slice processor, if any
+      slicePostProcessor_ = slicePostProcessor;
+    }
+
     bool IsVolumeImageReadyInHighQuality() const
     {
       return volumeImageReadyInHighQuality_;