本文整理汇总了C++中datacontainer::Pointer::getAttributeMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::getAttributeMatrix方法的具体用法?C++ Pointer::getAttributeMatrix怎么用?C++ Pointer::getAttributeMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datacontainer::Pointer
的用法示例。
在下文中一共展示了Pointer::getAttributeMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preflight
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ChangeResolution::preflight()
{
setInPreflight(true);
emit preflightAboutToExecute();
emit updateFilterParameters(this);
dataCheck();
if (getErrorCondition() < 0)
{
emit preflightExecuted();
setInPreflight(false);
return;
}
DataContainer::Pointer m;
if (m_SaveAsNewDataContainer == false)
{
m = getDataContainerArray()->getDataContainer(getCellAttributeMatrixPath().getDataContainerName());
}
else
{
m = getDataContainerArray()->getDataContainer(getNewDataContainerName());
}
size_t dims[3] = { 0, 0, 0 };
m->getGeometryAs<ImageGeom>()->getDimensions(dims);
float sizex = (dims[0]) * m->getGeometryAs<ImageGeom>()->getXRes();
float sizey = (dims[1]) * m->getGeometryAs<ImageGeom>()->getYRes();
float sizez = (dims[2]) * m->getGeometryAs<ImageGeom>()->getZRes();
size_t m_XP = size_t(sizex / m_Resolution.x);
size_t m_YP = size_t(sizey / m_Resolution.y);
size_t m_ZP = size_t(sizez / m_Resolution.z);
if (m_XP == 0) { m_XP = 1; }
if (m_YP == 0) { m_YP = 1; }
if (m_ZP == 0) { m_ZP = 1; }
m->getGeometryAs<ImageGeom>()->setDimensions(m_XP, m_YP, m_ZP);
m->getGeometryAs<ImageGeom>()->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z);
QVector<size_t> tDims(3, 0);
tDims[0] = m_XP;
tDims[1] = m_YP;
tDims[2] = m_ZP;
m->getAttributeMatrix(getCellAttributeMatrixPath().getAttributeMatrixName())->setTupleDimensions(tDims);
if (m_RenumberFeatures == true)
{
AttributeMatrix::Pointer cellFeatureAttrMat = m->getAttributeMatrix(getCellFeatureAttributeMatrixPath().getAttributeMatrixName());
QVector<bool> activeObjects(cellFeatureAttrMat->getNumTuples(), true);
cellFeatureAttrMat->removeInactiveObjects(activeObjects, m_FeatureIdsPtr.lock());
}
emit preflightExecuted();
setInPreflight(false);
}
示例2: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void CombineAttributeMatrices::execute()
{
setErrorCondition(0);
dataCheck();
if (getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getFirstAttributeMatrixPath().getDataContainerName());
AttributeMatrix::Pointer firstAttrMat = m->getAttributeMatrix(getFirstAttributeMatrixPath().getAttributeMatrixName());
AttributeMatrix::Pointer secondAttrMat = m->getAttributeMatrix(getSecondAttributeMatrixPath().getAttributeMatrixName());
AttributeMatrix::Pointer combinedAttrMat = m->getAttributeMatrix(getCombinedAttributeMatrixName());
size_t firstAttrMatNumTuples = firstAttrMat->getNumTuples();
size_t totalTuples1 = m_SecondIndexPtr.lock()->getNumberOfTuples();
size_t totalTuples2 = m_SecondIndexPtr.lock()->getNumberOfTuples();
for (size_t i = 0; i < totalTuples1; i++)
{
if (m_FirstIndex > 0) { m_NewIndex[i] = m_FirstIndex[i]; }
}
for (size_t i = 0; i < totalTuples2; i++)
{
//subtract 1 from the index plus numTuples because the second index should be shifted to account for the zeroth tuple (all AMs above element start at tuple 1)
if (m_SecondIndex[i] > 0 && m_NewIndex[i] == 0) m_NewIndex[i] = m_SecondIndex[i] + firstAttrMatNumTuples - 1;
else if (m_SecondIndex[i] > 0 && m_NewIndex[i] != 0)
{
QString ss = QObject::tr("When copying the indices, the indices of the two attribute matrices overlapped. The index of the first attribute matrix was kept.");
notifyWarningMessage(getHumanLabel(), ss, -111);
}
}
QList<QString> arrayNames = firstAttrMat->getAttributeArrayNames();
size_t location = 0;
for (QList<QString>::iterator iter = arrayNames.begin(); iter != arrayNames.end(); ++iter)
{
IDataArray::Pointer fromDataArray = firstAttrMat->getAttributeArray(*iter);
IDataArray::Pointer toDataArray = combinedAttrMat->getAttributeArray(*iter);
EXECUTE_FUNCTION_TEMPLATE(this, copyData, fromDataArray, fromDataArray, toDataArray, location);
}
arrayNames.clear();
arrayNames = secondAttrMat->getAttributeArrayNames();
location = firstAttrMatNumTuples;
for (QList<QString>::iterator iter = arrayNames.begin(); iter != arrayNames.end(); ++iter)
{
IDataArray::Pointer fromDataArray = secondAttrMat->getAttributeArray(*iter);
IDataArray::Pointer toDataArray = combinedAttrMat->getAttributeArray(*iter);
EXECUTE_FUNCTION_TEMPLATE(this, copyData, fromDataArray, fromDataArray, toDataArray, location);
}
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例3: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SineParamsSegmentFeatures::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getDataContainerName());
QVector<size_t> tDims(1, 1);
m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->resizeAttributeArrays(tDims);
// This runs a subfilter
int64_t totalPoints = m_FeatureIdsPtr.lock()->getNumberOfTuples();
// Tell the user we are starting the filter
notifyStatusMessage(getMessagePrefix(), getHumanLabel(), "Starting");
//Convert user defined tolerance to radians.
//angleTolerance = m_AngleTolerance * SIMPLib::Constants::k_Pi / 180.0f;
for(int64_t i = 0; i < totalPoints; i++)
{
m_FeatureIds[i] = 0;
}
// Generate the random voxel indices that will be used for the seed points to start a new grain growth/agglomeration
const size_t rangeMin = 0;
const size_t rangeMax = totalPoints - 1;
initializeVoxelSeedGenerator(rangeMin, rangeMax);
SegmentFeatures::execute();
size_t totalFeatures = m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->getNumTuples();
if (totalFeatures < 2)
{
setErrorCondition(-87000);
notifyErrorMessage(getHumanLabel(), "The number of Features was 0 or 1 which means no features were detected. Is a threshold value set to high?", getErrorCondition());
return;
}
// By default we randomize grains
if (true == m_RandomizeFeatureIds)
{
randomizeFeatureIds(totalPoints, totalFeatures);
}
// If there is an error set this to something negative and also set a message
notifyStatusMessage(getHumanLabel(), "Completed");
}
示例4: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ConvertData::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(m_SelectedCellArrayPath.getDataContainerName());
IDataArray::Pointer iArray = m->getAttributeMatrix(m_SelectedCellArrayPath.getAttributeMatrixName())->getAttributeArray(m_SelectedCellArrayPath.getDataArrayName());
bool completed = false;
CHECK_AND_CONVERT(UInt8ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(Int8ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(UInt16ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(Int16ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(UInt32ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(Int32ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(UInt64ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(Int64ArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(FloatArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(DoubleArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
CHECK_AND_CONVERT(BoolArrayType, m, m_ScalarType, iArray, m_SelectedCellArrayPath.getAttributeMatrixName(), m_OutputArrayName)
/* Let the GUI know we are done with this filter */
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例5: getSeed
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int64_t EBSDSegmentFeatures::getSeed(int32_t gnum, int64_t nextSeed)
{
setErrorCondition(0);
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getDataContainerName());
size_t totalPoints = m_FeatureIdsPtr.lock()->getNumberOfTuples();
int64_t seed = -1;
// start with the next voxel after the last seed
size_t randpoint = static_cast<size_t>(nextSeed);
while (seed == -1 && randpoint < totalPoints)
{
if (m_FeatureIds[randpoint] == 0) // If the GrainId of the voxel is ZERO then we can use this as a seed point
{
if ((m_UseGoodVoxels == false || m_GoodVoxels[randpoint] == true) && m_CellPhases[randpoint] > 0)
{
seed = randpoint;
}
else { randpoint += 1; }
}
else { randpoint += 1; }
}
if (seed >= 0)
{
m_FeatureIds[seed] = gnum;
QVector<size_t> tDims(1, gnum + 1);
m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->resizeAttributeArrays(tDims);
updateFeatureInstancePointers();
}
return seed;
}
示例6: writePointScalarData
void writePointScalarData(DataContainer::Pointer dc, const QString& vertexAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, FILE* vtkFile, int nT)
{
IDataArray::Pointer data = dc->getAttributeMatrix(vertexAttributeMatrixName)->getAttributeArray(dataName);
QString ss;
if (NULL != data.get())
{
T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
fprintf(vtkFile, "\n");
fprintf(vtkFile, "SCALARS %s %s\n", dataName.toLatin1().data(), dataType.toLatin1().data());
fprintf(vtkFile, "LOOKUP_TABLE default\n");
for(int i = 0; i < nT; ++i)
{
T swapped = 0x00;
if(writeBinaryData == true)
{
swapped = static_cast<T>(m[i]);
SIMPLib::Endian::FromSystemToBig::convert(swapped);
fwrite(&swapped, sizeof(T), 1, vtkFile);
}
else
{
ss = QString::number(m[i]) + " ";
fprintf(vtkFile, "%s ", ss.toLatin1().data());
//if (i%50 == 0)
{ fprintf(vtkFile, "\n"); }
}
}
}
}
示例7: ReadPHFile
/**
*
* @param FileName
* @param data
* @param nx X Dimension
* @param ny Y Dimension
* @param nz Z Dimension
*/
int ReadPHFile(QString FileName, QVector<int>& data, int& nx, int& ny, int& nz)
{
DataContainerArray::Pointer dca = DataContainerArray::New();
DataContainer::Pointer m = DataContainer::New(); /* FIXME: What Geometry do we need? */
dca->pushBack(m);
FilterManager::Pointer fm = FilterManager::Instance();
AbstractFilter::Pointer reader = fm->getFactoryForFilter("PhReader")->create();
reader->setDataContainerArray(dca);
bool propWasSet = reader->setProperty("InputFile", FileName);
if(propWasSet == false)
{
}
reader->execute();
if (reader->getErrorCondition() < 0)
{
qDebug() << "Error Reading the Ph File '" << FileName << "' Error Code:" << reader->getErrorCondition();
return -1;
}
Int32ArrayType* featureIds = Int32ArrayType::SafePointerDownCast(m->getAttributeMatrix(DREAM3D::Defaults::CellAttributeMatrixName)->getAttributeArray(DREAM3D::CellData::FeatureIds).get());
size_t count = featureIds->getNumberOfTuples();
data.resize(count);
for(size_t i = 0; i < count; ++i)
{
data[i] = featureIds->getValue(i);
}
return 0;
}
示例8: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void LinkFeatureMapToElementArray::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getSelectedCellArrayPath().getDataContainerName());
size_t totalPoints = m_SelectedCellDataPtr.lock()->getNumberOfTuples();
int32_t maxIndex = 0;
std::vector<bool> active;
for (size_t i = 0; i < totalPoints; i++)
{
int32_t index = m_SelectedCellData[i];
if ((index + 1) > maxIndex)
{
active.resize(index + 1);
active[index] = true;
maxIndex = index + 1;
}
}
QVector<size_t> tDims(1, maxIndex);
m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->resizeAttributeArrays(tDims);
updateFeatureInstancePointers();
for (int32_t i = 0; i < maxIndex; i++)
{
m_Active[i] = active[i];
}
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例9: getSeed
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int64_t EBSDSegmentFeatures::getSeed(int32_t gnum)
{
setErrorCondition(0);
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getDataContainerName());
size_t totalPoints = m_FeatureIdsPtr.lock()->getNumberOfTuples();
int64_t seed = -1;
Generator& numberGenerator = *m_NumberGenerator;
while (seed == -1 && m_TotalRandomNumbersGenerated < totalPoints)
{
// Get the next voxel index in the precomputed list of voxel seeds
int64_t randpoint = numberGenerator();
m_TotalRandomNumbersGenerated++; // Increment this counter
if (m_FeatureIds[randpoint] == 0) // If the GrainId of the voxel is ZERO then we can use this as a seed point
{
if ((m_UseGoodVoxels == false || m_GoodVoxels[randpoint] == true) && m_CellPhases[randpoint] > 0)
{
seed = randpoint;
}
}
}
if (seed >= 0)
{
m_FeatureIds[seed] = gnum;
QVector<size_t> tDims(1, gnum + 1);
m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->resizeAttributeArrays(tDims);
updateFeatureInstancePointers();
}
return seed;
}
示例10: writeCellScalarData
void writeCellScalarData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, FILE* vtkFile, QMap<int32_t, int32_t>& featureIds, int32_t* m_SurfaceMeshFaceLabels)
{
TriangleGeom::Pointer triangleGeom = dc->getGeometryAs<TriangleGeom>();
int64_t numTriangles = triangleGeom->getNumberOfTris();
IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
QString ss;
if (NULL != data.get())
{
int32_t totalCellsWritten = 0;
T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
fprintf(vtkFile, "\n");
fprintf(vtkFile, "SCALARS %s %s 1\n", dataName.toLatin1().data(), dataType.toLatin1().data());
fprintf(vtkFile, "LOOKUP_TABLE default\n");
// Loop over all the features
for(QMap<int32_t, int32_t>::iterator featureIter = featureIds.begin(); featureIter != featureIds.end(); ++featureIter)
{
int32_t gid = featureIter.key(); // The current Feature Id
size_t size = featureIter.value(); // The number of triangles for this feature id
std::vector<T> buffer(size, 0);
totalCellsWritten += size;
size_t index = 0;
for (int j = 0; j < numTriangles; j++)
{
if (m_SurfaceMeshFaceLabels[j * 2] != gid && m_SurfaceMeshFaceLabels[j * 2 + 1] != gid) { continue; }
// Get the data
T s0 = static_cast<T>(m[j]);
if (m_SurfaceMeshFaceLabels[j * 2 + 1] == gid)
{ s0 = s0 * -1; }
// Write the values to the buffer after an Endian swap.
if(writeBinaryData == true)
{
SIMPLib::Endian::FromSystemToBig::convert(s0);
buffer[index] = s0;
++index;
}
else
{
ss = QString::number(s0);
fprintf(vtkFile, "%s\n", ss.toLatin1().data());
}
}
// Write the Buffer
if(writeBinaryData == true)
{
fwrite(&(buffer.front()), sizeof(T), size, vtkFile);
}
}
}
}
示例11: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VectorSegmentFeatures::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getDataContainerName());
QVector<size_t> tDims(1, 1);
m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->resizeAttributeArrays(tDims);
updateFeatureInstancePointers();
int64_t totalPoints = static_cast<int64_t>(m_FeatureIdsPtr.lock()->getNumberOfTuples());
m_BeenPickedPtr = BoolArrayType::CreateArray(totalPoints, "BeenPicked INTERNAL ARRAY ONLY");
m_BeenPickedPtr->initializeWithValue(0);
m_BeenPicked = m_BeenPickedPtr->getPointer(0);
// Convert user defined tolerance to radians.
angleTolerance = m_AngleTolerance * SIMPLib::Constants::k_Pi / 180.0f;
// Generate the random voxel indices that will be used for the seed points to start a new grain growth/agglomeration
const int64_t rangeMin = 0;
const int64_t rangeMax = totalPoints - 1;
initializeVoxelSeedGenerator(rangeMin, rangeMax);
SegmentFeatures::execute();
int32_t totalFeatures = static_cast<int32_t>(m->getAttributeMatrix(getCellFeatureAttributeMatrixName())->getNumTuples());
if (totalFeatures < 2)
{
setErrorCondition(-87000);
notifyErrorMessage(getHumanLabel(), "The number of Features was 0 or 1 which means no Features were detected. A threshold value may be set too high", getErrorCondition());
return;
}
// By default we randomize grains
if (true == m_RandomizeFeatureIds)
{
randomizeFeatureIds(totalPoints, totalFeatures);
}
// If there is an error set this to something negative and also set a message
notifyStatusMessage(getHumanLabel(), "Completed");
}
示例12: writeCellNormalData
void writeCellNormalData(DataContainer::Pointer dc, const QString& faceAttributeMatrixName, const QString& dataName, const QString& dataType,
bool writeBinaryData, bool writeConformalMesh,
FILE* vtkFile, int nT)
{
IDataArray::Pointer data = dc->getAttributeMatrix(faceAttributeMatrixName)->getAttributeArray(dataName);
QString buf;
QTextStream ss(&buf);
if (NULL != data.get())
{
T* m = reinterpret_cast<T*>(data->getVoidPointer(0));
fprintf(vtkFile, "\n");
fprintf(vtkFile, "NORMALS %s %s\n", dataName.toLatin1().data(), dataType.toLatin1().data());
for(int i = 0; i < nT; ++i)
{
T s0 = 0x00;
T s1 = 0x00;
T s2 = 0x00;
if(writeBinaryData == true)
{
s0 = static_cast<T>(m[i * 3 + 0]);
s1 = static_cast<T>(m[i * 3 + 1]);
s2 = static_cast<T>(m[i * 3 + 2]);
SIMPLib::Endian::FromSystemToBig::convert(s0);
SIMPLib::Endian::FromSystemToBig::convert(s1);
SIMPLib::Endian::FromSystemToBig::convert(s2);
fwrite(&s0, sizeof(T), 1, vtkFile);
fwrite(&s1, sizeof(T), 1, vtkFile);
fwrite(&s2, sizeof(T), 1, vtkFile);
if(false == writeConformalMesh)
{
s0 = static_cast<T>(m[i * 3 + 0]) * -1.0;
s1 = static_cast<T>(m[i * 3 + 1]) * -1.0;
s2 = static_cast<T>(m[i * 3 + 2]) * -1.0;
SIMPLib::Endian::FromSystemToBig::convert(s0);
SIMPLib::Endian::FromSystemToBig::convert(s1);
SIMPLib::Endian::FromSystemToBig::convert(s2);
fwrite(&s0, sizeof(T), 1, vtkFile);
fwrite(&s1, sizeof(T), 1, vtkFile);
fwrite(&s2, sizeof(T), 1, vtkFile);
}
}
else
{
ss << m[i * 3 + 0] << " " << m[i * 3 + 1] << " " << m[i * 3 + 2] << " ";
if(false == writeConformalMesh)
{
ss << -1.0 * m[i * 3 + 0] << " " << -1.0 * m[i * 3 + 1] << " " << -1.0 * m[i * 3 + 2] << " ";
}
fprintf(vtkFile, "%s ", buf.toLatin1().data());
buf.clear();
if (i % 50 == 0) { fprintf(vtkFile, "\n"); }
}
}
}
}
示例13: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void InitializeData::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(m_CellAttributeMatrixPath.getDataContainerName());
size_t udims[3] =
{ 0, 0, 0 };
m->getGeometryAs<ImageGeom>()->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] =
{ static_cast<DimType>(udims[0]), static_cast<DimType>(udims[1]), static_cast<DimType>(udims[2]), };
int index;
QString attrMatName = m_CellAttributeMatrixPath.getAttributeMatrixName();
QList<QString> voxelArrayNames = m->getAttributeMatrix(attrMatName)->getAttributeArrayNames();
for (int32_t k = m_ZMin; k < m_ZMax + 1; k++)
{
for (int32_t j = m_YMin; j < m_YMax + 1; j++)
{
for (int32_t i = m_XMin; i < m_XMax + 1; i++)
{
index = (k * dims[0] * dims[1]) + (j * dims[0]) + i;
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attrMatName)->getAttributeArray(*iter);
p->initializeTuple(index, 0);
}
}
}
}
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例14: add_noise
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AddBadData::add_noise()
{
notifyStatusMessage(getHumanLabel(), "Adding Noise");
DREAM3D_RANDOMNG_NEW()
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(getGBEuclideanDistancesArrayPath().getDataContainerName());
QString attMatName = getGBEuclideanDistancesArrayPath().getAttributeMatrixName();
QList<QString> voxelArrayNames = m->getAttributeMatrix(attMatName)->getAttributeArrayNames();
float random = 0.0f;
size_t totalPoints = m->getGeometryAs<ImageGeom>()->getNumberOfElements();
for (size_t i = 0; i < totalPoints; ++i)
{
if (m_BoundaryNoise == true && m_GBEuclideanDistances[i] < 1)
{
random = static_cast<float>( rg.genrand_res53() );
if (random < m_BoundaryVolFraction)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attMatName)->getAttributeArray(*iter);
p->initializeTuple(i, 0);
}
}
}
if (m_PoissonNoise == true)
{
random = static_cast<float>( rg.genrand_res53() );
if (random < m_PoissonVolFraction)
{
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attMatName)->getAttributeArray(*iter);
p->initializeTuple(i, 0);
}
}
}
}
}
示例15: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ClearDataMask::execute()
{
setErrorCondition(0);
dataCheck();
if(getErrorCondition() < 0) { return; }
DataContainer::Pointer m = getDataContainerArray()->getDataContainer(m_MaskArrayPath.getDataContainerName());
size_t totalPoints = m_MaskPtr.lock()->getNumberOfTuples();
// get list of array names
QString attrMatName = m_MaskArrayPath.getAttributeMatrixName();
QList<QString> voxelArrayNames = m->getAttributeMatrix(attrMatName)->getAttributeArrayNames();
// convert to list of pointers
std::vector<IDataArray::Pointer> arrayList;
for (QList<QString>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
IDataArray::Pointer p = m->getAttributeMatrix(attrMatName)->getAttributeArray(*iter);
arrayList.push_back(p);
}
int32_t numArrays = arrayList.size();
for (size_t i = 0; i < totalPoints; i++)
{
if (!m_Mask[i])
{
for (int32_t j = 0; j < numArrays; j++)
{
arrayList[j]->initializeTuple(i, 0);
}
}
}
notifyStatusMessage(getHumanLabel(), "Complete");
}