本文整理汇总了C++中VoxelDataContainer::removeCellData方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::removeCellData方法的具体用法?C++ VoxelDataContainer::removeCellData怎么用?C++ VoxelDataContainer::removeCellData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::removeCellData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//.........这里部分代码省略.........
thresholdFilter->Update();
}
}
else if(m_Method==12)//manual
{
//threshold
BinaryThresholdImageFilterType::Pointer thresholdFilter = BinaryThresholdImageFilterType::New();
thresholdFilter->SetInput(inputImage);
thresholdFilter->SetLowerThreshold(m_ManualParameter);
thresholdFilter->SetUpperThreshold(255);
thresholdFilter->SetInsideValue(255);
thresholdFilter->SetOutsideValue(0);
thresholdFilter->GetOutput()->GetPixelContainer()->SetImportPointer(m_ProcessedImageData, totalPoints, false);
thresholdFilter->Update();
}
/*
else if(m_Method==13)//robust automatic
{
typedef itk::GradientMagnitudeImageFilter<ImageProcessing::DefaultImageType, ImageProcessing::DefaultImageType> GradientMagnitudeType;
typedef itk::GradientMagnitudeImageFilter<ImageProcessing::DefaultSliceType, ImageProcessing::DefaultSliceType> GradientMagnitudeType2D;
typedef itk::itkRobustAutomaticThresholdCalculator<ImageProcessing::DefaultImageType,ImageProcessing::DefaultImageType> SelectionType;
typedef itk::itkRobustAutomaticThresholdCalculator<ImageProcessing::DefaultSliceType,ImageProcessing::DefaultSliceType> SelectionType2D;
if(m_slice)
{
//wrap output buffer as image
ImageProcessing::DefaultImageType::Pointer outputImage=ITKUtilities::Dream3DtoITK(m, m_ProcessedImageData);
//loop over slices
for(int i=0; i<dims[2]; i++)
{
//get slice
ImageProcessing::DefaultSliceType::Pointer slice = ITKUtilities::ExtractSlice<ImageProcessing::DefaultPixelType>(inputImage, ImageProcessing::ZSlice, i);
//find gradient
GradientMagnitudeType2D::Pointer gradientFilter = GradientMagnitudeType2D::New();
gradientFilter->setInput(slice);
gradientFilter->Update();
//calculate thershold
SelectionType2D::Pointer calculatorFilter = SelectionType2D::New();
calculatorFilter->SetInput(slice);
calculatorFilter->SetGradientImage(gradientFilter->GetOutput());
calculatorFilter->SetPow(m_ManualParameter);
calculatorFilter->Update();
const uint8_t thresholdValue = calculatorFilter->GetOutput();
//threshold
BinaryThresholdImageFilterType::Pointer thresholdFilter = BinaryThresholdImageFilterType::New();
thresholdFilter->SetInput(inputImage);
thresholdFilter->SetLowerThreshold(thresholdValue);
thresholdFilter->SetUpperThreshold(255);
thresholdFilter->SetInsideValue(255);
thresholdFilter->SetOutsideValue(0);
thresholdFilter->Update();
//copy back into volume
ITKUtilities::SetSlice<ImageProcessing::DefaultPixelType>(outputImage, thresholdFilter->GetOutput(), ImageProcessing::ZSlice, i);
}
}
else
{
//find gradient
GradientMagnitudeType::Pointer gradientFilter = GradientMagnitudeType::New();
gradientFilter->setInput(inputImage);
gradientFilter->Update();
//calculate threshold
SelectionType::Pointer calculatorFilter = SelectionType::New();
calculatorFilter->SetInput(inputImage);
calculatorFilter->SetGradientImage(gradientFilter->GetOutput());
calculatorFilter->SetPow(m_ManualParameter);
calculatorFilter->Update();
const uint8_t thresholdValue = calculatorFilter->GetOutput();
//threshold
BinaryThresholdImageFilterType::Pointer thresholdFilter = BinaryThresholdImageFilterType::New();
thresholdFilter->SetInput(inputImage);
thresholdFilter->SetLowerThreshold(thresholdValue);
thresholdFilter->SetUpperThreshold(255);
thresholdFilter->SetInsideValue(255);
thresholdFilter->SetOutsideValue(0);
thresholdFilter->GetOutput()->GetPixelContainer()->SetImportPointer(m_ProcessedImageData, totalPoints, false);
thresholdFilter->Update();
}
}
*/
//array name changing/cleanup
if(m_OverwriteArray)
{
m->removeCellData(m_SelectedCellArrayName);
bool check = m->renameCellData(m_ProcessedImageDataArrayName, m_SelectedCellArrayName);
}
/* Let the GUI know we are done with this filter */
notifyStatusMessage("Complete");
}
示例2: readFile
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int DxReader::readFile()
{
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if (NULL == m)
{
ss.clear();
ss << "DataContainer Pointer was NULL and Must be valid." << __FILE__ << "("<<__LINE__<<")";
addErrorMessage(getHumanLabel(), ss.str(), -5);
setErrorCondition(-5);
return -1;
}
std::string delimeters(", ;\t"); /* delimeters to split the data */
std::vector<std::string> tokens; /* vector to store the split data */
int error, spin; /* dummy variables */
bool finished_header, finished_data;
finished_header = true;
finished_data = false;
size_t index = 0;
size_t totalPoints = m->getTotalPoints();
// Remove the array that we are about to create first as a 'datacheck()' was called from the super class's 'execute'
// method which is performed before this function. This will cause an error -501 because the array with the name
// m_GrainIdsArrayName already exists but of size 1, not the size we are going to read. So we get rid of the array
m->removeCellData(m_GrainIdsArrayName);
// Rerun the data check in order to allocate the array to store the data from the .dx file.
// dataCheck(false, totalPoints, m->getNumFieldTuples(), m->getNumEnsembleTuples());
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, GrainIds, ss, int32_t, Int32ArrayType, 0, totalPoints, 1)
if (getErrorCondition() < 0)
{
m_InStream.close();
return -1;
}
for (std::string line; std::getline(m_InStream, line);)
{
// Get the remaining lines of the header and ignore
tokens.clear();
error = 0;
tokenize(line, tokens, delimeters);
size_t total = m->getTotalPoints();
if( index == total || ( finished_header && tokens.size() != 0 && tokens[0] == "attribute") )
{
finished_data = true;
}
// Allocate the DataArray at this point:
if(finished_header && !finished_data)
{
for (size_t in_spins = 0; in_spins < tokens.size(); in_spins++)
{
error += sscanf(tokens[in_spins].c_str(), "%d", &spin);
m_GrainIds[index] = spin;
++index;
}
}
}
if(index != static_cast<size_t>(m->getTotalPoints()))
{
ss.clear();
ss << "ERROR: data size does not match header dimensions" << std::endl;
ss << "\t" << index << "\t" << m->getTotalPoints() << std::endl;
setErrorCondition(-495);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
m_InStream.close();
return getErrorCondition();
}
tokens.clear();
m_InStream.close();
// Find the unique set of grain ids
// std::set<int32_t> grainIdSet;
// for (int64_t i = 0; i < totalPoints; ++i)
// {
// grainIdSet.insert(m_GrainIds[i]);
// }
// for (std::set<int32_t>::iterator iter = grainIdSet.begin(); iter != grainIdSet.end(); ++iter )
// {
// std::cout << "Grain ID: " << (*iter) << std::endl;
// }
notifyStatusMessage("Complete");
return 0;
}
示例3: dataCheck
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void RemoveArrays::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
typedef std::set<std::string> NameList_t;
VoxelDataContainer* m = getVoxelDataContainer();
if (NULL != m)
{
for(NameList_t::iterator iter = m_SelectedVoxelCellArrays.begin(); iter != m_SelectedVoxelCellArrays.end(); ++iter)
{
m->removeCellData(*iter);
}
for(NameList_t::iterator iter = m_SelectedVoxelFieldArrays.begin(); iter != m_SelectedVoxelFieldArrays.end(); ++iter)
{
m->removeFieldData(*iter);
}
for(NameList_t::iterator iter = m_SelectedVoxelEnsembleArrays.begin(); iter != m_SelectedVoxelEnsembleArrays.end(); ++iter)
{
m->removeEnsembleData(*iter);
}
}
SurfaceMeshDataContainer* sm = getSurfaceMeshDataContainer();
if (NULL != sm)
{
for(NameList_t::iterator iter = m_SelectedSurfaceVertexArrays.begin(); iter != m_SelectedSurfaceVertexArrays.end(); ++iter)
{
sm->removeVertexData(*iter);
}
for(NameList_t::iterator iter = m_SelectedSurfaceFaceArrays.begin(); iter != m_SelectedSurfaceFaceArrays.end(); ++iter)
{
sm->removeFaceData(*iter);
}
for(NameList_t::iterator iter = m_SelectedSurfaceEdgeArrays.begin(); iter != m_SelectedSurfaceEdgeArrays.end(); ++iter)
{
sm->removeEdgeData(*iter);
}
for(NameList_t::iterator iter = m_SelectedSurfaceFieldArrays.begin(); iter != m_SelectedSurfaceFieldArrays.end(); ++iter)
{
sm->removeFieldData(*iter);
}
for(NameList_t::iterator iter = m_SelectedSurfaceEnsembleArrays.begin(); iter != m_SelectedSurfaceEnsembleArrays.end(); ++iter)
{
sm->removeEnsembleData(*iter);
}
}
SolidMeshDataContainer* sol = getSolidMeshDataContainer();
if (NULL != sol)
{
for(NameList_t::iterator iter = m_SelectedSolidMeshVertexArrays.begin(); iter != m_SelectedSolidMeshVertexArrays.end(); ++iter)
{
sol->removeVertexData(*iter);
}
for(NameList_t::iterator iter = m_SelectedSolidMeshFaceArrays.begin(); iter != m_SelectedSolidMeshFaceArrays.end(); ++iter)
{
sol->removeFaceData(*iter);
}
for(NameList_t::iterator iter = m_SelectedSolidMeshEdgeArrays.begin(); iter != m_SelectedSolidMeshEdgeArrays.end(); ++iter)
{
sol->removeEdgeData(*iter);
}
}
}