Esempio n. 1
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}
Esempio n. 2
0
/**
 *
 * @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;
}
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;
}
    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);
      }
    }
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)
}
    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);
              }
            }
          }
        }
      }
    }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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);
  }

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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);
}
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)
}
    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);
    }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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; }

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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);
    attributeArrayCombo->setCurrentIndex(-1);
  }
  else
  {
    amIndex = attributeMatrixCombo->findText(amName);
    attributeMatrixCombo->setCurrentIndex(amIndex);
    populateAttributeArrayList();
  }

  if(didBlock) { attributeMatrixCombo->blockSignals(false); didBlock = false; }
  if(!attributeArrayCombo->signalsBlocked()) { didBlock = true; }
  attributeArrayCombo->blockSignals(true);

  if (amIndex < 0)
  {
    attributeArrayCombo->setCurrentIndex(-1);
  }
  else
  {
    int daIndex = attributeArrayCombo->findText(daName);

    // The DataArray Name was empty, lets instantiate the filter and get the default value and try that
    if (daIndex < 0)
    {
      QVariant var = getFilterParameter()->getDefaultValue();
      DataArrayPath path = var.value<DataArrayPath>();
      daName = path.getDataArrayName(); // Pick up the DataArray Name from a Default instantiation of the filter
      daIndex = attributeArrayCombo->findText(daName);
    }

    attributeArrayCombo->setCurrentIndex(daIndex); // we set the selection but we are NOT triggering anything so we should
  }

  if(didBlock) { attributeArrayCombo->blockSignals(false); didBlock = false; }// not be triggering an infinte recursion of preflights

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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);
  }
  if(didBlock) { dataContainerCombo->blockSignals(false); didBlock = false; }

}
Esempio n. 14
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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)

  fclose(f);


  std::cout << "Done Converting" << std::endl;
  return EXIT_SUCCESS;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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());
    }
  }
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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)
  {
    dataContainerCombo->clear();
    attributeMatrixCombo->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);
  }

  // Get what is in the filter
  PhaseTypeSelectionFilterParameter* p = dynamic_cast<PhaseTypeSelectionFilterParameter*>(getFilterParameter());
  QVariant qvSelectedPath = getFilter()->property(p->getAttributeMatrixPathProperty().toLatin1().constData());
  DataArrayPath selectedPath = qvSelectedPath.value<DataArrayPath>();

  QString filtDcName = selectedPath.getDataContainerName();
  QString filtAmName = selectedPath.getAttributeMatrixName();

  QString dcName;
  QString amName;

  // If EVERYTHING is empty, then try the default value
  if(filtDcName.isEmpty() && filtAmName.isEmpty()
      && curDcName.isEmpty() && curAmName.isEmpty() )
  {
    DataArrayPath daPath = getFilterParameter()->getDefaultValue().value<DataArrayPath>();
    dcName = daPath.getDataContainerName();
    amName = daPath.getAttributeMatrixName();
  }
  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 = ""; }
  }

  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);

  if (dcIndex < 0)
  {
    attributeMatrixCombo->setCurrentIndex(-1);
  }
  else
  {
    int amIndex = attributeMatrixCombo->findText(amName);
    attributeMatrixCombo->setCurrentIndex(amIndex);
  }

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

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int DataContainerReader::readDataContainerBundles(hid_t fileId, DataContainerArray::Pointer dca)
{
  herr_t err = 0;
  hid_t dcbGroupId = H5Gopen(fileId, DREAM3D::StringConstants::DataContainerBundleGroupName.toLatin1().constData(), H5P_DEFAULT);
  if (dcbGroupId < 0)
  {
    // NO Bundles are available to read so just return.

    //    QString ss = QObject::tr("Error opening HDF5 Group '%1' ").arg(DREAM3D::StringConstants::DataContainerBundleGroupName);
    //    setErrorCondition(-75);
    //    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return 0;
  }

  HDF5ScopedGroupSentinel sentinel(&dcbGroupId, false);

  QList<QString> groupNames;
  err = QH5Utilities::getGroupObjects(dcbGroupId, H5Utilities::H5Support_GROUP, groupNames);
  if (err < 0)
  {
    QString ss = QObject::tr("Error getting group objects from HDF5 group '%1' ").arg(DREAM3D::StringConstants::DataContainerBundleGroupName);
    setErrorCondition(-76);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
    return err;
  }

  char sep = 0x1E;
  QListIterator<QString> iter(groupNames);
  while (iter.hasNext() )
  {
    QString bundleName = iter.next();
    DataContainerBundle::Pointer bundle = DataContainerBundle::New(bundleName);

    hid_t bundleId = H5Gopen(dcbGroupId, bundleName.toLatin1().constData(), H5P_DEFAULT);
    sentinel.addGroupId(&bundleId); // Make sure this group gets closed

    // Read in the Data Container Names
    QString dcNames;
    err = QH5Lite::readStringDataset(bundleId, DREAM3D::StringConstants::DataContainerNames, dcNames);
    if (err < 0)
    {
      QString ss = QObject::tr("Error reading DataContainer group names from HDF5 group '%1' ").arg(bundleName);
      setErrorCondition(-75);
      notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
      return err;
    }
    QStringList dcNameList = dcNames.split(QString(sep));

    QStringListIterator nameIter(dcNameList);
    while(nameIter.hasNext() )
    {
      QString dcName = nameIter.next();
      DataContainer::Pointer dc = dca->getDataContainer(dcName);
      if (NULL == dc.get() )
      {
        qDebug() << "Data Container '" << dcName << "' was NULL" << " " << __FILE__ << "(" << __LINE__ << ")";
      }
      bundle->addDataContainer(dc);
    }


    QString metaArrays;
    err = QH5Lite::readStringDataset(bundleId, DREAM3D::StringConstants::MetaDataArrays, metaArrays);
    if (err < 0)
    {
      QString ss = QObject::tr("Error reading DataContainerBundle meta data arrays from HDF5 group '%1' ").arg(bundleName);
      setErrorCondition(-76);
      notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
      return err;
    }
    QStringList metaNameList = metaArrays.split(QString(sep));
    bundle->setMetaDataArrays(metaNameList);

    dca->addDataContainerBundle(bundle);
  }

  H5Gclose(dcbGroupId);
  dcbGroupId = -1;
  return err;
}
    static void PopulateAttributeArrayComboBox(AbstractFilter* filter, FilterParameter* filterParameter,
                                      QComboBox* dcCombo, QComboBox* amCombo, QComboBox* aaCombo,
                                      DataContainerArrayProxy& dcaProxy)
    {
      FilterParameterType* fp = dynamic_cast<FilterParameterType*>(filterParameter);
      assert(fp != NULL);

      DataContainerArray::Pointer dca = filter->getDataContainerArray();
      if (NULL == dca.get()) { return; }
      bool alreadyBlocked = false;
      if(aaCombo->signalsBlocked()) { alreadyBlocked = true; }
      aaCombo->blockSignals(true);
      aaCombo->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
              aaCombo->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();
                //DataArrayProxy daProxy = dataArraysIter.value();
                QString daName = dataArraysIter.key();
                IDataArray::Pointer da = dca->getPrereqIDataArrayFromPath<IDataArray, AbstractFilter>(NULL, DataArrayPath(dc.name, amProxy.name, daName));
                aaCombo->addItem(daName);

                if (NULL != da.get() && ((daTypes.isEmpty() == false && daTypes.contains(da->getTypeAsString()) == false) || (cDims.isEmpty() == false && cDims.contains(da->getComponentDimensions()) == false)))
                {
                  QStandardItemModel* model = qobject_cast<QStandardItemModel*>(aaCombo->model());
                  if (NULL != model)
                  {
                    QStandardItem* item = model->item(aaCombo->findText(daName));
                    if (NULL != item)
                    {
                      item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
                    }
                  }
                }
              }
            }
          }
        }

        aaCombo->setCurrentIndex(-1);
        if(alreadyBlocked == false)
        {
          aaCombo->blockSignals(false);
        }
      }
    }