comparison Framework/Loaders/OrthancMultiframeVolumeLoader.h @ 1260:5a2d5380148d toa2020012701

Added outlier rejection for min max computation in multiframe volume loader
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 27 Jan 2020 14:29:02 +0100
parents 32eaf4929b08
children 2d8ab34c8c91
comparison
equal deleted inserted replaced
1259:69177b10e2b9 1260:5a2d5380148d
41 41
42 boost::shared_ptr<DicomVolumeImage> volume_; 42 boost::shared_ptr<DicomVolumeImage> volume_;
43 std::string instanceId_; 43 std::string instanceId_;
44 std::string transferSyntaxUid_; 44 std::string transferSyntaxUid_;
45 bool pixelDataLoaded_; 45 bool pixelDataLoaded_;
46 float outliersHalfRejectionRate_;
47 float distributionRawMin_;
48 float distributionRawMax_;
49 float computedDistributionMin_;
50 float computedDistributionMax_;
46 51
47 const std::string& GetInstanceId() const; 52 const std::string& GetInstanceId() const;
48 53
49 void ScheduleFrameDownloads(); 54 void ScheduleFrameDownloads();
50 55
51 void SetTransferSyntax(const std::string& transferSyntax); 56 void SetTransferSyntax(const std::string& transferSyntax);
52 57
53 void SetGeometry(const Orthanc::DicomMap& dicom); 58 void SetGeometry(const Orthanc::DicomMap& dicom);
54 59
60
61 /**
62 This method will :
63
64 - copy the pixel values from the response to the volume image
65 - compute the maximum and minimum value while discarding the
66 outliersHalfRejectionRate_ fraction of the outliers from both the start
67 and the end of the distribution.
68
69 In English, this means that, if the volume dataset contains a few extreme
70 values very different from the rest (outliers) that we want to get rid of,
71 this method allows to do so.
72
73 If you supply 0.005, for instance, it means 1% of the extreme values will
74 be rejected (0.5% on each side of the distribution)
75 */
55 template <typename T> 76 template <typename T>
56 void CopyPixelData(const std::string& pixelData); 77 void CopyPixelDataAndComputeMinMax(const std::string& pixelData);
78
79 /** Service method for CopyPixelDataAndComputeMinMax*/
80 template <typename T>
81 void CopyPixelDataAndComputeDistribution(
82 const std::string& pixelData,
83 std::map<T, uint64_t>& distribution);
84
85 /** Service method for CopyPixelDataAndComputeMinMax*/
86 template <typename T>
87 void ComputeMinMaxWithOutlierRejection(
88 const std::map<T, uint64_t>& distribution);
57 89
58 void SetUncompressedPixelData(const std::string& pixelData); 90 void SetUncompressedPixelData(const std::string& pixelData);
59 91
60 virtual bool HasGeometry() const ORTHANC_OVERRIDE; 92 virtual bool HasGeometry() const ORTHANC_OVERRIDE;
61 virtual const VolumeImageGeometry& GetImageGeometry() const ORTHANC_OVERRIDE; 93 virtual const VolumeImageGeometry& GetImageGeometry() const ORTHANC_OVERRIDE;
62 94
63 public: 95 public:
64 OrthancMultiframeVolumeLoader(boost::shared_ptr<DicomVolumeImage> volume, 96 OrthancMultiframeVolumeLoader(boost::shared_ptr<DicomVolumeImage> volume,
65 IOracle& oracle, 97 IOracle& oracle,
66 IObservable& oracleObservable); 98 IObservable& oracleObservable,
99 float outliersHalfRejectionRate = 0.0005);
67 100
68 virtual ~OrthancMultiframeVolumeLoader(); 101 virtual ~OrthancMultiframeVolumeLoader();
69 102
70 bool IsPixelDataLoaded() const 103 bool IsPixelDataLoaded() const
71 { 104 {
72 return pixelDataLoaded_; 105 return pixelDataLoaded_;
73 } 106 }
74 107
108 void GetDistributionMinMax
109 (float& minValue, float& maxValue) const;
110
111 void GetDistributionMinMaxWithOutliersRejection
112 (float& minValue, float& maxValue) const;
113
75 void LoadInstance(const std::string& instanceId); 114 void LoadInstance(const std::string& instanceId);
76 }; 115 };
77 } 116 }