本文整理汇总了C++中idataarray::Pointer::copyTuple方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::copyTuple方法的具体用法?C++ Pointer::copyTuple怎么用?C++ Pointer::copyTuple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idataarray::Pointer
的用法示例。
在下文中一共展示了Pointer::copyTuple方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assign_badpoints
//.........这里部分代码省略.........
int64_t neighpoint = 0;
DimType neighpoints[6];
neighpoints[0] = -dims[0] * dims[1];
neighpoints[1] = -dims[0];
neighpoints[2] = -1;
neighpoints[3] = 1;
neighpoints[4] = dims[0];
neighpoints[5] = dims[0] * dims[1];
size_t counter = 1;
int64_t count = 0;
int64_t kstride = 0, jstride = 0;
int32_t featurename, feature;
int32_t neighbor;
QVector<int32_t> n(m_FlaggedFeaturesPtr.lock()->getNumberOfTuples(), 0);
while (counter != 0)
{
counter = 0;
for (DimType k = 0; k < dims[2]; k++)
{
kstride = dims[0] * dims[1] * k;
for (DimType j = 0; j < dims[1]; j++)
{
jstride = dims[0] * j;
for (DimType i = 0; i < dims[0]; i++)
{
count = kstride + jstride + i;
featurename = m_FeatureIds[count];
if (featurename < 0)
{
counter++;
current = 0;
most = 0;
for (int32_t l = 0; l < 6; l++)
{
good = 1;
neighpoint = count + neighpoints[l];
if (l == 0 && k == 0) { good = 0; }
if (l == 5 && k == (dims[2] - 1)) { good = 0; }
if (l == 1 && j == 0) { good = 0; }
if (l == 4 && j == (dims[1] - 1)) { good = 0; }
if (l == 2 && i == 0) { good = 0; }
if (l == 3 && i == (dims[0] - 1)) { good = 0; }
if (good == 1)
{
feature = m_FeatureIds[neighpoint];
if (feature >= 0)
{
n[feature]++;
current = n[feature];
if (current > most)
{
most = current;
m_Neighbors[count] = neighpoint;
}
}
}
}
for (int32_t l = 0; l < 6; l++)
{
good = 1;
neighpoint = count + neighpoints[l];
if (l == 0 && k == 0) { good = 0; }
if (l == 5 && k == (dims[2] - 1)) { good = 0; }
if (l == 1 && j == 0) { good = 0; }
if (l == 4 && j == (dims[1] - 1)) { good = 0; }
if (l == 2 && i == 0) { good = 0; }
if (l == 3 && i == (dims[0] - 1)) { good = 0; }
if (good == 1)
{
feature = m_FeatureIds[neighpoint];
if (feature >= 0) { n[feature] = 0; }
}
}
}
}
}
}
QString attrMatName = m_FeatureIdsArrayPath.getAttributeMatrixName();
QList<QString> voxelArrayNames = m->getAttributeMatrix(attrMatName)->getAttributeArrayNames();
for (size_t j = 0; j < totalPoints; j++)
{
featurename = m_FeatureIds[j];
neighbor = m_Neighbors[j];
if (neighbor >= 0)
{
if (featurename < 0 && m_FeatureIds[neighbor] >= 0)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attrMatName)->getAttributeArray(*iter);
p->copyTuple(neighbor, j);
}
}
}
}
}
}
示例2: execute
//.........这里部分代码省略.........
neighpoints[3] = 1;
neighpoints[4] = dims[0];
neighpoints[5] = dims[0] * dims[1];
QVector<int32_t> n(numfeatures + 1, 0);
for (int32_t iteration = 0; iteration < m_NumIterations; iteration++)
{
for (DimType k = 0; k < dims[2]; k++)
{
kstride = dims[0] * dims[1] * k;
for (DimType j = 0; j < dims[1]; j++)
{
jstride = dims[0] * j;
for (DimType i = 0; i < dims[0]; i++)
{
count = kstride + jstride + i;
featurename = m_FeatureIds[count];
if (featurename == 0)
{
current = 0;
most = 0;
for (int32_t l = 0; l < 6; l++)
{
good = 1;
neighpoint = count + neighpoints[l];
if (l == 0 && (k == 0 || m_ZDirOn == false)) { good = 0; }
else if (l == 5 && (k == (dims[2] - 1) || m_ZDirOn == false)) { good = 0; }
else if (l == 1 && (j == 0 || m_YDirOn == false)) { good = 0; }
else if (l == 4 && (j == (dims[1] - 1) || m_YDirOn == false)) { good = 0; }
else if (l == 2 && (i == 0 || m_XDirOn == false)) { good = 0; }
else if (l == 3 && (i == (dims[0] - 1) || m_XDirOn == false)) { good = 0; }
if (good == 1)
{
feature = m_FeatureIds[neighpoint];
if (m_Direction == 0 && feature > 0)
{
m_Neighbors[neighpoint] = count;
}
if (feature > 0 && m_Direction == 1)
{
n[feature]++;
current = n[feature];
if (current > most)
{
most = current;
m_Neighbors[count] = neighpoint;
}
}
}
}
if (m_Direction == 1)
{
for (int32_t l = 0; l < 6; l++)
{
good = 1;
neighpoint = count + neighpoints[l];
if (l == 0 && k == 0) { good = 0; }
if (l == 5 && k == (dims[2] - 1)) { good = 0; }
if (l == 1 && j == 0) { good = 0; }
if (l == 4 && j == (dims[1] - 1)) { good = 0; }
if (l == 2 && i == 0) { good = 0; }
if (l == 3 && i == (dims[0] - 1)) { good = 0; }
if (good == 1)
{
feature = m_FeatureIds[neighpoint];
n[feature] = 0;
}
}
}
}
}
}
}
QString attrMatName = m_FeatureIdsArrayPath.getAttributeMatrixName();
QList<QString> voxelArrayNames = m->getAttributeMatrix(attrMatName)->getAttributeArrayNames();
for (size_t j = 0; j < totalPoints; j++)
{
featurename = m_FeatureIds[j];
int32_t neighbor = m_Neighbors[j];
if (neighbor >= 0)
{
if ( (featurename == 0 && m_FeatureIds[neighbor] > 0 && m_Direction == 1)
|| (featurename > 0 && m_FeatureIds[neighbor] == 0 && m_Direction == 0))
{
for(QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attrMatName)->getAttributeArray(*iter);
p->copyTuple(neighbor, j);
}
}
}
}
}
// If there is an error set this to something negative and also set a message
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例3: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AlignSections::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getDataContainerName());
size_t dims[3] = { 0, 0, 0 };
m->getGeometryAs<ImageGeom>()->getDimensions(dims);
int64_t xspot = 0, yspot = 0;
int64_t newPosition = 0;
int64_t currentPosition = 0;
std::vector<int64_t> xshifts(dims[2], 0);
std::vector<int64_t> yshifts(dims[2], 0);
find_shifts(xshifts, yshifts);
QList<QString> voxelArrayNames = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArrayNames();
size_t progIncrement = dims[2] / 100;
size_t prog = 1;
size_t progressInt = 0;
size_t slice = 0;
for (size_t i = 1; i < dims[2]; i++)
{
if (i > prog)
{
progressInt = ((float)i / dims[2]) * 100.0f;
QString ss = QObject::tr("Transferring Cell Data || %1% Complete").arg(progressInt);
notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss);
prog = prog + progIncrement;
}
if (getCancel() == true)
{
return;
}
slice = (dims[2] - 1) - i;
for (size_t l = 0; l < dims[1]; l++)
{
for (size_t n = 0; n < dims[0]; n++)
{
if (yshifts[i] >= 0) { yspot = l; }
else if (yshifts[i] < 0) { yspot = dims[1] - 1 - l; }
if (xshifts[i] >= 0) { xspot = n; }
else if (xshifts[i] < 0) { xspot = dims[0] - 1 - n; }
newPosition = (slice * dims[0] * dims[1]) + (yspot * dims[0]) + xspot;
currentPosition = (slice * dims[0] * dims[1]) + ((yspot + yshifts[i]) * dims[0]) + (xspot + xshifts[i]);
if ((yspot + yshifts[i]) >= 0 && (yspot + yshifts[i]) <= static_cast<int64_t>(dims[1]) - 1 && (xspot + xshifts[i]) >= 0
&& (xspot + xshifts[i]) <= static_cast<int64_t>(dims[0]) - 1)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArray(*iter);
p->copyTuple( static_cast<size_t>(currentPosition), static_cast<size_t>(newPosition));
}
}
if ((yspot + yshifts[i]) < 0 || (yspot + yshifts[i]) > static_cast<int64_t>(dims[1] - 1) || (xspot + xshifts[i]) < 0
|| (xspot + xshifts[i]) > static_cast<int64_t>(dims[0]) - 1)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArray(*iter);
EXECUTE_FUNCTION_TEMPLATE(this, initializeArrayValues, p, p, newPosition)
}
}
}
}
}
// If there is an error set this to something negative and also set a message
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例4: execute
//.........这里部分代码省略.........
QVector<int32_t> n(numfeatures + 1, 0);
QVector<int32_t> coordinationNumber(totalPoints, 0);
bool keepgoing = true;
int32_t counter = 1;
while (counter > 0 && keepgoing == true)
{
counter = 0;
if (m_Loop == false) { keepgoing = false; }
for (int64_t k = 0; k < dims[2]; k++)
{
kstride = dims[0] * dims[1] * k;
for (int64_t j = 0; j < dims[1]; j++)
{
jstride = dims[0] * j;
for (int64_t i = 0; i < dims[0]; i++)
{
point = kstride + jstride + i;
featurename = m_FeatureIds[point];
coordination = 0;
current = 0;
most = 0;
for (int32_t l = 0; l < 6; l++)
{
good = 1;
neighpoint = point + neighpoints[l];
if (l == 0 && k == 0) { good = 0; }
if (l == 5 && k == (dims[2] - 1)) { good = 0; }
if (l == 1 && j == 0) { good = 0; }
if (l == 4 && j == (dims[1] - 1)) { good = 0; }
if (l == 2 && i == 0) { good = 0; }
if (l == 3 && i == (dims[0] - 1)) { good = 0; }
if (good == 1)
{
feature = m_FeatureIds[neighpoint];
if ((featurename > 0 && feature == 0) || (featurename == 0 && feature > 0))
{
coordination = coordination + 1;
n[feature]++;
current = n[feature];
if (current > most)
{
most = current;
m_Neighbors[point] = neighpoint;
}
}
}
}
coordinationNumber[point] = coordination;
int32_t neighbor = m_Neighbors[point];
if (coordinationNumber[point] >= m_CoordinationNumber && coordinationNumber[point] > 0)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attrMatName)->getAttributeArray(*iter);
p->copyTuple(neighbor, point);
}
}
for (int32_t l = 0; l < 6; l++)
{
good = 1;
neighpoint = point + neighpoints[l];
if (l == 0 && k == 0) { good = 0; }
if (l == 5 && k == (dims[2] - 1)) { good = 0; }
if (l == 1 && j == 0) { good = 0; }
if (l == 4 && j == (dims[1] - 1)) { good = 0; }
if (l == 2 && i == 0) { good = 0; }
if (l == 3 && i == (dims[0] - 1)) { good = 0; }
if (good == 1)
{
feature = m_FeatureIds[neighpoint];
if (feature > 0) { n[feature] = 0; }
}
}
}
}
}
for (int64_t k = 0; k < dims[2]; k++)
{
kstride = static_cast<int64_t>(dims[0] * dims[1] * k);
for (int64_t j = 0; j < dims[1]; j++)
{
jstride = static_cast<int64_t>(dims[0] * j);
for (int64_t i = 0; i < dims[0]; i++)
{
point = kstride + jstride + i;
if (coordinationNumber[point] >= m_CoordinationNumber)
{
counter++;
}
}
}
}
}
// If there is an error set this to something negative and also set a message
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例5: execute
//.........这里部分代码省略.........
setErrorCondition(-952);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
int64_t XP = ( (m_XMax - m_XMin) + 1 );
int64_t YP = ( (m_YMax - m_YMin) + 1 );
int64_t ZP = ( (m_ZMax - m_ZMin) + 1 );
int64_t col = 0, row = 0, plane = 0;
int64_t colold = 0, rowold = 0, planeold = 0;
int64_t index = 0;
int64_t index_old = 0;
QList<QString> voxelArrayNames = cellAttrMat->getAttributeArrayNames();
for (int64_t i = 0; i < ZP; i++)
{
QString ss = QObject::tr("Cropping Volume - Slice %1 of %2 Complete").arg(i).arg(ZP);
notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss);
planeold = (i + m_ZMin) * (srcCellDataContainer->getGeometryAs<ImageGeom>()->getXPoints() * srcCellDataContainer->getGeometryAs<ImageGeom>()->getYPoints());
plane = (i * XP * YP);
for (int64_t j = 0; j < YP; j++)
{
rowold = (j + m_YMin) * srcCellDataContainer->getGeometryAs<ImageGeom>()->getXPoints();
row = (j * XP);
for (int64_t k = 0; k < XP; k++)
{
colold = (k + m_XMin);
col = k;
index_old = planeold + rowold + colold;
index = plane + row + col;
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = cellAttrMat->getAttributeArray(*iter);
p->copyTuple(index_old, index);
}
}
}
}
destCellDataContainer->getGeometryAs<ImageGeom>()->setDimensions(static_cast<size_t>(XP), static_cast<size_t>(YP), static_cast<size_t>(ZP));
totalPoints = destCellDataContainer->getGeometryAs<ImageGeom>()->getNumberOfElements();
QVector<size_t> tDims(3, 0);
tDims[0] = XP;
tDims[1] = YP;
tDims[2] = ZP;
cellAttrMat->setTupleDimensions(tDims); // THIS WILL CAUSE A RESIZE of all the underlying data arrays.
if (m_RenumberFeatures == true)
{
totalPoints = destCellDataContainer->getGeometryAs<ImageGeom>()->getNumberOfElements();
// This just sanity checks to make sure there were existing features before the cropping
AttributeMatrix::Pointer cellFeatureAttrMat = srcCellDataContainer->getAttributeMatrix(getCellFeatureAttributeMatrixPath().getAttributeMatrixName());
size_t totalFeatures = cellFeatureAttrMat->getNumTuples();
QVector<bool> activeObjects(totalFeatures, false);
if (0 == totalFeatures)
{
setErrorCondition(-600);
notifyErrorMessage(getHumanLabel(), "The number of Features is 0 and should be greater than 0", getErrorCondition());
return;
}
//QVector<size_t> cDims(1, 1);
DataArrayPath dap = getFeatureIdsArrayPath();
if(getSaveAsNewDataContainer())
{
dap.setDataContainerName(getNewDataContainerName());
示例6: execute
//.........这里部分代码省略.........
/**fit x and y shifts to lines
*
* y = mx + b
*
* m = (n*sum(x_i * y_i) - sum(x_i) * sum(y_i)) / (n*sum(x_i^2)-sum(x_i)^2
*
* b = (sum(y_i)-m*sum(x_i))/n
*
*/
// same for both
double sumX = 0.0; // sum(x_i)
double sumX_2 = 0.0; // sum(x_i^2)
// x shift line
double x_sumY = 0.0; // sum(y_i)
double x_sumXY = 0.0; // sum(x_i * y_i)
// y shift line
double y_sumY = 0.0; // sum(y_i)
double y_sumXY = 0.0; // sum(x_i * y_i)
for (DimType iter = 0; iter < dims[2]; iter++)
{
slice = static_cast<DimType>( (dims[2] - 1) - iter );
sumX = static_cast<double>(sumX + iter);
sumX_2 = static_cast<double>(sumX_2 + iter * iter);
x_sumY = static_cast<double>(x_sumY + xshifts[iter]);
x_sumXY = static_cast<double>(x_sumXY + iter * xshifts[iter]);
y_sumY = static_cast<double>(y_sumY + yshifts[iter]);
y_sumXY = static_cast<double>(y_sumXY + iter * yshifts[iter]);
}
double mx = static_cast<double>((dims[2] * x_sumXY - x_sumXY) / (dims[2] * sumX_2 - sumX));
double my = static_cast<double>((dims[2] * y_sumXY - y_sumXY) / (dims[2] * sumX_2 - sumX));
// adjust shifts so that fit line has 0 slope (~ends of the sample are fixed)
for (DimType iter = 1; iter < dims[2]; iter++)
{
slice = (dims[2] - 1) - iter;
xshifts[iter] = static_cast<int64_t>(xshifts[iter] - iter * mx);
yshifts[iter] = static_cast<int64_t>(yshifts[iter] - iter * my);
}
}
QList<QString> voxelArrayNames = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArrayNames();
DimType progIncrement = dims[2] / 100;
DimType prog = 1;
DimType progressInt = 0;
for (DimType i = 1; i < dims[2]; i++)
{
if (i > prog)
{
progressInt = ((float)i / dims[2]) * 100.0f;
QString ss = QObject::tr("Transferring Cell Data || %1% Complete").arg(progressInt);
notifyStatusMessage(getMessagePrefix(), getHumanLabel(), ss);
prog = prog + progIncrement;
}
if (getCancel() == true)
{
return;
}
slice = (dims[2] - 1) - i;
for (DimType l = 0; l < dims[1]; l++)
{
for (DimType n = 0; n < dims[0]; n++)
{
if (yshifts[i] >= 0) { yspot = l; }
else if (yshifts[i] < 0) { yspot = dims[1] - 1 - l; }
if (xshifts[i] >= 0) { xspot = n; }
else if (xshifts[i] < 0) { xspot = dims[0] - 1 - n; }
newPosition = (slice * dims[0] * dims[1]) + (yspot * dims[0]) + xspot;
currentPosition = (slice * dims[0] * dims[1]) + ((yspot + yshifts[i]) * dims[0]) + (xspot + xshifts[i]);
if ((yspot + yshifts[i]) >= 0 && (yspot + yshifts[i]) <= dims[1] - 1 && (xspot + xshifts[i]) >= 0
&& (xspot + xshifts[i]) <= dims[0] - 1)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArray(*iter);
p->copyTuple(currentPosition, newPosition);
}
}
if ((yspot + yshifts[i]) < 0 || (yspot + yshifts[i]) > dims[1] - 1 || (xspot + xshifts[i]) < 0
|| (xspot + xshifts[i]) > dims[0] - 1)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArray(*iter);
p->initializeTuple(newPosition, 0);
}
}
}
}
}
// If there is an error set this to something negative and also set a message
notifyStatusMessage(getHumanLabel(), "Complete");
}