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


C++ McDArray::resize方法代码示例

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


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

示例1: preparePoints

void HxCPDSpatialGraphWarp::preparePoints(McDArray<McVec3f>& p1,
                                          McDArray<McVec3f>& p2,
                                          SpatialGraphSelection& slice2,
                                          const HxSpatialGraph* spatialGraph) {
    ma::SliceSelector selectionHelper(spatialGraph, "TransformInfo");

    ma::EndPointParams params;
    params.endPointRegion = 30;
    params.projectionPlane = selectionHelper.computeMidPlane(0, 1);
    params.projectionType = ma::P_ORTHOGONAL;
    params.refSliceNum = 0;
    params.transSliceNum = 1;
    params.useAbsoluteValueForEndPointRegion = false;
    params.maxDistForAngle = 2000;
    params.angleToPlaneFilter = 0.01;
    SpatialGraphSelection slice1;
    ma::FacingPointSets pr =
        ma::projectEndPoints(spatialGraph, slice1, slice2, params);
    McDArray<McVec3f> refCoords = pr.ref.positions;
    McDArray<McVec3f> transCoords = pr.trans.positions;
    mcassert(refCoords.size() == slice1.getNumSelectedVertices());
    mcassert(transCoords.size() == slice2.getNumSelectedVertices());

    p1.resize(refCoords.size());
    for (int i = 0; i < refCoords.size(); i++) {
        McVec3f coord = refCoords[i];
        p1[i] = McVec3f(coord.x, coord.y, 0);
    }
    p2.resize(transCoords.size());
    for (int i = 0; i < transCoords.size(); i++) {
        McVec3f coord = transCoords[i];
        p2[i] = McVec3f(coord.x, coord.y, 0);
    }
    mcassert(p2.size() == slice2.getNumSelectedVertices());
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:35,代码来源:HxCPDSpatialGraphWarp.cpp

示例2: getAssignmentsForVariable

void BruteForceOptMatching::getAssignmentsForVariable(
    const int variableLabel,
    McDArray<int>& indicesThisVariableCanBeAssignedTo) {
    indicesThisVariableCanBeAssignedTo.resize(0);
    for (int i = 0; i < mVariableAssignmentMat.nCols(); i++) {
        if (mVariableAssignmentMat[variableLabel][i] > 0)
            indicesThisVariableCanBeAssignedTo.append(i);
    }
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:9,代码来源:BruteForceOptMatching.cpp

示例3:

static McDArray<McVec2d> asVec2dArray(const McDArray<McVec3f>& a) {
    McDArray<McVec2d> b;
    b.resize(a.size());
    for (long i = 0; i < a.size(); i++) {
        b[i].x = a[i].x;
        b[i].y = a[i].y;
    }
    return b;
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:9,代码来源:cpd.cpp

示例4: prepareLandmarks

void HxMovingLeastSquaresWarp::prepareLandmarks(McDArray<McVec2d>& p1,
                                               McDArray<McVec2d>& p2) {
    int set1 = 0;
    int set2 = 1;

    HxLandmarkSet* pointSet = hxconnection_cast<HxLandmarkSet>(portData);

    if (!pointSet)
        return;

    p1.resize(0);
    p2.resize(0);
    int nPoints = pointSet->getNumMarkers();
    for (int i = 0; i < nPoints; i++) {
        p1.append(McVec2d(pointSet->getCoords(set1)[i].x,
                          pointSet->getCoords(set1)[i].y));
        p2.append(McVec2d(pointSet->getCoords(set2)[i].x,
                          pointSet->getCoords(set2)[i].y));
    }
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:20,代码来源:HxMovingLeastSquaresWarp.cpp

示例5: getAssignedValuesForVar

void BruteForceOptMatching::getAssignedValuesForVar(
    const McDMatrix<float>& allValues,
    const McDMatrix<int>& variableAssignmentMat,
    const McDArray<int>& possibleAssignments, const int label,
    const float zeroVal, McDArray<float>& values) {
    values.resize(0);
    for (int i = 0; i < possibleAssignments.size(); i++) {
        if (variableAssignmentMat[label][possibleAssignments[i]] > 1.e-6) {
            values.append(allValues[label][possibleAssignments[i]]);
        } else
            values.append(zeroVal);
    }
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:13,代码来源:BruteForceOptMatching.cpp

示例6: getConnectedComponent

// Computes all variables that form a connected component in the
// adjacenceMatrix.
// The connected component chosen is arbitrary - it takes the first it finds.
bool BruteForceOptMatching::getConnectedComponent(
    const McDMatrix<int>& adjacenceMatrix,
    McDMatrix<int>& adjacenceMatrixWithoutConnctedComponent,
    McDArray<int>& connComp) {
    adjacenceMatrixWithoutConnctedComponent.resize(adjacenceMatrix.nRows(),
                                                   adjacenceMatrix.nCols());
    memcpy(adjacenceMatrixWithoutConnctedComponent.dataPtr(),
           adjacenceMatrix.dataPtr(),
           sizeof(int) * adjacenceMatrix.nRows() * adjacenceMatrix.nCols());

    // find first a startpoint
    int start = -1;
    connComp.resize(0);
    for (int i = 0; i < adjacenceMatrix.nRows(); i++) {
        for (int j = i; j < adjacenceMatrix.nCols(); j++) {
            if (adjacenceMatrix[i][j] == 1) {
                start = i;
                break;
            }
        }
    }
    if (start == -1)
        return false;

    McDArray<int> queue;
    queue.append(start);
    connComp.clear();
    while (queue.size() > 0) {
        int cur = queue.last();
        connComp.append(cur);
        queue.pop_back();
        for (int i = 0; i < adjacenceMatrixWithoutConnctedComponent.nCols();
             i++) {
            if (adjacenceMatrixWithoutConnctedComponent[cur][i] == 1) {
                queue.push(i);
                adjacenceMatrixWithoutConnctedComponent[cur][i] = 0;
            }
        }
    }
    // remove duplicates
    connComp.sort(&mcStandardCompare);
    int cur = connComp.last();
    for (int i = connComp.size() - 2; i >= 0; i--) {
        if (cur == connComp[i])
            connComp.remove(i, 1);
        else
            cur = connComp[i];
    }
    return true;
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:53,代码来源:BruteForceOptMatching.cpp

示例7: getSingletonProbs

void BruteForceOptMatching::getSingletonProbs(
    const McDMatrix<float>& angleMatrix,
    const McDMatrix<float>& projDistanceMatrix,
    const McDMatrix<float>& distanceMatrix3d,
    const McDMatrix<int>& variableAssignmentMat,
    const McDArray<int>& assignments, const int varLabel,
    McDArray<double>& probs) {
    McDArray<float> floatProbs;
    getSingletonProbs(angleMatrix, projDistanceMatrix, distanceMatrix3d,
                      variableAssignmentMat, assignments, varLabel, floatProbs);

    probs.resize(floatProbs.size());
    for (int i = 0; i < floatProbs.size(); ++i)
        probs[i] = floatProbs[i];
}
开发者ID:zibamira,项目名称:microtubulestitching,代码行数:15,代码来源:BruteForceOptMatching.cpp


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