本文整理汇总了C++中VoxelDataContainer::getNumFieldTuples方法的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer::getNumFieldTuples方法的具体用法?C++ VoxelDataContainer::getNumFieldTuples怎么用?C++ VoxelDataContainer::getNumFieldTuples使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VoxelDataContainer
的用法示例。
在下文中一共展示了VoxelDataContainer::getNumFieldTuples方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
}
示例2: 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");
}
示例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: remove_smallgrains
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PerPhaseMinSize::remove_smallgrains()
{
VoxelDataContainer* m = getVoxelDataContainer();
int64_t totalPoints = m->getTotalPoints();
bool good = false;
int gnum;
int numgrains = m->getNumFieldTuples();
std::vector<int> voxcounts;
voxcounts.resize(numgrains,0);
for (int64_t i = 0; i < totalPoints; i++)
{
gnum = m_GrainIds[i];
if(gnum >= 0) voxcounts[gnum]++;
}
for (size_t i = 1; i < static_cast<size_t>(numgrains); i++)
{
m_Active[i] = true;
if(voxcounts[i] >= getMinAllowedGrainSize() || m_FieldPhases[i] != m_PhaseNumber) good = true;
}
if(good == false)
{
setErrorCondition(-1);
notifyErrorMessage("The minimum size is larger than the largest Field. All Fields would be removed. The filter has quit.", -1);
return;
}
for (int64_t i = 0; i < totalPoints; i++)
{
gnum = m_GrainIds[i];
if(voxcounts[gnum] < getMinAllowedGrainSize() && m_CellPhases[i] == m_PhaseNumber && gnum > 0)
{
m_GrainIds[i] = -1;
m_Active[gnum] = false;
}
}
}
示例9: 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");
}
示例10: 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++)
{
//.........这里部分代码省略.........
示例11: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindNeighbors::execute()
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
int64_t totalPoints = m->getTotalPoints();
int totalFields = int(m->getNumFieldTuples());
dataCheck(false, totalPoints, totalFields, 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]),
};
DimType neighpoints[6];
neighpoints[0] = -dims[0]*dims[1];
neighpoints[1] = -dims[0];
neighpoints[2] = -1;
neighpoints[3] = 1;
neighpoints[4] = dims[0];
neighpoints[5] = dims[0]*dims[1];
float column, row, plane;
int grain;
size_t nnum;
int onsurf = 0;
int good = 0;
int neighbor = 0;
//size_t xtalCount = m->getEnsembleData(DREAM3D::EnsembleData::CrystalStructures)->GetNumberOfTuples();
std::vector<std::vector<int> > neighborlist;
std::vector<std::vector<float> > neighborsurfacearealist;
int nListSize = 100;
neighborlist.resize(totalFields);
neighborsurfacearealist.resize(totalFields);
for (int i = 1; i < totalFields; i++)
{
std::stringstream ss;
ss << "Finding Neighbors - Initializing Neighbor Lists - " << (static_cast<float>(i)/totalFields)*100 << " Percent Complete";
// notifyStatusMessage(ss.str());
m_NumNeighbors[i] = 0;
neighborlist[i].resize(nListSize);
neighborsurfacearealist[i].resize(nListSize, -1.0);
m_SurfaceFields[i] = false;
}
totalPoints = m->getTotalPoints();
for (int64_t j = 0; j < totalPoints; j++)
{
std::stringstream ss;
ss << "Finding Neighbors - Determining Neighbor Lists - " << (static_cast<float>(j)/totalPoints)*100 << " Percent Complete";
// notifyStatusMessage(ss.str());
onsurf = 0;
grain = m_GrainIds[j];
if(grain > 0)
{
column = static_cast<float>( j % m->getXPoints() );
row = static_cast<float>( (j / m->getXPoints()) % m->getYPoints() );
plane = static_cast<float>( j / (m->getXPoints() * m->getYPoints()) );
if((column == 0 || column == (m->getXPoints() - 1) || row == 0 || row == (m->getYPoints() - 1) || plane == 0 || plane == (m->getZPoints() - 1)) && m->getZPoints() != 1)
{
m_SurfaceFields[grain] = true;
}
if((column == 0 || column == (m->getXPoints() - 1) || row == 0 || row == (m->getYPoints() - 1)) && m->getZPoints() == 1)
{
m_SurfaceFields[grain] = true;
}
for (int k = 0; k < 6; k++)
{
good = 1;
neighbor = static_cast<int>( j + neighpoints[k] );
if(k == 0 && plane == 0) good = 0;
if(k == 5 && plane == (m->getZPoints() - 1)) good = 0;
if(k == 1 && row == 0) good = 0;
//.........这里部分代码省略.........
示例12: execute
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FieldDataCSVWriter::execute()
{
int err = 0;
setErrorCondition(err);
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
// 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_FieldDataFile);
if(!MXADir::mkdir(parentPath, true))
{
std::stringstream ss;
ss << "Error creating parent path '" << parentPath << "'";
notifyErrorMessage(ss.str(), -1);
setErrorCondition(-1);
return;
}
std::string filename = getFieldDataFile();
std::ofstream outFile;
outFile.open(filename.c_str(), std::ios_base::binary);
char space = DREAM3D::GrainData::Delimiter;
// Write the total number of grains
outFile << m->getNumFieldTuples()-1 << std::endl;
// Get all the names of the arrays from the Data Container
std::list<std::string> headers = m->getFieldArrayNameList();
std::vector<IDataArray::Pointer> data;
//For checking if an array is a neighborlist
NeighborList<int>::Pointer neighborlistPtr = NeighborList<int>::New();
// Print the GrainIds Header before the rest of the headers
outFile << DREAM3D::GrainData::GrainID;
// Loop throught the list and print the rest of the headers, ignoring those we don't want
for(std::list<std::string>::iterator iter = headers.begin(); iter != headers.end(); ++iter)
{
// Only get the array if the name does NOT match those listed
IDataArray::Pointer p = m->getFieldData(*iter);
if(p->getNameOfClass().compare(neighborlistPtr->getNameOfClass()) != 0)
{
if (p->GetNumberOfComponents() == 1) {
outFile << space << (*iter);
}
else // There are more than a single component so we need to add multiple header values
{
for(int k = 0; k < p->GetNumberOfComponents(); ++k)
{
outFile << space << (*iter) << "_" << k;
}
}
// Get the IDataArray from the DataContainer
data.push_back(p);
}
}
outFile << std::endl;
// Get the number of tuples in the arrays
size_t numTuples = data[0]->GetNumberOfTuples();
std::stringstream ss;
float threshold = 0.0f;
// Skip the first grain
for(size_t i = 1; i < numTuples; ++i)
{
if (((float)i / numTuples) * 100.0f > threshold) {
ss.str("");
ss << "Writing Field Data - " << ((float)i / numTuples) * 100 << "% Complete";
notifyStatusMessage(ss.str());
threshold = threshold + 5.0f;
if (threshold < ((float)i / numTuples) * 100.0f) {
threshold = ((float)i / numTuples) * 100.0f;
}
}
// Print the grain id
outFile << i;
// Print a row of data
for( std::vector<IDataArray::Pointer>::iterator p = data.begin(); p != data.end(); ++p)
{
outFile << space;
(*p)->printTuple(outFile, i, space);
}
outFile << std::endl;
}
if(m_WriteNeighborListData == true)
{
//.........这里部分代码省略.........
示例13: 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);
//.........这里部分代码省略.........
示例14: 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();
//.........这里部分代码省略.........
示例15: 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");
}