comparison Framework/Radiography/RadiographyMaskLayer.cpp @ 677:077f28e3ea3d am-dev

clip mask before drawing
author Alain Mazy <alain@mazy.be>
date Thu, 16 May 2019 10:46:35 +0200
parents 42dadae61fa9
children a5f2a6b04a31
comparison
equal deleted inserted replaced
676:1b47f17863ba 677:077f28e3ea3d
133 void RadiographyMaskLayer::DrawMask() const 133 void RadiographyMaskLayer::DrawMask() const
134 { 134 {
135 // first fill the complete image 135 // first fill the complete image
136 Orthanc::ImageProcessing::Set(*mask_, OUT_MASK_VALUE); 136 Orthanc::ImageProcessing::Set(*mask_, OUT_MASK_VALUE);
137 137
138 // clip corners
139 std::vector<Orthanc::ImageProcessing::ImagePoint> clippedCorners;
140 for (size_t i = 0; i < corners_.size(); i++)
141 {
142 clippedCorners.push_back(corners_[i]);
143 clippedCorners[i].ClipTo(0, mask_->GetWidth() - 1, 0, mask_->GetHeight() - 1);
144 }
145
138 // fill mask 146 // fill mask
139 Orthanc::ImageProcessing::FillPolygon(*mask_, corners_, IN_MASK_VALUE); 147 Orthanc::ImageProcessing::FillPolygon(*mask_, clippedCorners, IN_MASK_VALUE);
140 148
141 } 149 }
142 150
143 } 151 }