本文整理汇总了C++中VoxelDataContainer::getNumEnsembleTuples方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::getNumEnsembleTuples方法的具体用法?C++ VoxelDataContainer::getNumEnsembleTuples怎么用?C++ VoxelDataContainer::getNumEnsembleTuples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::getNumEnsembleTuples方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AlignSectionsFeature::execute()
{
setErrorCondition(0);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
int64_t totalPoints = m->getTotalPoints();
size_t numgrains = m->getNumFieldTuples();
size_t numensembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, numgrains, numensembles);
if (getErrorCondition() < 0)
{
return;
}
AlignSections::execute();
// If there is an error set this to something negative and also set a message
notifyStatusMessage("Aligning Sections Complete");
}
示例2: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AddOrientationNoise::execute()
{
int err = 0;
setErrorCondition(err);
DREAM3D_RANDOMNG_NEW()
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
int64_t totalPoints = m->getTotalPoints();
size_t totalFields = m->getNumFieldTuples();
dataCheck(false, totalPoints, totalFields, m->getNumEnsembleTuples());
if (getErrorCondition() < 0)
{
return;
}
m_Magnitude = m_Magnitude*m_pi/180.0;
add_orientation_noise();
// If there is an error set this to something negative and also set a message
notifyStatusMessage("AddOrientationNoises Completed");
}
示例3: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FlattenImage::execute()
{
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
int64_t totalPoints = m->getTotalPoints();
size_t numgrains = m->getNumFieldTuples();
size_t numensembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, numgrains, numensembles);
if (getErrorCondition() < 0)
{
return;
}
float Rfactor = 1.0;
float Gfactor = 1.0;
float Bfactor = 1.0;
if (m_FlattenMethod == DREAM3D::FlattenImageMethod::Average)
{
Rfactor = 1.0/3.0;
Gfactor = 1.0/3.0;
Bfactor = 1.0/3.0;
}
else if (m_FlattenMethod == DREAM3D::FlattenImageMethod::Luminosity)
{
Rfactor = 0.21;
Gfactor = 0.72;
Bfactor = 0.07;
}
#ifdef DREAM3D_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
size_t comp = m->getCellData(m_ImageDataArrayName)->GetNumberOfComponents();
// std::cout << "FlattenImage: " << m_ConversionFactor << std::endl;
#ifdef DREAM3D_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, totalPoints),
FlattenImageImpl(m_ImageData, m_FlatImageData, Rfactor, Gfactor, Bfactor, comp), tbb::auto_partitioner());
}
else
#endif
{
FlattenImageImpl serial(m_ImageData, m_FlatImageData, Rfactor, Gfactor, Bfactor, comp);
serial.convert(0, totalPoints);
}
notifyStatusMessage("Complete");
}
示例4: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ClearData::execute()
{
int err = 0;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
dataCheck(false, m->getTotalPoints(), m->getNumFieldTuples(), m->getNumEnsembleTuples());
if(getErrorCondition() < 0)
{
return;
}
size_t udims[3] =
{ 0, 0, 0 };
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] =
{ static_cast<DimType>(udims[0]), static_cast<DimType>(udims[1]), static_cast<DimType>(udims[2]), };
int index;
std::list<std::string> voxelArrayNames = m->getCellArrayNameList();
for (int k = m_ZMin; k < m_ZMax+1; k++)
{
for (int j = m_YMin; j < m_YMax+1; j++)
{
for (int i = m_XMin; i < m_XMax+1; i++)
{
index = (k * dims[0] * dims[1]) + (j * dims[0]) + i;
for (std::list<std::string>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
std::string name = *iter;
IDataArray::Pointer p = m->getCellData(*iter);
p->InitializeTuple(index,0);
}
}
}
}
notifyStatusMessage("Completed");
}
示例5: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AvizoRectilinearCoordinateWriter::execute()
{
int err = 0;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
// Make sure any directory path is also available as the user may have just typed
// in a path without actually creating the full path
std::string parentPath = MXAFileInfo::parentPath(m_OutputFile);
if(!MXADir::mkdir(parentPath, true))
{
std::stringstream ss;
ss << "Error creating parent path '" << parentPath << "'";
notifyErrorMessage(ss.str(), -1);
setErrorCondition(-1);
return;
}
int64_t totalPoints = m->getTotalPoints();
size_t totalFields = m->getNumFieldTuples();
size_t totalEnsembleTuples = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, totalFields, totalEnsembleTuples);
MXAFileWriter64 writer(m_OutputFile);
if(false == writer.initWriter())
{
std::stringstream ss;
ss << "Error opening file '" << parentPath << "'";
notifyErrorMessage(ss.str(), -1);
setErrorCondition(-1);
return;
}
std::string header = generateHeader();
writer.writeString(header);
err = writeData(writer);
/* Let the GUI know we are done with this filter */
notifyStatusMessage("Complete");
}
示例6: 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");
}
示例7: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void RotateEulerRefFrame::execute()
{
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
int64_t totalPoints = m->getTotalPoints();
size_t numgrains = m->getNumFieldTuples();
size_t numensembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, numgrains, numensembles);
if (getErrorCondition() < 0)
{
return;
}
#ifdef DREAM3D_USE_PARALLEL_ALGORITHMS
tbb::task_scheduler_init init;
bool doParallel = true;
#endif
#ifdef DREAM3D_USE_PARALLEL_ALGORITHMS
if (doParallel == true)
{
tbb::parallel_for(tbb::blocked_range<size_t>(0, totalPoints),
RotateEulerRefFrameImpl(m_CellEulerAngles, m_RotationAngle, m_RotationAxis), tbb::auto_partitioner());
}
else
#endif
{
RotateEulerRefFrameImpl serial(m_CellEulerAngles, m_RotationAngle, m_RotationAxis);
serial.convert(0, totalPoints);
}
notifyStatusMessage("Complete");
}
示例8: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindCellQuats::execute()
{
setErrorCondition(0);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
std::stringstream ss;
int64_t totalPoints = m->getTotalPoints();
size_t totalFields = m->getNumFieldTuples();
size_t totalEnsembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, totalFields, totalEnsembles);
if (getErrorCondition() < 0)
{
return;
}
QuatF* quats = reinterpret_cast<QuatF*>(m_Quats);
QuatF qr;
int phase = -1;
for (int i = 0; i < totalPoints; i++)
{
phase = m_CellPhases[i];
OrientationMath::EulertoQuat(qr, m_CellEulerAngles[3 * i], m_CellEulerAngles[3 * i + 1], m_CellEulerAngles[3 * i + 2]);
QuaternionMathF::UnitQuaternion(qr);
if (m_CrystalStructures[phase] == Ebsd::CrystalStructure::UnknownCrystalStructure)
{
QuaternionMathF::Identity(qr);
}
QuaternionMathF::Copy(qr, quats[i]);
}
notifyStatusMessage("Complete");
}
示例9: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void IdentifySample::execute()
{
setErrorCondition(0);
// int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
int64_t totalPoints = m->getTotalPoints();
dataCheck(false, totalPoints, m->getNumFieldTuples(), m->getNumEnsembleTuples());
if (getErrorCondition() < 0 && getErrorCondition() != -305)
{
return;
}
setErrorCondition(0);
size_t udims[3] = {0,0,0};
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] = {
static_cast<DimType>(udims[0]),
static_cast<DimType>(udims[1]),
static_cast<DimType>(udims[2]),
};
DimType neighpoints[6];
DimType xp = dims[0];
DimType yp = dims[1];
DimType zp = dims[2];
neighpoints[0] = -(xp * yp);
neighpoints[1] = -xp;
neighpoints[2] = -1;
neighpoints[3] = 1;
neighpoints[4] = xp;
neighpoints[5] = (xp * yp);
std::vector<int> currentvlist;
std::vector<bool> checked;
checked.resize(totalPoints,false);
std::vector<bool> Sample;
Sample.resize(totalPoints,false);
std::vector<bool> notSample;
notSample.resize(totalPoints,false);
int biggestBlock = 0;
size_t count;
int good;
int neighbor;
DimType column, row, plane;
int index;
for (int i = 0; i < totalPoints; i++)
{
if(checked[i] == false && m_GoodVoxels[i] == false)
{
currentvlist.push_back(i);
count = 0;
while (count < currentvlist.size())
{
index = currentvlist[count];
column = index % xp;
row = (index / xp) % yp;
plane = index / (xp * yp);
for (int j = 0; j < 6; j++)
{
good = 1;
neighbor = static_cast<int>( index + neighpoints[j] );
if(j == 0 && plane == 0) good = 0;
if(j == 5 && plane == (zp - 1)) good = 0;
if(j == 1 && row == 0) good = 0;
if(j == 4 && row == (yp - 1)) good = 0;
if(j == 2 && column == 0) good = 0;
if(j == 3 && column == (xp - 1)) good = 0;
if(good == 1 && checked[neighbor] == false && m_GoodVoxels[neighbor] == false)
{
currentvlist.push_back(neighbor);
checked[neighbor] = true;
}
}
count++;
}
if(static_cast<int>(currentvlist.size()) >= biggestBlock)
{
biggestBlock = currentvlist.size();
for(int j = 0; j < totalPoints; j++)
{
notSample[j] = false;
}
for(size_t j = 0; j < currentvlist.size(); j++)
{
//.........这里部分代码省略.........
示例10: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void Threshold::execute()
{
std::stringstream ss;
int err = 0;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", getErrorCondition());
return;
}
setErrorCondition(0);
int64_t totalPoints = m->getTotalPoints();
size_t totalFields = m->getNumFieldTuples();
size_t totalEnsembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, totalFields, totalEnsembles);
if(m_OverwriteArray)
{
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, ProcessedImageData, ss, ImageProcessing::DefaultPixelType, ImageProcessing::DefaultArrayType, 0, totalPoints, 1)
}
if (getErrorCondition() < 0)
{
return;
}
//get dims
size_t udims[3] = {0,0,0};
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] = {
static_cast<DimType>(udims[0]),
static_cast<DimType>(udims[1]),
static_cast<DimType>(udims[2]),
};
//wrap input as itk image
ImageProcessing::DefaultImageType::Pointer inputImage=ITKUtilities::Dream3DtoITK(m, m_RawImageData);
//define threshold filters
typedef itk::BinaryThresholdImageFilter <ImageProcessing::DefaultImageType, ImageProcessing::DefaultImageType> BinaryThresholdImageFilterType;
typedef itk::BinaryThresholdImageFilter <ImageProcessing::DefaultSliceType, ImageProcessing::DefaultSliceType> BinaryThresholdImageFilterType2D;
if(m_Method>=0 && m_Method<=11)
{
//define hitogram generator (will make the same kind of histogram for 2 and 3d images
typedef itk::Statistics::ImageToHistogramFilter<ImageProcessing::DefaultImageType> HistogramGenerator;
//find threshold value w/ histogram
itk::HistogramThresholdCalculator< HistogramGenerator::HistogramType, uint8_t >::Pointer calculator;
typedef itk::HuangThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > HuangCalculatorType;
typedef itk::IntermodesThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > IntermodesCalculatorType;
typedef itk::IsoDataThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > IsoDataCalculatorType;
typedef itk::KittlerIllingworthThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > KittlerIllingowrthCalculatorType;
typedef itk::LiThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > LiCalculatorType;
typedef itk::MaximumEntropyThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > MaximumEntropyCalculatorType;
typedef itk::MomentsThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > MomentsCalculatorType;
typedef itk::OtsuThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > OtsuCalculatorType;
typedef itk::RenyiEntropyThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > RenyiEntropyCalculatorType;
typedef itk::ShanbhagThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > ShanbhagCalculatorType;
typedef itk::TriangleThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > TriangleCalculatorType;
typedef itk::YenThresholdCalculator< HistogramGenerator::HistogramType, uint8_t > YenCalculatorType;
switch(m_Method)
{
case 0:
{
calculator = HuangCalculatorType::New();
}
break;
case 1:
{
calculator = IntermodesCalculatorType::New();
}
break;
case 2:
{
calculator = IsoDataCalculatorType::New();
}
break;
case 3:
{
calculator = KittlerIllingowrthCalculatorType::New();
}
break;
case 4:
{
calculator = LiCalculatorType::New();
//.........这里部分代码省略.........
示例11: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindAxisODF::execute()
{
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
dataCheck(false, m->getTotalPoints(), m->getNumFieldTuples(), m->getNumEnsembleTuples());
if(getErrorCondition() < 0)
{
return;
}
StatsDataArray& statsDataArray = *m_StatsDataArray;
typedef DataArray<unsigned int> XTalType;
XTalType* crystruct = XTalType::SafeObjectDownCast<IDataArray*, XTalType*>(m->getEnsembleData(DREAM3D::EnsembleData::CrystalStructures).get());
float r1, r2, r3;
int bin;
std::vector<FloatArrayType::Pointer> axisodf;
std::vector<float> totalaxes;
size_t numXTals = crystruct->GetNumberOfTuples();
axisodf.resize(numXTals);
totalaxes.resize(numXTals);
for (size_t i = 1; i < numXTals; i++)
{
totalaxes[i] = 0.0;
axisodf[i] = FloatArrayType::CreateArray((36 * 36 * 36), DREAM3D::HDF5::AxisOrientation);
for (int j = 0; j < (36 * 36 * 36); j++)
{
axisodf[i]->SetValue(j, 0.0);
}
}
size_t numgrains = m->getNumFieldTuples();
for (size_t i = 0; i < numgrains; i++)
{
if(m_SurfaceFields[i] == false)
{
totalaxes[m_FieldPhases[i]]++;
}
}
for (size_t i = 1; i < numgrains; i++)
{
float ea1 = m_AxisEulerAngles[3 * i];
float ea2 = m_AxisEulerAngles[3 * i + 1];
float ea3 = m_AxisEulerAngles[3 * i + 2];
if(m_SurfaceFields[i] == 0)
{
OrientationMath::EulerToRod( ea1, ea2, ea3, r1, r2, r3);
m_OrientationOps[Ebsd::CrystalStructure::OrthoRhombic]->getODFFZRod(r1, r2, r3);
bin = m_OrientationOps[Ebsd::CrystalStructure::OrthoRhombic]->getOdfBin(r1, r2, r3);
axisodf[m_FieldPhases[i]]->SetValue(bin, (axisodf[m_FieldPhases[i]]->GetValue(bin) + static_cast<float>((1.0 / totalaxes[m_FieldPhases[i]]))));
}
}
// int err;
for (size_t i = 1; i < numXTals; i++)
{
if(m_PhaseTypes[i] == DREAM3D::PhaseType::PrimaryPhase)
{
PrimaryStatsData* pp = PrimaryStatsData::SafePointerDownCast(statsDataArray[i].get());
pp->setAxisOrientation(axisodf[i]);
}
if(m_PhaseTypes[i] == DREAM3D::PhaseType::PrecipitatePhase)
{
PrecipitateStatsData* pp = PrecipitateStatsData::SafePointerDownCast(statsDataArray[i].get());
pp->setAxisOrientation(axisodf[i]);
}
if(m_PhaseTypes[i] == DREAM3D::PhaseType::TransformationPhase)
{
TransformationStatsData* tp = TransformationStatsData::SafePointerDownCast(statsDataArray[i].get());
tp->setAxisOrientation(axisodf[i]);
}
}
notifyStatusMessage("Completed");
}
示例12: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AlignSections::execute()
{
setErrorCondition(0);
VoxelDataContainer* m = getVoxelDataContainer();
if (NULL == m)
{
setErrorCondition(-1);
std::stringstream ss;
ss << " DataContainer was NULL";
notifyErrorMessage(ss.str(), -1);
return;
}
int64_t totalPoints = m->getTotalPoints();
size_t numgrains = m->getNumFieldTuples();
size_t numensembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, numgrains, numensembles);
if (getErrorCondition() < 0)
{
return;
}
size_t udims[3] = {0,0,0};
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] = {
static_cast<DimType>(udims[0]),
static_cast<DimType>(udims[1]),
static_cast<DimType>(udims[2]),
};
int slice;
int xspot, yspot;
DimType newPosition;
DimType currentPosition;
// unsigned int phase2;
std::vector<int> xshifts;
std::vector<int> yshifts;
xshifts.resize(dims[2],0);
yshifts.resize(dims[2],0);
find_shifts(xshifts, yshifts);
std::list<std::string> voxelArrayNames = m->getCellArrayNameList();
DimType progIncrement = dims[2]/100;
DimType prog = 1;
int progressInt = 0;
std::stringstream ss;
for (DimType i = 1; i < dims[2]; i++)
{
if (i > prog)
{
ss.str("");
progressInt = ((float)i/dims[2])*100.0;
ss << "Transferring Cell Data - " << progressInt << "% Complete";
notifyStatusMessage(ss.str());
prog = prog + progIncrement;
}
if (getCancel() == true)
{
return;
}
slice = static_cast<int>( (dims[2] - 1) - i );
for (DimType l = 0; l < dims[1]; l++)
{
for (DimType n = 0; n < dims[0]; n++)
{
if(yshifts[i] >= 0) yspot = static_cast<int>(l);
else if(yshifts[i] < 0) yspot = static_cast<int>( dims[1] - 1 - l );
if(xshifts[i] >= 0) xspot = static_cast<int>(n);
else if(xshifts[i] < 0) xspot = static_cast<int>( dims[0] - 1 - n );
newPosition = (slice * dims[0] * dims[1]) + (yspot * dims[0]) + xspot;
currentPosition = (slice * dims[0] * dims[1]) + ((yspot + yshifts[i]) * dims[0]) + (xspot + xshifts[i]);
if((yspot + yshifts[i]) >= 0 && (yspot + yshifts[i]) <= dims[1] - 1 && (xspot + xshifts[i]) >= 0
&& (xspot + xshifts[i]) <= dims[0] - 1)
{
for(std::list<std::string>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
std::string name = *iter;
IDataArray::Pointer p = m->getCellData(*iter);
p->CopyTuple(currentPosition, newPosition);
}
}
if((yspot + yshifts[i]) < 0 || (yspot + yshifts[i]) > dims[1] - 1 || (xspot + xshifts[i]) < 0
|| (xspot + xshifts[i]) > dims[0] - 1)
{
for(std::list<std::string>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter)
{
std::string name = *iter;
IDataArray::Pointer p = m->getCellData(*iter);
p->InitializeTuple(newPosition, 0.0); }
//.........这里部分代码省略.........
示例13: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void MultiThresholdCells::execute()
{
int err = 0;
std::stringstream ss;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The Voxel DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
int64_t nPoints = m->getTotalPoints();
dataCheck(false, m->getTotalPoints(), m->getNumFieldTuples(), m->getNumEnsembleTuples());
if (getErrorCondition() < 0)
{
return;
}
/* Place all your code to execute your filter here. */
IDataArray::Pointer outputArrayPtr = m->getCellData(m_OutputArrayName);
BoolArrayType* outputArray = BoolArrayType::SafeObjectDownCast<IDataArray*, BoolArrayType*>(outputArrayPtr.get());
if (NULL == outputArray)
{
setErrorCondition(-11002);
notifyErrorMessage("Could not properly cast the output array to a BoolArrayType", getErrorCondition());
return;
}
m_Output = outputArray->GetPointer(0);
// Prime our output array with the result of the first comparison
{
ComparisonInput_t& comp_0 = m_ComparisonInputs[0];
ThresholdFilterHelper filter(static_cast<DREAM3D::Comparison::Enumeration>(comp_0.compOperator),
comp_0.compValue,
outputArray);
err = filter.execute(m->getCellData(comp_0.arrayName).get(), outputArrayPtr.get());
if (err < 0)
{
setErrorCondition(-13001);
notifyErrorMessage("Error Executing threshold filter on first array", getErrorCondition());
return;
}
}
for(size_t i = 1; i < m_ComparisonInputs.size(); ++i)
{
BoolArrayType::Pointer currentArrayPtr = BoolArrayType::CreateArray(m->getTotalPoints(), "TEMP");
currentArrayPtr->initializeWithZeros();
bool* currentArray = currentArrayPtr->GetPointer(0);
ComparisonInput_t& compRef = m_ComparisonInputs[i];
ThresholdFilterHelper filter(static_cast<DREAM3D::Comparison::Enumeration>(compRef.compOperator),
compRef.compValue,
currentArrayPtr.get());
err = filter.execute(m->getCellData(compRef.arrayName).get(), currentArrayPtr.get());
if (err < 0)
{
setErrorCondition(-13002);
notifyErrorMessage("Error Executing threshold filter on array", getErrorCondition());
return;
}
for (int64_t p = 0; p < nPoints; ++p)
{
if(m_Output[p] == false || currentArray[p] == false)
{
m_Output[p] = false;
}
}
}
/* Let the GUI know we are done with this filter */
notifyStatusMessage("Complete");
}
示例14: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void QuickSolidMesh::execute()
{
setErrorCondition(0);
VoxelDataContainer* m = getVoxelDataContainer();
SolidMeshDataContainer* sm = getSolidMeshDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
int64_t totalPoints = m->getTotalPoints();
size_t totalFields = m->getNumFieldTuples();
size_t totalEnsembles = m->getNumEnsembleTuples();
dataCheck(false, totalPoints, totalFields, totalEnsembles);
if (getErrorCondition() < 0)
{
return;
}
size_t udims[3] = {0,0,0};
m->getDimensions(udims);
#if (CMP_SIZEOF_SIZE_T == 4)
typedef int32_t DimType;
#else
typedef int64_t DimType;
#endif
DimType dims[3] = {
static_cast<DimType>(udims[0]),
static_cast<DimType>(udims[1]),
static_cast<DimType>(udims[2]),
};
size_t xP = dims[0];
size_t yP = dims[1];
size_t zP = dims[2];
float xRes = m->getXRes();
float yRes = m->getYRes();
float zRes = m->getZRes();
int numNodes = (xP+1)*(yP+1)*(zP+1);
int numTetrahedrons = 6*(xP*yP*zP);
size_t point;
size_t nodeId1, nodeId2, nodeId3, nodeId4, nodeId5, nodeId6, nodeId7, nodeId8;
StructArray<Node>::Pointer vertices = StructArray<Node>::CreateArray(numNodes, DREAM3D::CellData::SolidMeshNodes);
StructArray<Tetrahedron>::Pointer tetrahedrons = StructArray<Tetrahedron>::CreateArray(numTetrahedrons, DREAM3D::CellData::SolidMeshTetrahedrons);
Node* vertex = vertices.get()->GetPointer(0);
Tetrahedron* tetrahedron = tetrahedrons.get()->GetPointer(0);
for(size_t k = 0; k < zP; k++)
{
for(size_t j = 0; j < yP; j++)
{
for(size_t i = 0; i < xP; i++)
{
point = (k*xP*yP)+(j*xP)+i;
nodeId1 = (k*(xP+1)*(yP+1)) + (j*(xP+1)) + i;
vertex[nodeId1].coord[0] = (i*xRes) - (xRes/2.0);
vertex[nodeId1].coord[1] = (j*yRes) - (yRes/2.0);
vertex[nodeId1].coord[2] = (k*zRes) - (zRes/2.0);
nodeId2 = (k*(xP+1)*(yP+1)) + (j*(xP+1)) + (i+1);
vertex[nodeId2].coord[0] = ((i+1)*xRes) - (xRes/2.0);
vertex[nodeId2].coord[1] = (j*yRes) - (yRes/2.0);
vertex[nodeId2].coord[2] = (k*zRes) - (zRes/2.0);
nodeId3 = (k*(xP+1)*(yP+1)) + ((j+1)*(xP+1)) + i;
vertex[nodeId3].coord[0] = (i*xRes) - (xRes/2.0);
vertex[nodeId3].coord[1] = ((j+1)*yRes) - (yRes/2.0);
vertex[nodeId3].coord[2] = (k*zRes) - (zRes/2.0);
nodeId4 = (k*(xP+1)*(yP+1)) + ((j+1)*(xP+1)) + (i+1);
vertex[nodeId4].coord[0] = ((i+1)*xRes) - (xRes/2.0);
vertex[nodeId4].coord[1] = ((j+1)*yRes) - (yRes/2.0);
vertex[nodeId4].coord[2] = (k*zRes) - (zRes/2.0);
nodeId5 = ((k+1)*(xP+1)*(yP+1)) + (j*(xP+1)) + i;
vertex[nodeId5].coord[0] = (i*xRes) - (xRes/2.0);
vertex[nodeId5].coord[1] = (j*yRes) - (yRes/2.0);
vertex[nodeId5].coord[2] = ((k+1)*zRes) - (zRes/2.0);
nodeId6 = ((k+1)*(xP+1)*(yP+1)) + (j*(xP+1)) + (i+1);
vertex[nodeId6].coord[0] = ((i+1)*xRes) - (xRes/2.0);
vertex[nodeId6].coord[1] = (j*yRes) - (yRes/2.0);
vertex[nodeId6].coord[2] = ((k+1)*zRes) - (zRes/2.0);
nodeId7 = ((k+1)*(xP+1)*(yP+1)) + ((j+1)*(xP+1)) + i;
vertex[nodeId7].coord[0] = (i*xRes) - (xRes/2.0);
vertex[nodeId7].coord[1] = ((j+1)*yRes) - (yRes/2.0);
vertex[nodeId7].coord[2] = ((k+1)*zRes) - (zRes/2.0);
nodeId8 = ((k+1)*(xP+1)*(yP+1)) + ((j+1)*(xP+1)) + (i+1);
//.........这里部分代码省略.........
示例15: if
//.........这里部分代码省略.........
msg = msg.append("Supported manufacturer codes are: ").append(Ebsd::Ctf::Manufacturer);
msg = msg.append(", ").append(Ebsd::Ang::Manufacturer).append(" and ").append(Ebsd::Mic::Manufacturer);
addErrorMessage(getHumanLabel(), msg, -1);
return;
}
// Sanity Check the Error Condition or the state of the EBSD Reader Object.
if(getErrorCondition() < 0 || NULL == ebsdReader.get())
{
return;
}
// Initialize all the arrays with some default values
int64_t totalPoints = m->getTotalPoints();
ss.str("");
ss << " - Initializing " << totalPoints << " voxels";
notifyStatusMessage(ss.str());
ss.str("");
ss << " - Reading Ebsd Data from file";
notifyStatusMessage(ss.str());
ebsdReader->setSliceStart(m_ZStartIndex);
ebsdReader->setSliceEnd(m_ZEndIndex);
ebsdReader->readAllArrays(false);
ebsdReader->setArraysToRead(m_SelectedVoxelCellArrays);
err = ebsdReader->loadData(m->getXPoints(), m->getYPoints(), m->getZPoints(), m_RefFrameZDir);
if(err < 0)
{
setErrorCondition(err);
PipelineMessage em (getHumanLabel(), "Error Loading Data from Ebsd Data file.", -1);
addErrorMessage(em);
return;
}
typedef DataArray<unsigned int> XTalStructArrayType;
GET_PREREQ_DATA(m, DREAM3D, EnsembleData, CrystalStructures, ss, -304, unsigned int, XTalStructArrayType, m->getNumEnsembleTuples(), 1)
GET_PREREQ_DATA(m, DREAM3D, EnsembleData, LatticeConstants, ss, -305, float, FloatArrayType, m->getNumEnsembleTuples(), 6)
// Copy the data from the pointers embedded in the reader object into our data container (Cell array).
if(manufacturer.compare(Ebsd::Ang::Manufacturer) == 0)
{
copyTSLArrays(ebsdReader.get());
}
else if(manufacturer.compare(Ebsd::Ctf::Manufacturer) == 0)
{
copyHKLArrays(ebsdReader.get());
}
else if(manufacturer.compare(Ebsd::Mic::Manufacturer) == 0)
{
copyHEDMArrays(ebsdReader.get());
}
else
{
std::string msg("Could not determine or match a supported manufacturer from the data file.");
msg = msg.append("Supported manufacturer codes are: ").append(Ebsd::Ctf::Manufacturer);
msg = msg.append(" and ").append(Ebsd::Ang::Manufacturer);
addErrorMessage(getHumanLabel(), msg, -10001);
return;
}
if(m_UseTransformations == true)
{
if(m_EulerTransformationAngle > 0)
{
FloatVec3Widget_t eulerAxis;
eulerAxis.x = m_EulerTransformationAxis[0];
eulerAxis.y = m_EulerTransformationAxis[1];
eulerAxis.z = m_EulerTransformationAxis[2];
RotateEulerRefFrame::Pointer rot_Euler = RotateEulerRefFrame::New();
rot_Euler->setObservers(this->getObservers());
rot_Euler->setVoxelDataContainer(getVoxelDataContainer());
rot_Euler->setRotationAngle(m_EulerTransformationAngle);
rot_Euler->setRotationAxis(eulerAxis);
rot_Euler->execute();
}
if(m_SampleTransformationAngle > 0)
{
FloatVec3Widget_t sampleAxis;
sampleAxis.x = m_SampleTransformationAxis[0];
sampleAxis.y = m_SampleTransformationAxis[1];
sampleAxis.z = m_SampleTransformationAxis[2];
RotateSampleRefFrame::Pointer rot_Sample = RotateSampleRefFrame::New();
rot_Sample->setObservers(this->getObservers());
rot_Sample->setVoxelDataContainer(getVoxelDataContainer());
rot_Sample->setRotationAngle(m_SampleTransformationAngle);
rot_Sample->setRotationAxis(sampleAxis);
rot_Sample->setsliceBySlice(true);
rot_Sample->execute();
}
}
// If there is an error set this to something negative and also set a message
ss.str("");
ss << getHumanLabel() << " Completed";
notifyStatusMessage(ss.str());
}