本文整理汇总了C++中DataArrayPath::getDataArrayName方法的典型用法代码示例。如果您正苦于以下问题:C++ DataArrayPath::getDataArrayName方法的具体用法?C++ DataArrayPath::getDataArrayName怎么用?C++ DataArrayPath::getDataArrayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataArrayPath
的用法示例。
在下文中一共展示了DataArrayPath::getDataArrayName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void MoveData::dataCheck()
{
setErrorCondition(0);
DataArrayPath amSrcPath = getAttributeMatrixSource();
DataArrayPath amDestPath = getAttributeMatrixDestination();
DataArrayPath daSrcPath = getDataArraySource();
if (getWhatToMove() == k_MoveAttributeMatrix)
{
DataContainer::Pointer amDestDataContainer = getDataContainerArray()->getPrereqDataContainer<AbstractFilter>(this, getDataContainerDestination());
DataContainer::Pointer amSrcDataContainer = getDataContainerArray()->getPrereqDataContainer<AbstractFilter>(this, amSrcPath.getDataContainerName());
AttributeMatrix::Pointer amSrcAttributeMatrix = getDataContainerArray()->getPrereqAttributeMatrixFromPath<AbstractFilter>(this, amSrcPath, -301);
if(getErrorCondition() < 0) { return; }
if (amSrcDataContainer->getName() == amDestDataContainer->getName())
{
QString ss = QObject::tr("The source and destination Data Container are the same. Is this what you meant to do?");
notifyWarningMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
amDestDataContainer->addAttributeMatrix(amSrcAttributeMatrix->getName(), amSrcAttributeMatrix);
amSrcDataContainer->removeAttributeMatrix(amSrcAttributeMatrix->getName());
}
else if (getWhatToMove() == k_MoveDataArray )
{
AttributeMatrix::Pointer daSrcAttributeMatrix = getDataContainerArray()->getPrereqAttributeMatrixFromPath<AbstractFilter>(this, daSrcPath, -301);
AttributeMatrix::Pointer daDestAttributeMatrix = getDataContainerArray()->getPrereqAttributeMatrixFromPath<AbstractFilter>(this, amDestPath, -301);
IDataArray::Pointer daSrcDataArray = getDataContainerArray()->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(this, daSrcPath);
if(getErrorCondition() < 0) { return; }
if (daDestAttributeMatrix->getNumTuples() != daSrcDataArray->getNumberOfTuples())
{
setErrorCondition(-11019);
QString ss = QObject::tr("The number of tuples of source Attribute Array (%1) and destination Attribute Matrix (%2) do not match").arg(daSrcDataArray->getNumberOfTuples()).arg(daDestAttributeMatrix->getNumTuples());
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
else if (amSrcPath == amDestPath)
{
QString ss = QObject::tr("The source and destination Attribute Matrix are the same. Is this what you meant to do?");
notifyWarningMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
daDestAttributeMatrix->addAttributeArray(daSrcPath.getDataArrayName(), daSrcDataArray);
daSrcAttributeMatrix->removeAttributeArray(daSrcPath.getDataArrayName());
}
else
{
setErrorCondition(-11020);
QString ss = QObject::tr("Neither an Attribute Matrix nor an Attribute Array was selected to be moved");
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
}
示例2: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void MultiEmmpmFilter::execute()
{
setErrorCondition(0);
dataCheck();
if (getErrorCondition() < 0) { return; }
DataArrayPath inputAMPath = DataArrayPath::GetAttributeMatrixPath(getInputDataArrayVector());
QList<QString> arrayNames = DataArrayPath::GetDataArrayNames(getInputDataArrayVector());
QListIterator<QString> iter(arrayNames);
QString msgPrefix = getMessagePrefix();
int32_t i = 1;
// This is the routine that sets up the EM/MPM to segment the image
while (iter.hasNext())
{
DataArrayPath arrayPath = inputAMPath;
QString name = iter.next();
arrayPath.setDataArrayName(name);
setInputDataArrayPath(arrayPath);
// Change the output AttributeMatrix
arrayPath.setAttributeMatrixName(getOutputAttributeMatrixName());
QString outName = getOutputArrayPrefix() + arrayPath.getDataArrayName();
arrayPath.setDataArrayName(outName);
// Remove the array if it already exists ; this would be very strange but check for it anyway
getDataContainerArray()->getAttributeMatrix(arrayPath)->removeAttributeArray(outName);
setOutputDataArrayPath(arrayPath);
QString prefix = QObject::tr("%1 (Array %2 of %3)").arg(msgPrefix).arg(i).arg(arrayNames.size());
setMessagePrefix(prefix);
if ( i == 2 && getUsePreviousMuSigma())
{
setEmmpmInitType(EMMPM_ManualInit);
}
else
{
setEmmpmInitType(EMMPM_Basic);
}
EMMPMFilter::execute();
if (getErrorCondition() < 0) { break; }
i++;
if (getCancel()) { break; }
}
if (getErrorCondition() < 0)
{
QString ss = QObject::tr("Error occurred running the EM/MPM algorithm");
setErrorCondition(-60009);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
/* Let the GUI know we are done with this filter */
notifyStatusMessage(getHumanLabel(), "Complete");
}
示例3: writeXdmf
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VertexGeom::writeXdmf(QTextStream& out, QString dcName, QString hdfFileName)
{
herr_t err = 0;
// Always start the grid
out << " <!-- *************** START OF " << dcName << " *************** -->" << "\n";
out << " <Grid Name=\"" << dcName << "\" GridType=\"Uniform\">" << "\n";
#if 0
DataArrayPath dap = getTemporalDataPath();
if(dap.isValid())
{
IDataArray::Pointer timeValues = getAttributeMatrix(dap.getAttributeMatrixName())->getAttributeArray(dap.getDataArrayName());
Int32ArrayType::Pointer timeValuePtr = boost::dynamic_pointer_cast<Int32ArrayType>(timeValues);
out << " <Time TimeType=\"Single\" Value=\"" << timeValuePtr->getValue(0) << "\"/>\n";
}
#endif
out << " <Topology TopologyType=\"Polyvertex\" NumberOfElements=\"" << getNumberOfVertices() << "\">" << "\n";
out << " <DataItem Format=\"HDF\" NumberType=\"Int\" Dimensions=\"" << getNumberOfVertices() << "\">" << "\n";
out << " " << hdfFileName << ":/DataContainers/" << dcName << "/" << DREAM3D::Geometry::Geometry << "/" << "Verts" << "\n";
out << " </DataItem>" << "\n";
out << " </Topology>" << "\n";
out << " <Geometry Type=\"XYZ\">" << "\n";
out << " <DataItem Format=\"HDF\" Dimensions=\"" << getNumberOfVertices() << " 3\" NumberType=\"Float\" Precision=\"4\">" << "\n";
out << " " << hdfFileName << ":/DataContainers/" << dcName << "/" << DREAM3D::Geometry::Geometry << "/" << DREAM3D::Geometry::SharedVertexList << "\n";
out << " </DataItem>" << "\n";
out << " </Geometry>" << "\n";
out << "" << "\n";
return err;
}
示例4: populateComboBoxes
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataArraySelectionWidget::populateComboBoxes()
{
//qDebug() << "-----------------------------------------------";
//qDebug() << getFilter()->getHumanLabel() << " " << getFilterParameter()->getHumanLabel() << " DataArraySelectionWidget::populateComboBoxes()";
// Now get the DataContainerArray from the Filter instance
// We are going to use this to get all the current DataContainers
DataContainerArray::Pointer dca = getFilter()->getDataContainerArray();
if(NULL == dca.get()) { return; }
//qDebug() << getFilter()->getHumanLabel() << " " << getFilterParameter()->getHumanLabel();
// Grab what is currently selected
QString curDcName = dataContainerCombo->currentText();
QString curAmName = attributeMatrixCombo->currentText();
QString curDaName = attributeArrayCombo->currentText();
//qDebug() << "Current ComboBox Value: " << curDcName << "::" << curAmName << "::" << curDaName;
// Check to see if we have any DataContainers to actually populate drop downs with.
if(dca->getDataContainers().size() == 0)
{
dataContainerCombo->clear();
attributeMatrixCombo->clear();
attributeArrayCombo->clear();
return;
}
// Cache the DataContainerArray Structure for our use during all the selections
m_DcaProxy = DataContainerArrayProxy(dca.get());
// Populate the DataContainerArray Combo Box with all the DataContainers
QList<DataContainerProxy> dcList = m_DcaProxy.dataContainers.values();
QListIterator<DataContainerProxy> iter(dcList);
dataContainerCombo->clear();
while(iter.hasNext() )
{
DataContainerProxy dc = iter.next();
dataContainerCombo->addItem(dc.name);
// if(dataContainerCombo->findText(dc.name) == -1 )
// {
// int index = dataContainerCombo->currentIndex();
// dataContainerCombo->addItem(dc.name);
// dataContainerCombo->setCurrentIndex(index);
// }
}
// Get what is in the filter
DataArrayPath selectedPath = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataArrayPath>();
// Split the path up to make sure we have a valid path separated by the "|" character
QString filtDcName = selectedPath.getDataContainerName();
QString filtAmName = selectedPath.getAttributeMatrixName();
QString filtDaName = selectedPath.getDataArrayName();
QString dcName;
QString amName;
QString daName;
// If EVERYTHING is empty, then try the default value
if(filtDcName.isEmpty() && filtAmName.isEmpty() && filtDaName.isEmpty()
&& curDcName.isEmpty() && curAmName.isEmpty() && curDaName.isEmpty() )
{
DataArrayPath daPath = getFilterParameter()->getDefaultValue().value<DataArrayPath>();
dcName = daPath.getDataContainerName();
amName = daPath.getAttributeMatrixName();
daName = daPath.getDataArrayName();
}
else
{
// Now to figure out which one of these to use. If this is the first time through then what we picked up from the
// gui will be empty strings because nothing is there. If there is something in the filter then we should use that.
// If there is something in both of them and they are NOT equal then we have a problem. Use the flag m_DidCausePreflight
// to determine if the change from the GUI should over ride the filter or vice versa. there is a potential that in future
// versions that something else is driving DREAM3D and pushing the changes to the filter and we need to reflect those
// changes in the GUI, like a testing script?
dcName = checkStringValues(curDcName, filtDcName);
if( !dca->doesDataContainerExist(dcName) ) { dcName = ""; }
amName = checkStringValues(curAmName, filtAmName);
if ( !dca->doesAttributeMatrixExist(DataArrayPath(dcName, amName, "") ) ) { amName = ""; }
daName = checkStringValues(curDaName, filtDaName);
if ( !dca->doesAttributeArrayExist(DataArrayPath(dcName, amName, daName) )) { daName = ""; }
}
bool didBlock = false;
if (!dataContainerCombo->signalsBlocked()) { didBlock = true; }
dataContainerCombo->blockSignals(true);
int dcIndex = dataContainerCombo->findText(dcName);
dataContainerCombo->setCurrentIndex(dcIndex);
populateAttributeMatrixList();
if(didBlock) { dataContainerCombo->blockSignals(false); didBlock = false; }
if(!attributeMatrixCombo->signalsBlocked()) { didBlock = true; }
attributeMatrixCombo->blockSignals(true);
int amIndex = -1;
if (dcIndex < 0)
{
attributeMatrixCombo->setCurrentIndex(-1);
//.........这里部分代码省略.........
示例5: populateComboBoxes
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataArrayCreationWidget::populateComboBoxes()
{
// std::cout << "void DataArrayCreationWidget::populateComboBoxesWithSelection()" << std::endl;
// Now get the DataContainerArray from the Filter instance
// We are going to use this to get all the current DataContainers
DataContainerArray::Pointer dca = getFilter()->getDataContainerArray();
if(NULL == dca.get()) { return; }
// Check to see if we have any DataContainers to actually populate drop downs with.
if(dca->getDataContainers().size() == 0)
{
return;
}
// Cache the DataContainerArray Structure for our use during all the selections
m_DcaProxy = DataContainerArrayProxy(dca.get());
// Populate the DataContainer ComboBox
FilterPararameterWidgetUtils::PopulateDataContainerComboBox<DataArrayCreationFilterParameter>(getFilter(), getFilterParameter(), dataContainerCombo, m_DcaProxy);
// Grab what is currently selected
QString curDcName = dataContainerCombo->currentText();
QString curAmName = attributeMatrixCombo->currentText();
QString curDaName = dataArrayName->text();
// Get what is in the filter
DataArrayPath selectedPath = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<DataArrayPath>();
// Split the path up to make sure we have a valid path separated by the "|" character
QString filtDcName = selectedPath.getDataContainerName();
QString filtAmName = selectedPath.getAttributeMatrixName();
QString filtDaName = selectedPath.getDataArrayName();
// Now to figure out which one of these to use. If this is the first time through then what we picked up from the
// gui will be empty strings because nothing is there. If there is something in the filter then we should use that.
// If there is something in both of them and they are NOT equal then we have a problem. Use the flag m_DidCausePreflight
// to determine if the change from the GUI should over ride the filter or vice versa. there is a potential that in future
// versions that something else is driving SIMPLView and pushing the changes to the filter and we need to reflect those
// changes in the GUI, like a testing script?
QString dcName = checkStringValues(curDcName, filtDcName);
if( !dca->doesDataContainerExist(dcName) ) { dcName = ""; }
QString amName = checkStringValues(curAmName, filtAmName);
if ( !dca->doesAttributeMatrixExist(DataArrayPath(dcName, amName, "") ) ) { amName = ""; }
QString daName = checkStringValues(curDaName, filtDaName);
//if ( !dca->doesAttributeArrayExist(DataArrayPath(dcName, amName, daName) )) { daName = ""; }
bool didBlock = false;
if (!dataContainerCombo->signalsBlocked()) { didBlock = true; }
dataContainerCombo->blockSignals(true);
int dcIndex = dataContainerCombo->findText(dcName);
dataContainerCombo->setCurrentIndex(dcIndex);
FilterPararameterWidgetUtils::PopulateAttributeMatrixComboBox<DataArrayCreationFilterParameter>(getFilter(), getFilterParameter(), dataContainerCombo, attributeMatrixCombo, m_DcaProxy);
if(didBlock) { dataContainerCombo->blockSignals(false); didBlock = false; }
if(!attributeMatrixCombo->signalsBlocked()) { didBlock = true; }
attributeMatrixCombo->blockSignals(true);
if (dcIndex < 0)
{
attributeMatrixCombo->setCurrentIndex(-1);
}
else
{
int amIndex = attributeMatrixCombo->findText(amName);
attributeMatrixCombo->setCurrentIndex(amIndex);
}
if(didBlock) { attributeMatrixCombo->blockSignals(false); didBlock = false; }
if(!dataArrayName->signalsBlocked()) { didBlock = true; }
dataArrayName->blockSignals(true);
dataArrayName->setText(daName);
if(didBlock) { dataArrayName->blockSignals(false); didBlock = false; }
}
示例6:
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QDebug operator<<(QDebug out, const DataArrayPath& v)
{
out << v.getDataContainerName() << "|" << v.getAttributeMatrixName() << "|" << v.getDataArrayName();
return out;
}
示例7: execute
//.........这里部分代码省略.........
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());
}
m_FeatureIdsPtr = cellAttrMat->getAttributeArrayAs<Int32ArrayType>(dap.getDataArrayName()); /* Assigns the shared_ptr<> to an instance variable that is a weak_ptr<> */
if( NULL != m_FeatureIdsPtr.lock().get() ) /* Validate the Weak Pointer wraps a non-NULL pointer to a DataArray<T> object */
{ m_FeatureIds = m_FeatureIdsPtr.lock()->getPointer(0); } /* Now assign the raw pointer to data from the DataArray<T> object */
else
{
setErrorCondition(-601);
QString ss = QObject::tr("The FeatureIds array with name '%1' was not found in the destination DataContainer. The expected path was '%2'")
.arg(dap.getDataArrayName()).arg(dap.serialize("/"));
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
// Find the unique set of feature ids
for (int64_t i = 0; i < totalPoints; ++i)
{
int32_t currentFeatureId = m_FeatureIds[i];
if (currentFeatureId < totalFeatures)
{
activeObjects[currentFeatureId] = true;
}
else
{
setErrorCondition(-601);
QString ss = QObject::tr("The total number of Features from %1 is %2, but a value of %3 was found in DataArray %4.").arg(cellFeatureAttrMat->getName()).arg(totalFeatures).arg(currentFeatureId).arg(getFeatureIdsArrayPath().serialize("/"));
qDebug() << ss;
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
}
cellFeatureAttrMat->removeInactiveObjects(activeObjects, m_FeatureIdsPtr.lock());
}
if(m_UpdateOrigin == true)
{
float resolution[3] = {0.0f, 0.0f, 0.0f};
destCellDataContainer->getGeometryAs<ImageGeom>()->getResolution(resolution);
float origin[3] = {0.0f, 0.0f, 0.0f};
destCellDataContainer->getGeometryAs<ImageGeom>()->getOrigin(origin);
origin[0] = m_XMin * resolution[0] + oldOrigin[0];
origin[1] = m_YMin * resolution[1] + oldOrigin[1];
origin[2] = m_ZMin * resolution[2] + oldOrigin[2];
destCellDataContainer->getGeometryAs<ImageGeom>()->setOrigin(origin);
}
notifyStatusMessage(getHumanLabel(), "Complete");
}