• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ datacontainerarray::Pointer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中datacontainerarray::Pointer的典型用法代码示例。如果您正苦于以下问题:C++ Pointer类的具体用法?C++ Pointer怎么用?C++ Pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getPhaseCount

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int EstablishShapeTypes::getPhaseCount()
{
  DataContainerArray::Pointer dca = getDataContainerArray();

  AttributeMatrix::Pointer inputAttrMat = dca->getAttributeMatrix(getInputPhaseTypesArrayPath());

  if (NULL == inputAttrMat.get() ) { return 0; }

  if (__SHOW_DEBUG_MSG__)
  {
    qDebug() << "  data->getNumberOfTuples(): " << inputAttrMat->getTupleDimensions();
    qDebug() << "Name" << inputAttrMat->getName();
  }

  if (inputAttrMat->getType() < DREAM3D::AttributeMatrixType::VertexEnsemble
      || inputAttrMat->getType() > DREAM3D::AttributeMatrixType::CellEnsemble )
  {
    return 0;
  }

  QVector<size_t> tupleDims = inputAttrMat->getTupleDimensions();
  size_t phaseCount = 1;
  for (int32_t i = 0; i < tupleDims.size(); i++)
  {
    phaseCount = phaseCount * tupleDims[i];
  }
  return phaseCount;
}
开发者ID:ricortiz,项目名称:DREAM3D,代码行数:31,代码来源:EstablishShapeTypes.cpp


示例2: 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;
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:41,代码来源:PhToHDF5.cpp


示例3: testCase1_Execute

int testCase1_Execute(const QString& name, int scalarType)
{
  int err = 0;
  int dataArraySize = ARRAY_SIZE * N;
  int junkArraySize = 0;
  int skipHeaderBytes = 0;
  qDebug() << "Testing case 1: " << name << " with num comps " << N;


  // Allocate an array, and get the dataArray from that array
  boost::shared_array<T> array(new T[dataArraySize]); // This makes sure our allocated array is deleted when we leave
  T* dataArray = array.get();

  // Write some data into the data array
  for(size_t i = 0; i < dataArraySize; ++i)
  {
    dataArray[i] = static_cast<T>(i);
  }

  // Create junkArray and set it to NULL because there is no junk in this test case
  T* junkArray = NULL;

  // Create the file and write to it.  If any of the information is wrong, the result will be false
  bool result = createAndWriteToFile(dataArray, dataArraySize, junkArray, junkArraySize, Detail::None);

  // Test to make sure that the file was created and written to successfully
  DREAM3D_REQUIRED(result, == , true)

  // Create the data container
  VolumeDataContainer::Pointer m = VolumeDataContainer::New();
  m->setName(DREAM3D::Defaults::DataContainerName);
  DataContainerArray::Pointer dca = DataContainerArray::New();
  dca->pushBack(m);

  // Create the filter, passing in the skipHeaderBytes
  RawBinaryReader::Pointer filt = createRawBinaryReaderFilter(scalarType, N, skipHeaderBytes);
  filt->setDataContainerArray(dca);

  // Preflight, get the error condition, and check that there are no errors
  filt->preflight();
  err = filt->getErrorCondition();
  DREAM3D_REQUIRED(err, >= , 0)

  // Execute the filter, check that there are no errors, and compare the data
  filt->execute();
  DREAM3D_REQUIRED(err, >= , 0)

  IDataArray::Pointer iData = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArray("Test_Array");
  T* data = reinterpret_cast<T*>(iData->getVoidPointer(0));
  T d, p;
  for(size_t i = 0; i < dataArraySize; ++i)
  {
    d = data[i];
    p = dataArray[i];
    DREAM3D_REQUIRE_EQUAL(d, p)
  }
  return err;
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:58,代码来源:RawBinaryReaderTest.cpp


示例4: PopulateAttributeMatrixComboBox

    static void PopulateAttributeMatrixComboBox(AbstractFilter* filter, FilterParameter* filterParameter,
                                            QComboBox* dcCombo, QComboBox* amCombo,
                                            DataContainerArrayProxy& dcaProxy)
    {
      FilterParameterType* fp = dynamic_cast<FilterParameterType*>(filterParameter);
      assert(fp != NULL);
      DataContainerArray::Pointer dca = filter->getDataContainerArray();
      if (NULL == dca.get()) { return; }

      QString dcName = dcCombo->currentText();

      // Clear the AttributeMatrix List
      bool alreadyBlocked = false;
      if(amCombo->signalsBlocked()) { alreadyBlocked = true; }
      amCombo->blockSignals(true);
      amCombo->clear();

      // Loop over the data containers until we find the proper data container
      QList<DataContainerProxy> containers = dcaProxy.dataContainers.values();
      QListIterator<DataContainerProxy> containerIter(containers);
      QVector<unsigned int> defVec = fp->getDefaultAttributeMatrixTypes();
      while(containerIter.hasNext())
      {
        DataContainerProxy dc = containerIter.next();

        if(dc.name.compare(dcName) == 0 )
        {
          // We found the proper Data Container, now populate the AttributeMatrix List
          QMap<QString, AttributeMatrixProxy> attrMats = dc.attributeMatricies;
          QMapIterator<QString, AttributeMatrixProxy> attrMatsIter(attrMats);
          while(attrMatsIter.hasNext() )
          {
            attrMatsIter.next();
            QString amName = attrMatsIter.key();
            AttributeMatrix::Pointer am = dca->getAttributeMatrix(DataArrayPath(dc.name, amName, ""));
            amCombo->addItem(amName);

            if (NULL != am.get() && defVec.isEmpty() == false && defVec.contains(am->getType()) == false)
            {
              QStandardItemModel* model = qobject_cast<QStandardItemModel*>(amCombo->model());
              if (NULL != model)
              {
                QStandardItem* item = model->item(amCombo->findText(amName));
                if (NULL != item)
                {
                  item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
                }
              }
            }
          }
        }
      }

      if(!alreadyBlocked) { // Only unblock if this function blocked the signals.
        amCombo->blockSignals(false);
      }
    }
开发者ID:BlueQuartzSoftware,项目名称:SIMPLView,代码行数:57,代码来源:FilterParameterWidgetUtils.hpp


示例5: testCase6_Execute

void testCase6_Execute(const QString& name, int scalarType)
{
  int dataArraySize = 0;
  int junkArraySize = ARRAY_SIZE * N;
  int skipHeaderBytes = junkArraySize * sizeof(T);
  int err = 0;
  qDebug() << "Testing case 6: " << name << " with num comps " << N;

  // Allocate an array, and get the dataArray from that array
  boost::shared_array<T> array(new T[dataArraySize]); // This makes sure our allocated array is deleted when we leave
  T* dataArray = array.get();

  // Write some data into the data array
  for(size_t i = 0; i < dataArraySize; ++i)
  {
    dataArray[i] = static_cast<T>(i);
  }

  // Create junkArray
  T* junkArray = new T[junkArraySize];

  // Write a pattern into junkArray
  for(size_t i = 0; i < junkArraySize; ++i)
  {
    junkArray[i] = (unsigned)0xAB;
  }


  // Create the file and write to it.  If any of the information is wrong, the result will be false
  bool result = createAndWriteToFile(dataArray, dataArraySize, junkArray, junkArraySize, Detail::Start);

  // Test to make sure that the file was created and written to successfully
  DREAM3D_REQUIRED(result, == , true)

  // Create the data container
  VolumeDataContainer::Pointer m = VolumeDataContainer::New();
  m->setName(DREAM3D::Defaults::DataContainerName);
  DataContainerArray::Pointer dca = DataContainerArray::New();
  dca->pushBack(m);

  // Create the filter, passing in the skipHeaderBytes
  RawBinaryReader::Pointer filt = createRawBinaryReaderFilter(scalarType, N, skipHeaderBytes);
  filt->setDataContainerArray(dca);

  // Preflight, get error condition, and check that the "file too small" error has occurred
  filt->preflight();
  err = filt->getErrorCondition();
  DREAM3D_REQUIRED(err, == , RBRT_FILE_TOO_SMALL)

  // Execute, get error condition, and check that there are errors
  filt->execute();
  err = filt->getErrorCondition();
  DREAM3D_REQUIRED(err, < , 0)
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:54,代码来源:RawBinaryReaderTest.cpp


示例6: PopulateDataContainerComboBox

    static void PopulateDataContainerComboBox(AbstractFilter* filter, FilterParameter* filterParameter,
                                              QComboBox* dcCombo, DataContainerArrayProxy& dcaProxy)
    {
      FilterParameterType* fp = dynamic_cast<FilterParameterType*>(filterParameter);
      assert(fp != NULL);
      DataContainerArray::Pointer dca = filter->getDataContainerArray();
      // Populate the DataContainerArray Combo Box with all the DataContainers
      QList<DataContainerProxy> dcList = dcaProxy.dataContainers.values();
      QListIterator<DataContainerProxy> iter(dcList);
      dcCombo->clear();
      QVector<unsigned int> defVec = fp->getDefaultGeometryTypes();
      while(iter.hasNext() )
      {
        DataContainerProxy dcProxy = iter.next();
        DataContainer::Pointer dc = dca->getDataContainer(dcProxy.name);
        IGeometry::Pointer geom = IGeometry::NullPointer();
        uint32_t geomType = 999;
        if (NULL != dc.get()) { geom = dc->getGeometry(); }
        if (NULL != geom.get()) { geomType = geom->getGeometryType(); }
        dcCombo->addItem(dcProxy.name);

        if (defVec.isEmpty() == false)
        {
          if (defVec.contains(geomType) == false)
          {
            QStandardItemModel* model = qobject_cast<QStandardItemModel*>(dcCombo->model());
            if (NULL != model)
            {
              QStandardItem* item = model->item(dcCombo->findText(dcProxy.name));
              if (NULL != item)
              {
                item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
              }
            }
          }
        }
      }
    }
开发者ID:BlueQuartzSoftware,项目名称:SIMPLView,代码行数:38,代码来源:FilterParameterWidgetUtils.hpp


示例7: beforePreflight

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataContainerArrayProxyWidget::beforePreflight()
{
  if (m_DidCausePreflight == false)
  {
    //  qDebug() << getFilter()->getNameOfClass() << " DataContainerArrayProxyWidget::beforePreflight()";
    // Get the DataContainerArray from the Filter instance. This will have what will become the choices for the user
    // to select from.
    DataContainerArray::Pointer dca = getFilter()->getDataContainerArray();
    DataContainerArrayProxy incomingProxy = DataContainerArrayProxy(dca.get() );
    incomingProxy.setAllFlags(m_FilterParameter->getDefaultFlagValue());
    //incomingProxy.print("BeforePreflight INCOMING");
    //Now the idea becomes to save the selections that the user has made and transfer those changes to the incoming
    // proxy object
    updateProxyFromProxy(m_DcaProxy, incomingProxy);
    //proxy.print("'proxy' beforePreflight AFTER updateProxyFromProxy()");

    m_DcaProxy = incomingProxy;
    // Now that the proxy was updated with our selections, make the updated incoming proxy into our cache
    // Now update the Model
    updateModelFromProxy(m_DcaProxy);
  }

}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:26,代码来源:DataContainerArrayProxyWidget.cpp


示例8: dataCheck

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataContainerReader::dataCheck()
{
  // Sync the file proxy and cached proxy if the time stamps are different
  QFileInfo fi(getInputFile());
  if (getInputFile() == getLastFileRead() && getLastRead() < fi.lastModified())
  {
    syncProxies();
  }

  QString ss;
  if (getInputFile().isEmpty() == true)
  {
    ss = QObject::tr("The input file must be set");
    setErrorCondition(-387);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }
  else if (fi.exists() == false)
  {
    ss = QObject::tr("The input file does not exist");
    setErrorCondition(-388);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }

  if(getErrorCondition())
  {
    // something has gone wrong and errors were logged alread so just return
    return;
  }

  DataContainerArray::Pointer dca = getDataContainerArray();

  // Create a new DataContainerArray to read the file data into
  DataContainerArray::Pointer tempDCA = DataContainerArray::New();

  // Read either the structure or all the data depending on the preflight status
  readData(getInPreflight(), m_InputFileDataContainerArrayProxy, tempDCA);

  QList<DataContainer::Pointer>& tempContainers = tempDCA->getDataContainers();
  QListIterator<DataContainer::Pointer> iter(tempContainers);
  while (iter.hasNext())
  {
    DataContainer::Pointer container = iter.next();

    if (getOverwriteExistingDataContainers() == true )
    {
      if (dca->doesDataContainerExist(container->getName()) == true)
      {
        dca->removeDataContainer(container->getName());
      }
      dca->addDataContainer(container);
    }
    else
    {
      if (dca->doesDataContainerExist(container->getName()) == true)
      {
        ss = QObject::tr("The input file has a DataContainer with a name (%1) that already exists in the current DataContainerArray structure").arg(container->getName());
        setErrorCondition(-390);
        notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
      }
      else
      {
        dca->addDataContainer(container);
      }
    }
  }
  QMap<QString, IDataContainerBundle::Pointer> bundles = tempDCA->getDataContainerBundles();
  dca->setDataContainerBundles(bundles);
}
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:71,代码来源:DataContainerReader.cpp


示例9: testCase4_Execute

void testCase4_Execute(const QString& name, int scalarType)
{
  int dataArraySize = ARRAY_SIZE * N;
  int junkArraySize = 5;
  int skipHeaderBytes = junkArraySize * sizeof(T);
  int err = 0;
  qDebug() << "Testing case 4: " << name << " with num comps " << N;

  // Allocate an array, and get the dataArray from that array
  boost::shared_array<T> array(new T[dataArraySize]); // This makes sure our allocated array is deleted when we leave
  T* dataArray = array.get();

  // Write some data into the data array
  for(size_t i = 0; i < dataArraySize; ++i)
  {
    dataArray[i] = static_cast<T>(i);
  }

  // Create junkArray
  T* junkArray = new T[junkArraySize];

  // Write a pattern into junkArray
  for(size_t i = 0; i < junkArraySize; ++i)
  {
    junkArray[i] = (unsigned)0xAB;
  }


  // Create the file and write to it.  If any of the information is wrong, the result will be false
  bool result = createAndWriteToFile(dataArray, dataArraySize, junkArray, junkArraySize, Detail::Start);

  // Test to make sure that the file was created and written to successfully
  DREAM3D_REQUIRED(result, == , true)

  // Create the data container
  VolumeDataContainer::Pointer m = VolumeDataContainer::New();
  m->setName(DREAM3D::Defaults::DataContainerName);
  DataContainerArray::Pointer dca = DataContainerArray::New();
  dca->pushBack(m);

  // Create the filter, passing in the skipHeaderBytes
  RawBinaryReader::Pointer filt = createRawBinaryReaderFilter(scalarType, N, skipHeaderBytes);
  filt->setDataContainerArray(dca);

  // Preflight, get error condition, and check that there are no errors
  filt->preflight();
  err = filt->getErrorCondition();
  DREAM3D_REQUIRED(err, >= , 0)

  // Execute, get error condition, check that there are no errors, and compare the data
  filt->execute();
  err = filt->getErrorCondition();
  DREAM3D_REQUIRED(err, >= , 0)

  IDataArray::Pointer iData = m->getAttributeMatrix(getCellAttributeMatrixName())->getAttributeArray("Test_Array");
  T* data = reinterpret_cast<T*>(iData->getVoidPointer(0));
  T d, p;
  for(size_t i = 0; i < dataArraySize; ++i)
  {
    d = data[i];
    p = dataArray[i];
    DREAM3D_REQUIRE_EQUAL(d, p)
  }

  /*
   * SUBTEST: Test when skipHeaderBytes is larger than expected
   */

  // Create another data container
  VolumeDataContainer::Pointer m2 = VolumeDataContainer::New();
  m2->setName(DREAM3D::Defaults::DataContainerName);
  DataContainerArray::Pointer dca2 = DataContainerArray::New();
  dca2->pushBack(m2);

  // Create another filter, passing in the skipHeaderBytes + 1
  RawBinaryReader::Pointer filt2 = createRawBinaryReaderFilter(scalarType, N, skipHeaderBytes + 1);
  filt2->setDataContainerArray(dca2);

  // Preflight, get error condition, and check that there are errors
  filt2->preflight();
  err = filt2->getErrorCondition();
  DREAM3D_REQUIRED(err, < , 0)

  // Execute, get error condition, and check that the "file too small" error occurred
  filt2->execute();
  err = filt2->getErrorCondition();
  DREAM3D_REQUIRED(err, == , RBRT_FILE_TOO_SMALL)
}
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:88,代码来源:RawBinaryReaderTest.cpp


示例10: PopulateAttributeArrayList

    static void PopulateAttributeArrayList(AbstractFilter* filter, FilterParameter* filterParameter,
                                           QComboBox* dcCombo, QComboBox* amCombo, WidgetType* attributeArraysWidget,
                                           DataContainerArrayProxy& dcaProxy,
                                           QVector<DataArrayPath> selectedPaths)
    {
      FilterParameterType* fp = dynamic_cast<FilterParameterType*>(filterParameter);
      assert(fp != NULL);

      DataContainerArray::Pointer dca = filter->getDataContainerArray();
      if (NULL == dca.get()) { return; }

      attributeArraysWidget->blockSignals(true);
      attributeArraysWidget->clear();

      // Get the selected Data Container Name from the DataContainerList Widget
      QString currentDCName = dcCombo->currentText();
      QString currentAttrMatName = amCombo->currentText();

      // Loop over the data containers until we find the proper data container
      QList<DataContainerProxy> containers = dcaProxy.dataContainers.values();
      QListIterator<DataContainerProxy> containerIter(containers);
      QVector<QString> daTypes = fp->getDefaultAttributeArrayTypes();
      QVector< QVector<size_t> > cDims = fp->getDefaultComponentDimensions();
      while (containerIter.hasNext())
      {
        DataContainerProxy dc = containerIter.next();
        if (dc.name.compare(currentDCName) == 0)
        {
          // We found the proper Data Container, now populate the AttributeMatrix List
          QMap<QString, AttributeMatrixProxy> attrMats = dc.attributeMatricies;
          QMapIterator<QString, AttributeMatrixProxy> attrMatsIter(attrMats);
          while (attrMatsIter.hasNext())
          {
            attrMatsIter.next();
            QString amName = attrMatsIter.key();
            if (amName.compare(currentAttrMatName) == 0)
            {
              // Clear the list of arrays from the QListWidget
              attributeArraysWidget->clear();
              // We found the selected AttributeMatrix, so loop over this attribute matrix arrays and populate the list widget
              AttributeMatrixProxy amProxy = attrMatsIter.value();
              QMap<QString, DataArrayProxy> dataArrays = amProxy.dataArrays;
              QMapIterator<QString, DataArrayProxy> dataArraysIter(dataArrays);
              while (dataArraysIter.hasNext())
              {
                dataArraysIter.next();
                QString daName = dataArraysIter.key();
                QListWidgetItem* daItem = new QListWidgetItem(daName);
                daItem->setCheckState(Qt::Unchecked);

                for (int i = 0; i < selectedPaths.size(); i++)
                {
                  if (selectedPaths.at(i).getDataArrayName() == daName)
                  {
                    daItem->setCheckState(Qt::Checked);
                  }
                }

                IDataArray::Pointer da = dca->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(NULL, DataArrayPath(dc.name, amProxy.name, daName));
                attributeArraysWidget->addItem(daItem);

                if (NULL != da.get() && ((daTypes.isEmpty() == false && daTypes.contains(da->getTypeAsString()) == false) || (cDims.isEmpty() == false && cDims.contains(da->getComponentDimensions()) == false)))
                {
                  QList<QListWidgetItem*> rejectList = attributeArraysWidget->findItems(daName, Qt::MatchRecursive);
                  for (int i = 0; i < rejectList.size(); i++)
                  {
                    QListWidgetItem* item = rejectList[i];
                    item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
                  }
                }
              }
            }
          }
        }
      }

      attributeArraysWidget->blockSignals(false);
    }
开发者ID:BlueQuartzSoftware,项目名称:SIMPLView,代码行数:78,代码来源:FilterParameterWidgetUtils.hpp


示例11: populateComboBoxes

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AttributeMatrixCreationWidget::populateComboBoxes()
{
  //  std::cout << "void AttributeMatrixCreationWidget::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<AttributeMatrixCreationFilterParameter>(getFilter(), getFilterParameter(), dataContainerCombo, m_DcaProxy);

  // Grab what is currently selected
  QString curDcName = dataContainerCombo->currentText();
  QString curAmName = attributeMatrixName->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();

  // 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 = ""; }

  bool didBlock = false;

  if (!dataContainerCombo->signalsBlocked()) { didBlock = true; }
  dataContainerCombo->blockSignals(true);

  int dcIndex = dataContainerCombo->findText(dcName);
  dataContainerCombo->setCurrentIndex(dcIndex);

  if (didBlock) { dataContainerCombo->blockSignals(false); didBlock = false; }

  if (!attributeMatrixName->signalsBlocked()) { didBlock = true; }
  attributeMatrixName->blockSignals(true);

  QString amName = checkStringValues(curAmName, filtAmName);

  attributeMatrixName->setText(amName);

  if (didBlock) { attributeMatrixName->blockSignals(false); didBlock = false; }

}
开发者ID:BlueQuartzSoftware,项目名称:SIMPLView,代码行数:66,代码来源:AttributeMatrixCreationWidget.cpp


示例12: 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);
//.........这里部分代码省略.........
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:101,代码来源:DataArraySelectionWidget.cpp


示例13: populateComboBoxes

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataContainerSelectionWidget::populateComboBoxes()
{
  //  std::cout << "void DataContainerSelectionWidget::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 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);
//    }
  }

  //remove items in the combo that are NOT in the Data Container Array
//  int count = dataContainerCombo->count();
//  for(int i = count - 1; i >= 0; i--)
//  {
//    QString str0 = dataContainerCombo->itemText(i);
//    iter.toFront();
//    bool boo = false;
//    while(iter.hasNext() )
//    {
//      DataContainerProxy dc = iter.next();
//      if(dc.name.compare(str0) == 0)
//      {
//        boo = true; // found in the list
//      }
//    }
//    if(boo == false)
//    {
//      dataContainerCombo->removeItem(i);
//    }
//  }

  // Grab what is currently selected
  QString curDcName = dataContainerCombo->currentText();


  // Get what is in the filter
  QString filtDcName;
  QString filtAmName;

  QVariant qvSelectedPath = getFilter()->property(PROPERTY_NAME_AS_CHAR);
  if( QString("QString").compare(qvSelectedPath.typeName()) == 0 )
  {
    filtDcName = qvSelectedPath.toString();
  }
  else if( QString("DataArrayPath").compare(qvSelectedPath.typeName()) == 0 )
  {
    DataArrayPath selectedPath = qvSelectedPath.value<DataArrayPath>();
    filtDcName = selectedPath.getDataContainerName();
    filtAmName = selectedPath.getAttributeMatrixName();
  }

  // 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?

  QString dcName = checkStringValues(curDcName, filtDcName);
  if( !dca->doesDataContainerExist(dcName) ) { dcName = ""; }

  bool didBlock = false;

  if (!dataContainerCombo->signalsBlocked()) { didBlock = true; }
  dataContainerCombo->blockSignals(true);
  int dcIndex = dataContainerCombo->findText(dcName);
  if(dcIndex < 0 && dcName.isEmpty() == false)
  {
    dataContainerCombo->addItem(dcName);
  }
  else
  {
    dataContainerCombo->setCurrentIndex(dcIndex);
//.........这里部分代码省略.........
开发者ID:ravishivaraman,项目名称:DREAM3D,代码行数:101,代码来源:DataContainerSelectionWidget.cpp


示例14: main

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int main(int argc, char** argv)
{
  std::cout << "Starting Conversion of H5Voxel to VTK with Feature ID and IPF Colors" << std::endl;
  if (argc < 3)
  {
    std::cout << "This program takes 2 arguments: Input .h5voxel file and output vtk file." << std::endl;
    return EXIT_FAILURE;
  }


  QString iFile = argv[1];

  int err = 0;

  DataContainerArray::Pointer dca = DataContainerArray::New();
  VolumeDataContainer::Pointer m = VolumeDataContainer::New();
  dca->pushBack(m);

  DataContainerReader::Pointer h5Reader = DataContainerReader::New();
  h5Reader->setInputFile(iFile);
  h5Reader->setDataContainerArray(dca);
  size_t dcDims[3];
  float spacing[3];
  float origin[3];
  h5Reader->execute();
  err = h5Reader->getErrorCondition();
  if (err < 0)
  {
    setErrorCondition(err);
//   addErrorMessages(h5Reader->getErrorMessages());
    return EXIT_FAILURE;
  }
  m->getDimensions(dcDims);
  m->getResolution(spacing);
  m->getOrigin(origin);

  int64_t dims[3] = {dcDims[0], dcDims[1], dcDims[2]};

  /* Sanity check what we are trying to load to make sure it can fit in our address space.
   * Note that this does not guarantee the user has enough left, just that the
   * size of the volume can fit in the address space of the program
   */
#if   (CMP_SIZEOF_SSIZE_T==4)
  int64_t max = std::numeric_limits<size_t>::max();
#else
  int64_t max = std::numeric_limits<int64_t>::max();
#endif
  if (dims[0] * dims[1] * dims[2] > max )
  {
    err = -1;
    std::stringstream s;
    s << "The total number of elements '" << (dims[0] * dims[1] * dims[2])
      << "' is greater than this program can hold. Try the 64 bit version.";
    setErrorCondition(err);
    setErrorMessage(s.str());
    return EXIT_FAILURE;
  }

  if (dims[0] > max || dims[1] > max || dims[2] > max)
  {
    err = -1;
    std::stringstream s;
    s << "One of the dimensions is greater than the max index for this sysem. Try the 64 bit version.";
    s << " dim[0]=" << dims[0] << "  dim[1]=" << dims[1] << "  dim[2]=" << dims[2];
    setErrorCondition(err);
    setErrorMessage(s.str());
    return EXIT_FAILURE;
  }
  /* ************ End Sanity Check *************************** */


  std::stringstream ss;

  std::cout << "Writing VTK file" << std::endl;

  FILE* f = fopen(argv[2], "wb");

  WRITE_STRUCTURED_POINTS_HEADER("ASCII", m)


//  VoxelIPFColorScalarWriter<VolumeDataContainer> ipfWriter(m.get());
//  ipfWriter.m_WriteBinaryFiles = false;
//  ipfWriter.writeScalars(f);


  int64_t totalPoints = m->getTotalPoints();
  int32_t* m_FeatureIds = NULL;
  m_FeatureIds = m->getCellDataSizeCheck<int32_t, Int32ArrayType, AbstractFilter>(SIMPL::CellData::FeatureIds, totalPoints, 1, NULL);
  if (0 == m_FeatureIds )
  {
    ss << "Filter " << getNameOfClass() << " requires the data array '" <<
       "DREAM3D" << "::" << "CellData" << "::" <<  "FeatureIds" << "' to already be created prior to execution." << std::endl;
    setErrorCondition(-300);
  }

  WRITE_VTK_GRAIN_IDS_ASCII(m, SIMPL::CellData::FeatureIds, m_FeatureIds)

//.........这里部分代码省略.........
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:101,代码来源:H5VoxelToVtk.cpp


示例15: readData

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DataContainerReader::readData(bool preflight, DataContainerArrayProxy& proxy, DataContainerArray::Pointer dca)
{
  setErrorCondition(0);
  QString ss;
  int32_t err = 0;
  QString m_FileVersion;
  float fVersion = 0.0f;
  bool check = false;

  //  qDebug() << "DataContainerReader::readData() " << m_InputFile;

  // Read the Meta Data and Array names from the file
  hid_t fileId = QH5Utilities::openFile(m_InputFile, true); // Open the file Read Only
  if (fileId < 0)
  {
    ss = QObject::tr("Error opening input file '%1'").arg(m_InputFile);
    setErrorCondition(-150);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return;
  }
  // This will make sure if we return early from this method that the HDF5 File is properly closed.
  HDF5ScopedFileSentinel scopedFileSentinel(&fileId, true);

  // Check to see if version of .dream3d file is prior to new data container names
  err = QH5Lite::readStringAttribute(fileId, "/", DREAM3D::HDF5::FileVersionName, m_FileVersion);
  fVersion = m_FileVersion.toFloat(&check);
  if (fVersion < 5.0 || err < 0)
  {
    QH5Utilities::closeFile(fileId);
    fileId = QH5Utilities::openFile(m_InputFile, false); // Re-Open the file as Read/Write
    err = H5Lmove(fileId, "VoxelDataContainer", fileId, DREAM3D::Defaults::DataContainerName.toLatin1().data(), H5P_DEFAULT, H5P_DEFAULT);
    err = H5Lmove(fileId, "SurfaceMeshDataContainer", fileId, DREAM3D::Defaults::DataContainerName.toLatin1().data(), H5P_DEFAULT, H5P_DEFAULT);
    err = QH5Lite::writeStringAttribute(fileId, "/", DREAM3D::HDF5::FileVersionName, "5.0");
    QH5Utilities::closeFile(fileId);
    fileId = QH5Utilities::openFile(m_InputFile, true); // Re-Open the file as Read Only
  }
  if (fVersion < 7.0)
  {
    ss = QObject::tr("File unable to be read - file structure older than 7.0");
    setErrorCondition(-250);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return;
  }
  hid_t dcaGid = H5Gopen(fileId, DREAM3D::StringConstants::DataContainerGroupName.toLatin1().data(), 0);
  if (dcaGid < 0)
  {
    setErrorCondition(-1923123);
    QString ss = QObject::tr("Error attempting to open the HDF5 Group '%1'").arg(DREAM3D::StringConstants::DataContainerGroupName);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return;
  }

  scopedFileSentinel.addGroupId(&dcaGid);

  err = dca->readDataContainersFromHDF5(preflight, dcaGid, proxy, this);
  if (err < 0)
  {
    setErrorCondition(err);
    QString ss = QObject::tr("Error trying to read the DataContainers from the file '%1'").arg(getInputFile());
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }
  err = H5Gclose(dcaGid);
  dcaGid = -1;

  err = readDataContainerBundles(fileId, dca);
  if (err < 0)
  {
    setErrorCondition(err);
    QString ss = QObject::tr("Error trying to read the DataContainerBundles from the file '%1'").arg(getInputFile());
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }

  if (!getInPreflight())
  {
    err = readExistingPipelineFromFile(fileId);
    if(err < 0)
    {
      setErrorCondition(err);
      QString ss = QObject::tr("Error trying to read the existing pipeline from the file '%1'").arg(getInputFile());
      notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    }
  }
}
开发者ID:BlueQuartzSoftware,项目名称:SIMPL,代码行数:86,代码来源:DataContainerReader.cpp


示例16: populateComboBoxes

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PhaseTypeSelectionWidget::populateComboBoxes()
{
  //  std::cout << "void PhaseTypeSelectionWidget::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; }

  // Grab what is currently selected
  QString curDcName = dataContainerCombo->currentText();
  QString curAmName = attributeMatrixCombo->currentText();

  // Check to see if we have any DataContainers to actually populate drop downs with.
  if(dca->getDataContainers().size() == 0)
  {
    d 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dataextentlist::const_iterator类代码示例发布时间:2022-05-31
下一篇:
C++ datacontainer::Pointer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap