comparison Framework/Loaders/OrthancMultiframeVolumeLoader.h @ 1273:398ea4259e65

merge
author Alain Mazy <alain@mazy.be>
date Mon, 03 Feb 2020 14:57:22 +0100
parents 2d8ab34c8c91
children f4a06ad1580b
comparison
equal deleted inserted replaced
1272:a989c7d46b9a 1273:398ea4259e65
1 /** 1 /**
2 * Stone of Orthanc 2 * Stone of Orthanc
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium 4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium 5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 * 6 *
7 * This program is free software: you can redistribute it and/or 7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License 8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of 9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version. 10 * the License, or (at your option) any later version.
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 }