本文整理汇总了C++中CAVector::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CAVector::GetSize方法的具体用法?C++ CAVector::GetSize怎么用?C++ CAVector::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAVector
的用法示例。
在下文中一共展示了CAVector::GetSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveClosePoints
void CToolCervicales::RemoveClosePoints(CAVector& Vector, int Tol) {
CAVector Hector;
for (int j=0;j<Vector.GetSize();j++) {
if (Vector.GetSize() <= 4) return;
BOOL m_Add = TRUE;
for (int k=0;k<Hector.GetSize();k++) {
if (CAVector::Distance(Vector[j], Hector[k]) < Tol) {
Hector.Add(CPoint((Vector[j].x + Hector[k].x) / 2, (Vector[j].y + Hector[k].y) / 2));
Hector.Remove(k);
m_Add = FALSE;
break;
}
}
if (m_Add) Hector.Add(Vector[j]);
if (Vector.GetSize() <= 4) break;
}
Vector = Hector;
}
示例2: RemovePatternPoints
void CToolCervicales::RemovePatternPoints(CAVector& Vector){
BOOL Removed;
for (int k=Vector.GetSize()-1;k>=0;k--) {
// for each existing point do
Removed = FALSE;
if (Vector.GetSize() <= 4) break;
for (int m=0;m<Vector.GetSize();m++) {
for (int l=k+1;l<Vector.GetSize();l++){
if (Vector.GetSize() <= 4) break;
if ((k!=m)&&(k!=l)) {
if ((Vector[k].x >= Vector[m].x)&&(Vector[k].y >= Vector[m].y)&&
(Vector[k].x <= Vector[l].x)&&(Vector[k].y <= Vector[l].y)) {
Vector.Remove(k);
Removed = TRUE;
break;
}
if ((Vector[k].x <= Vector[m].x)&&(Vector[k].y <= Vector[m].y)&&
(Vector[k].x >= Vector[l].x)&&(Vector[k].y >= Vector[l].y)) {
Vector.Remove(k);
Removed = TRUE;
break;
}
if ((Vector[k].x >= Vector[m].x)&&(Vector[k].y <= Vector[m].y)&&
(Vector[k].x <= Vector[l].x)&&(Vector[k].y >= Vector[l].y)) {
Vector.Remove(k);
Removed = TRUE;
break;
}
if ((Vector[k].x <= Vector[m].x)&&(Vector[k].y >= Vector[m].y)&&
(Vector[k].x >= Vector[l].x)&&(Vector[k].y <= Vector[l].y)) {
Vector.Remove(k);
Removed = TRUE;
break;
}
}
}
if (Removed) break;
}
}
}
示例3: TraceContour
void CToolCervicales::TraceContour(CDib * m_Dib, CRxDoc * i_Document) {
theApp.ShowProgress("Tracing contour, please be patient.");
CList<CPoint, CPoint&> c_List;
CList<CPoint, CPoint&> total_List;
CList<CPoint, CPoint&> full_List[VERTEBRE_COUNT];
int full_ListCount = 0;
/* locate any first black pixel */
CSize m_DibSize = m_Dib->GetDimensions();
CPoint l_Point;
POSITION c_Pos;
int x, y;
for (x=0;x<m_DibSize.cx;x++) {
theApp.SetProgress(x * 100 / m_DibSize.cx);
for (y=0;y<m_DibSize.cy;y++) {
if (m_Dib->GetPixel(x, y) == 0) {
l_Point = CPoint(x,y);
if (FindInList(total_List, l_Point) == -1) {
c_List.RemoveAll();
AddNeighbors(m_Dib, c_List, l_Point, 6);
// copy to full list
c_Pos = c_List.GetHeadPosition();
while (c_Pos != NULL) total_List.AddTail(c_List.GetNext(c_Pos));
// find the smallest list
int f_Min = full_ListCount;
if (full_ListCount == VERTEBRE_COUNT) {
f_Min = 0;
//double f_Distance=0; for (int l=0;l<full_List[f_Min].GetCount()-1;l++) f_Distance+=CAVector::Distance(full_List[f_Min].GetAt(full_List[f_Min].FindIndex(l)), full_List[f_Min].GetAt(full_List[f_Min].FindIndex(l+1)));
for (int i=1;i<VERTEBRE_COUNT;i++) {
//double i_Distance=0;
//for (int l=0;l<full_List[i].GetCount()-1;l++) i_Distance+=CAVector::Distance(full_List[i].GetAt(full_List[i].FindIndex(l)), full_List[i].GetAt(full_List[i].FindIndex(l+1)));
if (full_List[i].GetCount() < full_List[f_Min].GetCount())
//if (i_Distance < f_Distance)
f_Min = i;
}
} else full_ListCount++;
// copy to array of lists
full_List[f_Min].RemoveAll();
c_Pos = c_List.GetHeadPosition();
while (c_Pos != NULL) full_List[f_Min].AddTail(c_List.GetNext(c_Pos));
//TraceContourTRACER(m_Dib, l_Point, c_List);
}
}
}
}
/* Segmentation */
if (full_ListCount >= REAL_VERTEBRE_COUNT) {
m_Dib->Cnv24Bit();
m_Dib->Invert();
CAVector AVectors[VERTEBRE_COUNT];
CAVector RealVectors[REAL_VERTEBRE_COUNT];
int l, k;
for (l=0; l<full_ListCount;l++) {
AVectors[l] = SegmentationGlob(m_Dib, i_Document, full_List[l]);
AVectors[l].RecalcDistance();
//break;
CString Msg; Msg.Format("Segmentation for object %d done.", l);
theApp.SetProgress(Msg);
}
/* remove vectors of minimal length */
for (l=0;l<REAL_VERTEBRE_COUNT;l++) {
int MaxIndex = 0;
for (k=1;k<full_ListCount;k++) {
if (AVectors[k].GetSize() && (AVectors[k].GetDistance() > AVectors[MaxIndex].GetDistance())) MaxIndex = k;
}
if (AVectors[MaxIndex].GetSize()){
//i_Document->Add(AVectors[MaxIndex]);
RealVectors[l] = AVectors[MaxIndex];
AVectors[MaxIndex].RemoveAll();
AVectors[MaxIndex].RecalcDistance();
}
}
/* create a vector of leftmost points only */
CAVector FrontVector;
int l_Pos, s_Pos;
for (l=0;l<REAL_VERTEBRE_COUNT;l++) {
// find the leftmost point
l_Pos = 0; for (k=1;k<RealVectors[l].GetSize();k++) if (RealVectors[l].GetAt(k).x < RealVectors[l].GetAt(l_Pos).x) l_Pos = k;
FrontVector.Add(RealVectors[l].GetAt(l_Pos));
// find the second leftmost point
s_Pos = 0; for (k=1;k<RealVectors[l].GetSize();k++) if ((RealVectors[l].GetAt(k).x < RealVectors[l].GetAt(s_Pos).x)&&(k!=l_Pos)) s_Pos = k;
if (s_Pos != l_Pos) FrontVector.Add(RealVectors[l].GetAt(s_Pos));
}
FrontVector.SortY();
while (FrontVector.GetSize() < 14) FrontVector.Add(CPoint(FrontVector[FrontVector.GetSize()-1].x + 5, FrontVector[FrontVector.GetSize()-1].y + 5));
i_Document->Add(FrontVector);
} else MessageBox(::GetFocus(), "Insufficient trace zones detected!", "Cervicales Tracer Error", MB_OK | MB_ICONERROR);
theApp.HideProgress();
}