150 likes | 282 Views
Region of Interest. Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University. ROI. ROI Region of Interest Rectangle Ellipse Polygon VOI Volume of Interest. Mouse Events. WM_LBUTTONDOWN
E N D
Region of Interest Ku-Yaw Chang canseco@mail.dyu.edu.tw Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University
ROI • ROI • Region of Interest • Rectangle • Ellipse • Polygon • VOI • Volume of Interest Medical Imaging System
Mouse Events • WM_LBUTTONDOWN • OnLButtonDown(UINT nFlags, CPoint point) • WM_LBUTTONUP • OnLButtonUp(UINT nFlags, CPoint point) • WM_LBUTTONDBLCLK • OnLButtonDblClk(UINT nFlags, CPoint point) Medical Imaging System
Parameters • nFlags • Indicates whether various virtual keys are down. This parameter can be any combination of the following values: • MK_CONTROL Set if the CTRL key is down. • MK_LBUTTON Set if the left mouse button is down. • MK_MBUTTON Set if the middle mouse button is down. • MK_RBUTTON Set if the right mouse button is down. • MK_SHIFT Set if the SHIFT key is down. • point • Specifies the x- and y-coordinate of the cursor. • These coordinates are always relative to the upper-left corner of the window. Medical Imaging System
CRect • Basic data members • left • Specifies the x-coordinate of the upper-left corner of a rectangle. • top • Specifies the y-coordinate of the upper-left corner of a rectangle. • right • Specifies the x-coordinate of the lower-right corner of a rectangle. • bottom • Specifies the y-coordinate of the lower-right corner of a rectangle. Medical Imaging System
ROI • Recorded as a rectangle • CRect • OnLButtonDown • CRect::left, CRect::top • OnLButtonUp • CRect::right, CRect::bottom Medical Imaging System
CRect::NormalizeRect • Example CRect rect1(110, 100, 250, 310); CRect rect2(250, 310, 110, 100); rect1.NormalizeRect(); rect2.NormalizeRect(); // rect1 should be unchanged // rect2 becomes (110, 100, 250, 310) Medical Imaging System
Draw an ROI • CPen • while • solid • CBrush Medical Imaging System
CPen CPen(intnPenStyle,intnWidth,COLORREFcrColor); • nPenStyle • Specifies the pen style. • PS_SOLID Creates a solid pen. • PS_DASH Creates a dashed pen. • PS_DOT Creates a dotted pen. • PS_NULL Creates a null pen. • nWidth • Specifies the width of the pen. • crColor • Contains an RGB color for the pen. Medical Imaging System
SelectObject (1) Pen A Pen B (2) Pen A Pen B (3) Pen A Pen B Medical Imaging System
Draw an ROI CRect rc(100,100, 200, 200); COLORREF crPen; crPen = RGB(255, 0, 0); CPen penRed(PS_SOLID, 1, crPen); CPen * pOldPen; pOldPen = pDC->SelectObject(&penRed); pDC->SelectStockObject(HOLLOW_BRUSH); pDC->Rectangle(&rc); pDC->SelectObject(pOldPen); Medical Imaging System
ROIs • Use list to store more than one CRect • Standard Template Library (STL) • List • Stack • Queue • Vector • … Medical Imaging System
list • Include • #include <list> • using namespace std; • Declaration • list <CRect> listROI; • Add • push_back, push_front • Remove • pop_back, pop_front Medical Imaging System
list • Iterate • list <CRect>::iterator i; • for (i = listPoint.begin(); i != listPoint.end(); ++i) • Miscel • size() • clear() • front() • back() Medical Imaging System