////////////////////////////////////////////////////////////////////// // Module Roi // // Roi manipulation and definition functions // // Rev. 1.0 February 22, 1999 ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "SCommon.h" #include "Roi.h" #include ".\roi.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif static const char *roi_stat[] = {"INVALID", "BAD", "MARGINAL", "GOOD"}; void CRoi::Remove(int i) { RemoveAt(i); if (m_selectIndex == i) m_selectIndex = -1; else if (m_selectIndex > i) m_selectIndex--; m_count--; } void CRoi::Insert(int i, int st, int en) { InsertAt(i, CRoiEntry(st, en)); m_count++; if (m_selectIndex >= i) m_selectIndex++; } int CRoi::InsertSorted(int st, int en) { int i; if (st < en) { for (i = 0; i < m_count; i++) { if (st < ElementAt(i).m_start) break; } Insert(i, st, en); } else i = -1; return i; } void CRoi::Clear(void) { RemoveAll(); m_count = 0; m_selectIndex = -1; } int CRoi::AtChannel(int chan) { int i; for (i = 0; i < m_count; i++) { if (ElementAt(i).m_start <= chan && ElementAt(i).m_end >= chan) break; } if (i == m_count) i = -1; return i; }