⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crosscorrelationagent.cpp

📁 3D reconstruction, medical image processing from colons, using intel image processing for based clas
💻 CPP
📖 第 1 页 / 共 3 页
字号:
double RxxCrossCorrelationAgent::IncreaseTransYvector(int lfPresentCC, double lfIncT, BYTE* pMap){	double CC =0.0;	int nIsTranslateCOUNTERState = EMPTYCOUNTER;	for(double lfTransY=m_lfTranslateYofFlt+lfIncT ; ; lfTransY +=lfIncT){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, lfTransY, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%d\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt,lfTransY,m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, lfTransY, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsTranslateCOUNTERState = EMPTYCOUNTER;		}		else if(nIsTranslateCOUNTERState!=FULLCOUNTER)	nIsTranslateCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::IncreaseTransZvector(int lfPresentCC, double lfIncT, BYTE* pMap){	double CC =0.0;	int nIsTranslateCOUNTERState = EMPTYCOUNTER;	for(double lfTransZ=m_lfTranslateZofFlt+lfIncT ; ; lfTransZ +=lfIncT){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, lfTransZ, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, lfTransZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, lfTransZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsTranslateCOUNTERState = EMPTYCOUNTER;		}		else if(nIsTranslateCOUNTERState!=FULLCOUNTER)	nIsTranslateCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::DecreaseTransXvector(int lfPresentCC, double lfIncT, BYTE* pMap){	double CC =0.0;	int nIsTranslateCOUNTERState = EMPTYCOUNTER;	for(double lfTransX=m_lfTranslateXofFlt-lfIncT ; ; lfTransX -=lfIncT){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, lfTransX, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,lfTransX,m_lfTranslateYofFlt,m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, lfTransX, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsTranslateCOUNTERState = EMPTYCOUNTER;		}		else if(nIsTranslateCOUNTERState!=FULLCOUNTER)	nIsTranslateCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::DecreaseTransYvector(int lfPresentCC, double lfIncT, BYTE* pMap){	double CC =0.0;	int nIsTranslateCOUNTERState = EMPTYCOUNTER;	for(double lfTransY=m_lfTranslateYofFlt-lfIncT ; ; lfTransY -=lfIncT){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, lfTransY, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt,lfTransY,m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, lfTransY, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsTranslateCOUNTERState = EMPTYCOUNTER;		}		else if(nIsTranslateCOUNTERState!=FULLCOUNTER)	nIsTranslateCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::DecreaseTransZvector(int lfPresentCC, double lfIncT, BYTE* pMap){	double CC =0.0;	int nIsTranslateCOUNTERState = EMPTYCOUNTER;	for(double lfTransZ=m_lfTranslateZofFlt-lfIncT ; ; lfTransZ -=lfIncT){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, lfTransZ, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);		//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, lfTransZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, lfTransZ, m_lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsTranslateCOUNTERState = EMPTYCOUNTER;		}		else if(nIsTranslateCOUNTERState!=FULLCOUNTER)	nIsTranslateCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::CWRotXvector(int lfPresentCC, double lfIncR, BYTE* pMap){	double CC =0.0;	int nIsThetaCOUNTERState = EMPTYCOUNTER;	for(double lfThetaX=m_lfThetaX+lfIncR ; ; lfThetaX +=lfIncR){		CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, lfThetaX, m_lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsThetaCOUNTERState = EMPTYCOUNTER;		}		else if(nIsThetaCOUNTERState!=FULLCOUNTER)	nIsThetaCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::CWRotYvector(int lfPresentCC, double lfIncR, BYTE* pMap){	double CC =0.0;	int nIsThetaCOUNTERState = EMPTYCOUNTER;	for(double lfThetaY=m_lfThetaY+lfIncR ; ; lfThetaY +=lfIncR){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsThetaCOUNTERState = EMPTYCOUNTER;		}		else if(nIsThetaCOUNTERState!=FULLCOUNTER)	nIsThetaCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::CWRotZvector(int lfPresentCC, double lfIncR, BYTE* pMap){	double CC =0.0;	int nIsThetaCOUNTERState = EMPTYCOUNTER;	for(double lfThetaZ=m_lfThetaZ+lfIncR ; ; lfThetaZ +=lfIncR){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, lfThetaZ);		//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, lfThetaZ);			lfPresentCC = CC;			nIsThetaCOUNTERState = EMPTYCOUNTER;		}		else if(nIsThetaCOUNTERState!=FULLCOUNTER)	nIsThetaCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::CCWRotXvector(int lfPresentCC, double lfIncR, BYTE* pMap){	double CC =0.0;	int nIsThetaCOUNTERState = EMPTYCOUNTER;	for(double lfThetaX=m_lfThetaX-lfIncR ; ; lfThetaX -=lfIncR){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, lfThetaX, m_lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%lf\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, lfThetaX, m_lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, lfThetaX, m_lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsThetaCOUNTERState = EMPTYCOUNTER;		}		else if(nIsThetaCOUNTERState!=FULLCOUNTER)	nIsThetaCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::CCWRotYvector(int lfPresentCC, double lfIncR, BYTE* pMap){	double CC =0.0;	int nIsThetaCOUNTERState = EMPTYCOUNTER;	for(double lfThetaY=m_lfThetaY-lfIncR ; ; lfThetaY -=lfIncR){				CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, lfThetaY, m_lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%d\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, lfThetaY, m_lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, lfThetaY, m_lfThetaZ);			lfPresentCC = CC;			nIsThetaCOUNTERState = EMPTYCOUNTER;		}		else if(nIsThetaCOUNTERState!=FULLCOUNTER)	nIsThetaCOUNTERState++;				else	break;			}	return lfPresentCC;}double RxxCrossCorrelationAgent::CCWRotZvector(int lfPresentCC, double lfIncR, BYTE* pMap){	double CC =0.0;	int nIsThetaCOUNTERState = EMPTYCOUNTER;	for(double lfThetaZ=m_lfThetaZ-lfIncR ; ; lfThetaZ -=lfIncR){		CC = ComputeCorrelation(pMap, m_pFltTraceInfo, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfThetaX, m_lfThetaY, lfThetaZ);//		TRACE(_T("Scale=(%lf,%lf,%lf), Translate=(%lf,%lf,%lf), Theta=(%lf,%lf,%lf), MI=%d\n"),m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ,m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, lfThetaZ, MI);		if(CC>lfPresentCC){			KeepParameter(m_lfGlobalScaleX, m_lfGlobalScaleY, m_lfGlobalScaleZ, m_lfTranslateXofFlt, m_lfTranslateYofFlt, m_lfTranslateZofFlt, m_lfThetaX, m_lfThetaY, lfThetaZ);			lfPresentCC = CC;			nIsThetaCOUNTERState = EMPTYCOUNTER;		}		else if(nIsThetaCOUNTERState!=FULLCOUNTER)	nIsThetaCOUNTERState++;				else	break;			}	return lfPresentCC;	}double RxxCrossCorrelationAgent::PartialVolumeInterplation(double lfTransformedX, double lfTransformedY, double lfTransformedZ, unsigned char* pRefMap){	int nTransformedXInt = (int)lfTransformedX;	int nTransformedYInt = (int)lfTransformedY;	int nTransformedZInt = (int)lfTransformedZ;	double XFract = lfTransformedX - (double)nTransformedXInt;	double YFract = lfTransformedY - (double)nTransformedYInt;	double ZFract = lfTransformedZ - (double)nTransformedZInt;	double w[8];	//compute weight	//Top	// w2 w1	n8	n7	// w3 w4	n5	n6	//Bottom	// w6 w5	n4	n3	// w7 w8	n1	n2	// Direction : Bottom to Top	int nOffsetX[8] = {0,1,1,0,0,1,1,0};	int nOffsetY[8] = {1,1,0,0,1,1,0,0};	int nOffsetZ[8] = {0,0,0,0,1,1,1,1};	ComputeSquareWeight(w, XFract, YFract, ZFract);	double lfValue = 0;	for(int nIndex =0 ; nIndex<8 ; nIndex++){		int nXRef = nTransformedXInt + nOffsetX[nIndex];		int nYRef = nTransformedYInt + nOffsetY[nIndex];		int nZRef = nTransformedZInt + nOffsetZ[nIndex];		int nRefValue = pRefMap[nZRef*m_pRefer->nVolX*m_pRefer->nVolY+nYRef*m_pRefer->nVolX+nXRef];		lfValue += (nRefValue*w[nIndex]);	}	return lfValue;}void RxxCrossCorrelationAgent::ComputeSquareWeight(double *w, double xFract, double yFract, double zFract){	//compute weight	//Top	// w1 w0	// w2 w3	//Bottom	// w5 w4	// w6 w7	double xFractComplement = (1-xFract);	double yFractComplement = (1-yFract);	double zFractComplement = (1-zFract);	w[0] = xFractComplement * yFract*zFractComplement;	w[1] = xFract * yFract*zFractComplement;	w[2] = xFract * yFractComplement*zFractComplement;	w[3] = xFractComplement * yFractComplement* zFractComplement;	w[4] = xFractComplement * yFract*zFract;	w[5] = xFract * yFract*zFract;	w[6] = xFract * yFractComplement*zFract;	w[7] = xFractComplement * yFractComplement* zFract;}double RxxCrossCorrelationAgent::NearestInterpolation(double lfTransformedX, double lfTransformedY, double lfTransformedZ, unsigned char* pRefMap){	int nTransformedXInt = (int)lfTransformedX;	int nTransformedYInt = (int)lfTransformedY;	int nTransformedZInt = (int)lfTransformedZ;	double XFract = lfTransformedX - (double)nTransformedXInt;	double YFract = lfTransformedY - (double)nTransformedYInt;	double ZFract = lfTransformedZ - (double)nTransformedZInt;	double w[8];	//compute weight	//Top	// w2 w1	// w3 w4	//Bottom	// w6 w5	// w7 w8	int nOffsetX[8] = {0,1,1,0,0,1,1,0};	int nOffsetY[8] = {1,1,0,0,1,1,0,0};	int nOffsetZ[8] = {0,0,0,0,1,1,1,1};			ComputeSquareWeight(w, XFract, YFract, ZFract);			double lfMaxWeight = 0;	int nMinDistIdx = 0;	for(int nIndex =0 ; nIndex<8 ; nIndex++){				if(lfMaxWeight < w[nIndex]){			lfMaxWeight = w[nIndex];			nMinDistIdx = nIndex;		}	}			int nXRef = nTransformedXInt + nOffsetX[nMinDistIdx];	int nYRef = nTransformedYInt + nOffsetY[nMinDistIdx];	int nZRef = nTransformedZInt + nOffsetZ[nMinDistIdx];	double lfRefValue = w[nMinDistIdx]*pRefMap[nZRef*m_pRefer->nVolX*m_pRefer->nVolY+nYRef*m_pRefer->nVolX+nXRef];		if(lfRefValue >0.0){		double lftemp = lfRefValue;	}		return lfRefValue;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -