本文整理汇总了C++中VoxelDataContainer::clearFieldData方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::clearFieldData方法的具体用法?C++ VoxelDataContainer::clearFieldData怎么用?C++ VoxelDataContainer::clearFieldData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::clearFieldData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void LinkFieldMapToCellArray::execute()
{
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
int64_t voxels = m->getTotalPoints();
int64_t fields = m->getNumFieldTuples();
dataCheck(false, voxels, fields, m->getNumEnsembleTuples());
if (getErrorCondition() < 0)
{
return;
}
//int err = 0;
std::stringstream ss;
m->clearFieldData();
int maxIndex = 0;
std::vector<bool> active;
for(int64_t i=0;i<voxels;i++)
{
int index = m_SelectedCellData[i];
if((index+1) > maxIndex)
{
active.resize(index+1);
active[index] = true;
maxIndex = index+1;
}
}
BoolArrayType::Pointer m_Active = BoolArrayType::CreateArray(maxIndex, 1, DREAM3D::FieldData::Active);
bool* mActive = m_Active->GetPointer(0);
for(int i=0;i<maxIndex;i++)
{
mActive[i] = active[i];
}
m->addFieldData(DREAM3D::FieldData::Active, m_Active);
notifyStatusMessage("Complete");
}
示例2: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void LinkFieldMapToCellArray::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
IDataArray::Pointer data = m->getCellData(m_SelectedCellDataArrayName);
if (NULL == data.get())
{
ss.str("");
ss << "Selected array '" << m_SelectedCellDataArrayName << "' does not exist in the Voxel Data Container. Was it spelled correctly?";
setErrorCondition(-11001);
addErrorMessage(getHumanLabel(),ss.str(),getErrorCondition());
return;
}
std::string dType = data->getTypeAsString();
IDataArray::Pointer p = IDataArray::NullPointer();
if (dType.compare("int32_t") == 0)
{
DataArray<int32_t>* field = DataArray<int32_t>::SafePointerDownCast(data.get());
m_SelectedCellData = field->GetPointer(0);
}
else
{
ss.str("");
ss << "Selected array '" << m_SelectedCellDataArrayName << "' is not an Integer array. Is this the array you want to use?";
setErrorCondition(-11001);
addErrorMessage(getHumanLabel(),ss.str(),getErrorCondition());
return;
}
m->clearFieldData();
BoolArrayType::Pointer active = BoolArrayType::CreateArray(fields, 1, DREAM3D::FieldData::Active);
// bool* mActive = m_Active->GetPointer(0);
m->addFieldData(DREAM3D::FieldData::Active, active);
}
示例3: execute
//.........这里部分代码省略.........
OpenCloseBadData::Pointer erode_dilate = OpenCloseBadData::New();
erode_dilate->setDirection(1); // 1 is erode.
erode_dilate->setNumIterations(m_NumIterations_Erode);
erode_dilate->setVoxelDataContainer(m);
erode_dilate->execute();
pipeline->pushBack(erode_dilate);
FindNeighbors::Pointer find_neighbors = FindNeighbors::New();
find_neighbors->setVoxelDataContainer(m);
find_neighbors->execute();
pipeline->pushBack(find_neighbors);
PerPhaseMinSize::Pointer min_size = PerPhaseMinSize::New();
min_size->setMinAllowedGrainSize(m_MinAllowedGrainSize);
min_size->setPhaseNumber(m_PhaseNumberMinSize);
min_size->setVoxelDataContainer(m);
min_size->execute();
pipeline->pushBack(min_size);
MinNeighbors::Pointer min_neighbors = MinNeighbors::New();
min_neighbors->setMinNumNeighbors(m_MinNumNeighbors);
min_neighbors->setVoxelDataContainer(m);
min_neighbors->execute();
pipeline->pushBack(min_neighbors);
FindSizes::Pointer find_sizes = FindSizes::New();
//find_sizes->setDistributionType(DREAM3D::DistributionType::Beta);
find_sizes->setVoxelDataContainer(m);
find_sizes->execute();
pipeline->pushBack(find_sizes);
FindShapes::Pointer find_shapes = FindShapes::New();
//find_shapes->setDistributionType(DREAM3D::DistributionType::Beta);
find_shapes->setVoxelDataContainer(m);
find_shapes->execute();
pipeline->pushBack(find_shapes);
FieldDataCSVWriter::Pointer field_data_write_csv = FieldDataCSVWriter::New();
std::string field_csv = "D:/IN100_run1/DREAM3D_files/crop_line_"+ convertIntToString(i) +".csv";
field_data_write_csv->setFieldDataFile(field_csv);
field_data_write_csv->setVoxelDataContainer(m);
field_data_write_csv->execute();
pipeline->pushBack(field_data_write_csv);
bool m_WriteVtkFile = true ;
bool m_WriteBinaryVTKFiles= true ;
bool m_WriteGrainID= true;
bool m_WritePhaseId= true ;
bool m_WriteIPFColor= true ;
bool m_WriteGoodVoxels= true ;
bool m_WriteGrainSizes = true ;
bool m_WriteBandContrasts = true ;
VtkRectilinearGridWriter::Pointer vtkWriter = VtkRectilinearGridWriter::New();
if(m_WriteVtkFile)
{
std::string vtk_file = "D:/IN100_run1/DREAM3D_files/crop_line_" + convertIntToString(i) + ".vtk";
vtkWriter->setOutputFile(vtk_file);
vtkWriter->setWriteGrainIds(m_WriteGrainID);
vtkWriter->setWritePhaseIds(m_WritePhaseId);
vtkWriter->setWriteBandContrasts(m_WriteBandContrasts);
vtkWriter->setWriteGoodVoxels(m_WriteGoodVoxels);
vtkWriter->setWriteIPFColors(m_WriteIPFColor);
vtkWriter->setWriteBinaryFile(m_WriteBinaryVTKFiles);
vtkWriter->setWriteBinaryFile(m_WriteGrainSizes);
vtkWriter->setVoxelDataContainer(m);
vtkWriter->execute();
pipeline->pushBack(vtkWriter);
}
DataContainerWriter::Pointer writer = DataContainerWriter::New();
std::string dream_3d_file = "D:/IN100_run1/DREAM3D_files/crop_line_" + convertIntToString(i) + ".dream3d";
writer->setOutputFile(dream_3d_file);
writer->setVoxelDataContainer(m);
pipeline->pushBack(writer);
writer->execute();
// std::cout << "********* RUNNING PIPELINE **********************" << std::endl;
// // pipeline->run();
pipeline->clear();
//delete [] m;
m->clearCellData();
m->clearEnsembleData();
m->clearFieldData();
}
}