Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyMaskLayer.cpp @ 480:2f6ecb5037ea am-touch-events
added mouse tracker for Layer Mask. Everything seems ok
author | am@osimis.io |
---|---|
date | Thu, 14 Feb 2019 10:18:02 +0100 |
parents | e3d316ba34ba |
children | 159a465e27bd |
comparison
equal
deleted
inserted
replaced
479:e3d316ba34ba | 480:2f6ecb5037ea |
---|---|
40 const AffineTransform2D& RadiographyMaskLayer::GetTransformInverse() const | 40 const AffineTransform2D& RadiographyMaskLayer::GetTransformInverse() const |
41 { | 41 { |
42 return dicomLayer_.GetTransformInverse(); | 42 return dicomLayer_.GetTransformInverse(); |
43 } | 43 } |
44 | 44 |
45 bool RadiographyMaskLayer::GetPixel(unsigned int& imageX, | |
46 unsigned int& imageY, | |
47 double sceneX, | |
48 double sceneY) const | |
49 { | |
50 return dicomLayer_.GetPixel(imageX, imageY, sceneX, sceneY); | |
51 } | |
52 | |
53 | |
45 void ComputeMaskExtent(unsigned int& left, unsigned int& right, unsigned int& top, unsigned int& bottom, const std::vector<MaskPoint>& corners) | 54 void ComputeMaskExtent(unsigned int& left, unsigned int& right, unsigned int& top, unsigned int& bottom, const std::vector<MaskPoint>& corners) |
46 { | 55 { |
47 left = std::numeric_limits<unsigned int>::max(); | 56 left = std::numeric_limits<unsigned int>::max(); |
48 right = std::numeric_limits<unsigned int>::min(); | 57 right = std::numeric_limits<unsigned int>::min(); |
49 top = std::numeric_limits<unsigned int>::max(); | 58 top = std::numeric_limits<unsigned int>::max(); |
57 bottom = std::max(p.y, bottom); | 66 bottom = std::max(p.y, bottom); |
58 top = std::min(p.y, top); | 67 top = std::min(p.y, top); |
59 } | 68 } |
60 } | 69 } |
61 | 70 |
71 void RadiographyMaskLayer::SetCorner(const MaskPoint& corner, size_t index) | |
72 { | |
73 if (index < corners_.size()) | |
74 corners_[index] = corner; | |
75 else | |
76 corners_.push_back(corner); | |
77 invalidated_ = true; | |
78 } | |
79 | |
62 void RadiographyMaskLayer::SetCorners(const std::vector<MaskPoint>& corners) | 80 void RadiographyMaskLayer::SetCorners(const std::vector<MaskPoint>& corners) |
63 { | 81 { |
64 corners_ = corners; | 82 corners_ = corners; |
65 invalidated_ = true; | 83 invalidated_ = true; |
66 } | 84 } |
159 nodes = 0; | 177 nodes = 0; |
160 j = cpSize - 1; | 178 j = cpSize - 1; |
161 | 179 |
162 for (i = 0; i < cpSize; i++) | 180 for (i = 0; i < cpSize; i++) |
163 { | 181 { |
164 if ((cpy[i] <= y && cpy[j] >= y) | 182 if ((cpy[i] < y && cpy[j] >= y) |
165 || (cpy[j] <= y && cpy[i] >= y)) | 183 || (cpy[j] < y && cpy[i] >= y)) |
166 { | 184 { |
167 nodeX[nodes++]= (int)(cpx[i] + (y - cpy[i])/(cpy[j] - cpy[i]) *(cpx[j] - cpx[i])); | 185 nodeX[nodes++]= (int)(cpx[i] + (y - cpy[i])/(cpy[j] - cpy[i]) *(cpx[j] - cpx[i])); |
168 } | 186 } |
169 j=i; | 187 j=i; |
170 } | 188 } |