当前位置: 首页>>代码示例>>C++>>正文


C++ CAVector::Add方法代码示例

本文整理汇总了C++中CAVector::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ CAVector::Add方法的具体用法?C++ CAVector::Add怎么用?C++ CAVector::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAVector的用法示例。


在下文中一共展示了CAVector::Add方法的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;		
}
开发者ID:dblock,项目名称:rxcervicales,代码行数:18,代码来源:ToolCervicales.cpp

示例2: SegmentationGlob

CAVector CToolCervicales::SegmentationGlob(CDib * m_Dib, CRxDoc * i_Document, CList<CPoint, CPoint&>& i_List) {
	CList<CPoint, CPoint&> Result;
	
	Result.AddTail(i_List.GetHead());
	Segmentation(m_Dib, i_Document, i_List.GetHeadPosition(), i_List.GetTailPosition(), i_List, 0, Result);
	Result.AddTail(i_List.GetTail());

	CAVector Vector; CPoint l_Point;
	POSITION c_Pos = Result.GetHeadPosition();
	while (c_Pos != NULL) {
		l_Point = Result.GetNext(c_Pos);
		Vector.Add(CPoint(l_Point.x, m_Dib->GetHeight()-l_Point.y));
	}
	/* replace very close points by an intermediate value */	
	for (int i=2;i<(int)((double)(m_Dib->GetWidth() + m_Dib->GetHeight())/2 * 0.03);i++) RemoveClosePoints(Vector, i);
	/* remove pattern points */
	RemovePatternPoints(Vector);
	//i_Document->Add(Vector);
	return Vector;
}
开发者ID:dblock,项目名称:rxcervicales,代码行数:20,代码来源:ToolCervicales.cpp

示例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();		
}
开发者ID:dblock,项目名称:rxcervicales,代码行数:92,代码来源:ToolCervicales.cpp


注:本文中的CAVector::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。