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


C++ MetaData::getColumnValues方法代码示例

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


在下文中一共展示了MetaData::getColumnValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sin

void ProgValidationNonTilt::obtainSumU_2(const MetaData & mdGallery, const MetaData & tempMd,std::vector<double> & sum_u,std::vector<double> & H0)
{

	const size_t tempMdSz= tempMd.size();
	const size_t numGallery= mdGallery.size();

    double xRan,yRan,zRan;
    size_t indx;
    double sumWRan;
    double * xRanArray = new double[tempMdSz];
    double * yRanArray = new double[tempMdSz];
    double * zRanArray  = new double[tempMdSz];
    std::vector<double> weightV;
    double a;

    double rot,tilt,w;
    bool mirror;

    for (size_t n=0; n<sum_u.size(); n++)
    {
        sumWRan = 0;

        for (size_t nS=0; nS<tempMd.size(); nS++)
        {
			indx = (size_t) (double( std::rand())*numGallery)/RAND_MAX;

			while ( (indx ==0) || (indx > numGallery) )
				indx = (size_t) (double( std::rand())*numGallery )/RAND_MAX;

        	mdGallery.getValue(MDL_ANGLE_ROT,rot,indx);
        	mdGallery.getValue(MDL_ANGLE_TILT,tilt,indx);
        	mdGallery.getValue(MDL_FLIP,mirror,indx);

            if (mirror == 1)
            	tilt = tilt + 180;

            xRan = sin(tilt*PI/180.)*cos(rot*PI/180.);
            yRan = sin(tilt*PI/180.)*sin(rot*PI/180.);
            zRan = std::abs(cos(tilt*PI/180.));

            xRanArray[nS] = xRan;
            yRanArray[nS] = yRan;
            zRanArray[nS] = zRan;
            //tempMd.getColumnValues(MDL_WEIGHT, weightV);
            tempMd.getColumnValues(MDL_MAXCC, weightV);
            std::random_shuffle(weightV.begin(), weightV.end());
        }


        sumWRan = 0;
        double WRan=0;
        double tempWRan, tempW1, tempW2, temp;
        for (size_t nS1=0; nS1<tempMd.size(); nS1++)
        {
            tempWRan = 1e3;
            for (size_t nS2=0; nS2<tempMd.size(); nS2++)
            {
            	temp = xRanArray[nS1]*xRanArray[nS2]+yRanArray[nS1]*yRanArray[nS2]+zRanArray[nS1]*zRanArray[nS2];
                if (temp < 1)
                	a = std::abs(std::acos(temp));
                else
                	a = 0;

                if ( (a<tempWRan) && (a > 0.00001) && (temp<1) )
                {
                    tempWRan = a;
                    tempW2 = weightV[nS2];
                    tempW1 = weightV[nS1];
                    WRan = a*std::exp(std::abs(tempW1-tempW2))*std::exp(-(tempW1+tempW2));
                    if (WRan == 0)
                    	WRan = a;
                }
            }
            sumWRan += WRan;
        }

        if (sumWRan == 0)
        	sumWRan = 0.075*tempMd.size();

        sum_u.at(n)=sumWRan;

    }

    size_t idx = 0;
    while (idx < sum_u.size())
    {
        std::random_shuffle(sum_u.begin(), sum_u.end());

        if(sum_u.at(0) != sum_u.at(1))
        {
            H0[idx] = sum_u.at(0)/(sum_u.at(0)+sum_u.at(1));
            idx += 1;
        }
    }

    delete xRanArray;
    delete yRanArray;
    delete zRanArray;

}
开发者ID:azazellochg,项目名称:scipion,代码行数:100,代码来源:validation_nontilt.cpp

示例2: obtainSumU

void ProgValidationNonTilt::obtainSumU(const MetaData & tempMd,std::vector<double> & sum_u,std::vector<double> & H0)
{

	const size_t tempMdSz= tempMd.size();
    double xRan,yRan,zRan;
    double x,y;
    double sumWRan;
    double * xRanArray = new double[tempMdSz];
    double * yRanArray = new double[tempMdSz];
    double * zRanArray  = new double[tempMdSz];
    std::vector<double> weightV;
    double a;

    for (size_t n=0; n<sum_u.size(); n++)
    {
        sumWRan = 0;
        for (size_t nS=0; nS<tempMd.size(); nS++)
        {
             /*
                x = sin(tilt*PI/180)*cos(rot*PI/180);
        		y = sin(tilt*PI/180)*sin(rot*PI/180);
        		z = std::abs(cos(tilt*PI/180));
             */

        	//http://mathworld.wolfram.com/SpherePointPicking.html
        	x = 2*(double(std::rand())-RAND_MAX/2)/RAND_MAX;
        	y = 2*(double(std::rand())-RAND_MAX/2)/RAND_MAX;

        	while (x*x+y*y >= 1 )
        	{
            	x = 2*(std::rand()-RAND_MAX/2)/RAND_MAX;
            	y = 2*(std::rand()-RAND_MAX/2)/RAND_MAX;
        	}

        	xRan = 2*x*std::sqrt(1-x*x-y*y);
        	yRan = 2*y*std::sqrt(1-x*x-y*y);
        	zRan = std::abs(1-2*(x*x+y*y));

/*        	tilt = (double(std::rand())/RAND_MAX)*(PI);
        	rot  = (std::rand()-RAND_MAX/2)*(2*PI/RAND_MAX);
        	xRan = sin(tilt)*cos(rot);
        	yRan = sin(tilt)*sin(rot);
        	zRan = std::abs(cos(tilt));
*/
        	//std::cout << tilt << " " << rot << std::endl;
        	//std::cout << xRan << " " << yRan << " " << zRan << " " << std::endl;
            //zRan=(std::rand()-RAND_MAX/2);
            //norm = std::sqrt(xRan*xRan+yRan*yRan+zRan*zRan);
            //xRan = (xRan/norm);
            //yRan = (yRan/norm);
            //zRan = std::abs(zRan/norm);

            xRanArray[nS] = xRan;
            yRanArray[nS] = yRan;
            zRanArray[nS] = zRan;
            //tempMd.getColumnValues(MDL_WEIGHT, weightV);
            tempMd.getColumnValues(MDL_MAXCC, weightV);

            std::random_shuffle(weightV.begin(), weightV.end());
        }

        sumWRan = 0;
        double WRan=0;
        double tempWRan, tempW1, tempW2, temp;
        for (size_t nS1=0; nS1<tempMd.size(); nS1++)
        {
            tempWRan = 1e3;
            for (size_t nS2=0; nS2<tempMd.size(); nS2++)
            {
            	temp = xRanArray[nS1]*xRanArray[nS2]+yRanArray[nS1]*yRanArray[nS2]+zRanArray[nS1]*zRanArray[nS2];
                if (temp < 1)
                	a = std::abs(std::acos(temp));
                else
                	a = 0;

                if ( (a<tempWRan) && (a > 0.00001) && (temp<1) )
                {
                    tempWRan = a;
                    tempW2 = weightV[nS2];
                    tempW1 = weightV[nS1];
                    WRan = a*std::exp(std::abs(tempW1-tempW2))*std::exp(-(tempW1+tempW2));
                    if (WRan == 0)
                    	WRan = a;

                }
            }
            sumWRan += WRan;
        }

        if (sumWRan == 0)
        	sumWRan = 0.075*tempMd.size();

        sum_u.at(n)=sumWRan;

    }

    size_t idx = 0;
    while (idx < sum_u.size())
    {
        std::random_shuffle(sum_u.begin(), sum_u.end());
//.........这里部分代码省略.........
开发者ID:azazellochg,项目名称:scipion,代码行数:101,代码来源:validation_nontilt.cpp


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