本文整理汇总了C++中VoxelDataContainer类的典型用法代码示例。如果您正苦于以下问题:C++ VoxelDataContainer类的具体用法?C++ VoxelDataContainer怎么用?C++ VoxelDataContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VoxelDataContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FlattenImage::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
//int err = 0;
int numImageComp = 1;
IDataArray::Pointer iDataArray = m->getCellData(m_ImageDataArrayName);
if(NULL != iDataArray.get())
{
UInt8ArrayType* imageDataPtr = UInt8ArrayType::SafePointerDownCast(iDataArray.get());
if (NULL != imageDataPtr)
{
numImageComp = imageDataPtr->GetNumberOfComponents();
}
}
GET_PREREQ_DATA(m, DREAM3D, CellData, ImageData, ss, -301, unsigned char, UCharArrayType, voxels, numImageComp)
// if(err == -301)
// {
// setErrorCondition(0);
// err = 0;
// GET_PREREQ_DATA(m, DREAM3D, CellData, ImageData, ss, -302, unsigned char, UCharArrayType, voxels, 3)
// }
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, FlatImageData, ss, int32_t, Int32ArrayType, 0, voxels, 1)
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:31,代码来源:FlattenImage.cpp
示例2: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AlignSectionsList::find_shifts(std::vector<int> &xshifts, std::vector<int> &yshifts)
{
VoxelDataContainer* m = getVoxelDataContainer();
//int64_t totalPoints = m->totalPoints();
std::ifstream inFile;
inFile.open(m_InputFile.c_str());
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 newxshift, newyshift;
for (DimType iter = 1; iter < dims[2]; iter++)
{
inFile >> slice >> newxshift >> newyshift;
xshifts[iter] = xshifts[iter-1] + newxshift;
yshifts[iter] = yshifts[iter-1] + newyshift;
}
inFile.close();
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:35,代码来源:AlignSectionsList.cpp
示例3: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:tuks188,项目名称:DREAM3D,代码行数:33,代码来源:AddOrientationNoise.cpp
示例4: notifyStatusMessage
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AddOrientationNoise::add_orientation_noise()
{
notifyStatusMessage("Adding Orientation Noise");
DREAM3D_RANDOMNG_NEW()
VoxelDataContainer* m = getVoxelDataContainer();
//float ea1, ea2, ea3;
float g[3][3];
float newg[3][3];
float rot[3][3];
float w, n1, n2, n3;
int64_t totalPoints = m->getTotalPoints();
for (size_t i = 0; i < static_cast<size_t>(totalPoints); ++i)
{
float ea1 = m_CellEulerAngles[3*i+0];
float ea2 = m_CellEulerAngles[3*i+1];
float ea3 = m_CellEulerAngles[3*i+2];
OrientationMath::EulertoMat(ea1, ea2, ea3, g);
n1 = static_cast<float>( rg.genrand_res53() );
n2 = static_cast<float>( rg.genrand_res53() );
n3 = static_cast<float>( rg.genrand_res53() );
w = static_cast<float>( rg.genrand_res53() );
w = 2.0*(w-0.5);
w = (m_Magnitude*w);
OrientationMath::AxisAngletoMat(w, n1, n2, n3, rot);
MatrixMath::Multiply3x3with3x3(g, rot, newg);
OrientationMath::MattoEuler(newg, ea1, ea2, ea3);
m_CellEulerAngles[3*i+0] = ea1;
m_CellEulerAngles[3*i+1] = ea2;
m_CellEulerAngles[3*i+2] = ea3;
}
}
开发者ID:tuks188,项目名称:DREAM3D,代码行数:36,代码来源:AddOrientationNoise.cpp
示例5: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void AdjustVolumeOrigin::execute()
{
VoxelDataContainer* m = getVoxelDataContainer();
if(NULL == m)
{
setErrorCondition(-999);
notifyErrorMessage("The DataContainer Object was NULL", -999);
return;
}
setErrorCondition(0);
std::stringstream ss;
// Set the Voxel Volume First, since this is easy
if (m_ApplyToVoxelVolume ==true)
{
m->setOrigin(m_Origin.x, m_Origin.y, m_Origin.z);
}
if (m_ApplyToSurfaceMesh == true)
{
updateSurfaceMesh();
}
if (m_ApplyToSolidMesh == true)
{
updatesSolidMesh();
}
notifyStatusMessage("Complete");
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:32,代码来源:AdjustVolumeOrigin.cpp
示例6: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void Threshold::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if(m_SelectedCellArrayName.empty() == true)
{
setErrorCondition(-11000);
ss << "An array from the Voxel Data Container must be selected.";
addErrorMessage(getHumanLabel(),ss.str(),getErrorCondition());
}
else
{
m_RawImageDataArrayName=m_SelectedCellArrayName;
GET_PREREQ_DATA(m, DREAM3D, CellData, RawImageData, ss, -300, ImageProcessing::DefaultPixelType, ImageProcessing::DefaultArrayType, voxels, 1)
if(m_OverwriteArray)
{
}
else
{
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, ProcessedImageData, ss, ImageProcessing::DefaultPixelType, ImageProcessing::DefaultArrayType, 0, voxels, 1)
m->renameCellData(m_ProcessedImageDataArrayName, m_NewCellArrayName);
}
}
}
开发者ID:leavy,项目名称:DREAM3D,代码行数:31,代码来源:Threshold.cpp
示例7: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:28,代码来源:AlignSectionsFeature.cpp
示例8: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:62,代码来源:FlattenImage.cpp
示例9: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void DxReader::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if (getInputFile().empty() == true)
{
ss << ClassName() << " needs the Input File Set and it was not.";
setErrorCondition(-387);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
else if (MXAFileInfo::exists(getInputFile()) == false)
{
ss << "The input file does not exist.";
setErrorCondition(-388);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, GrainIds, ss, int32_t, Int32ArrayType, 0, voxels, 1)
m->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z);
m->setOrigin(m_Origin.x, m_Origin.y, m_Origin.z);
if (m_InStream.is_open() == true)
{
m_InStream.close();
}
// We need to read the header of the input file to get the dimensions
m_InStream.open(getInputFile().c_str(), std::ios_base::binary);
if(!m_InStream)
{
ss.clear();
ss << " Runtime Error. The input file '" << getInputFile() << "' could not be"
<< " opened for reading. Do you have access to this file?";
setErrorCondition(-49800);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
return;
}
int error = readHeader();
m_InStream.close();
if (error < 0)
{
setErrorCondition(error);
ss.clear();
ss << "Error occurred trying to parse the dimensions from the input file. Is the input file a Dx file?";
addErrorMessage(getHumanLabel(), ss.str(), -11000);
}
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:54,代码来源:DxReader.cpp
示例10: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
int VoxelDataContainerWriter::writeEnsembleData(hid_t dcGid)
{
std::stringstream ss;
int err = 0;
VoxelDataContainer* m = getVoxelDataContainer();
// Write the Ensemble data
err = H5Utilities::createGroupsFromPath(H5_ENSEMBLE_DATA_GROUP_NAME, dcGid);
if(err < 0)
{
ss.str("");
ss << "Error creating HDF Group " << H5_ENSEMBLE_DATA_GROUP_NAME << std::endl;
setErrorCondition(-66);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
err = H5Lite::writeStringAttribute(dcGid, H5_ENSEMBLE_DATA_GROUP_NAME, H5_NAME, H5_ENSEMBLE_DATA_DEFAULT);
hid_t ensembleGid = H5Gopen(dcGid, H5_ENSEMBLE_DATA_GROUP_NAME, H5P_DEFAULT);
if(err < 0)
{
ss.str("");
ss << "Error opening ensemble Group " << H5_ENSEMBLE_DATA_GROUP_NAME << std::endl;
setErrorCondition(-67);
notifyErrorMessage( ss.str(), err);
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
NameListType names = m->getEnsembleArrayNameList();
for (NameListType::iterator iter = names.begin(); iter != names.end(); ++iter)
{
IDataArray::Pointer array = m->getEnsembleData(*iter);
err = array->writeH5Data(ensembleGid);
if(err < 0)
{
ss.str("");
ss << "Error writing Ensemble array '" << *iter << "' to the HDF5 File";
notifyErrorMessage( ss.str(), err);
setErrorCondition(err);
H5Gclose(ensembleGid); // Close the Cell Group
H5Gclose(dcGid); // Close the Data Container Group
return err;
}
}
H5Gclose(ensembleGid);
return err;
}
开发者ID:leavy,项目名称:DREAM3D,代码行数:53,代码来源:VoxelDataContainerWriter.cpp
示例11: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void ReadH5Ebsd::copyHEDMArrays(H5EbsdVolumeReader* ebsdReader)
{
float* f1 = NULL;
float* f2 = NULL;
float* f3 = NULL;
int* phasePtr = NULL;
FloatArrayType::Pointer fArray = FloatArrayType::NullPointer();
Int32ArrayType::Pointer iArray = Int32ArrayType::NullPointer();
VoxelDataContainer* m = getVoxelDataContainer();
int64_t totalPoints = m->getTotalPoints();
if (m_SelectedVoxelCellArrays.find(m_CellEulerAnglesArrayName) != m_SelectedVoxelCellArrays.end() )
{
// radianconversion = M_PI / 180.0;
f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Mic::Euler1));
f2 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Mic::Euler2));
f3 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Mic::Euler3));
fArray = FloatArrayType::CreateArray(totalPoints * 3, DREAM3D::CellData::EulerAngles);
fArray->SetNumberOfComponents(3);
float* cellEulerAngles = fArray->GetPointer(0);
for (int64_t i = 0; i < totalPoints; i++)
{
cellEulerAngles[3 * i] = f1[i];
cellEulerAngles[3 * i + 1] = f2[i];
cellEulerAngles[3 * i + 2] = f3[i];
}
m->addCellData(DREAM3D::CellData::EulerAngles, fArray);
}
if (m_SelectedVoxelCellArrays.find(m_CellPhasesArrayName) != m_SelectedVoxelCellArrays.end() )
{
phasePtr = reinterpret_cast<int*>(ebsdReader->getPointerByName(Ebsd::Mic::Phase));
iArray = Int32ArrayType::CreateArray(totalPoints, DREAM3D::CellData::Phases);
iArray->SetNumberOfComponents(1);
::memcpy(iArray->GetPointer(0), phasePtr, sizeof(int32_t) * totalPoints);
m->addCellData(DREAM3D::CellData::Phases, iArray);
}
if (m_SelectedVoxelCellArrays.find(Ebsd::Mic::Confidence) != m_SelectedVoxelCellArrays.end() )
{
f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Mic::Confidence));
fArray = FloatArrayType::CreateArray(totalPoints, Ebsd::Mic::Confidence);
fArray->SetNumberOfComponents(1);
::memcpy(fArray->GetPointer(0), f1, sizeof(float) * totalPoints);
m->addCellData(Ebsd::Mic::Confidence, fArray);
}
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:52,代码来源:ReadH5Ebsd.cpp
示例12: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:52,代码来源:AvizoRectilinearCoordinateWriter.cpp
示例13: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void YSChoiAbaqusReader::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
if (getInputFile().empty() == true)
{
ss << ClassName() << " needs the Input File Set and it was not.";
setErrorCondition(-387);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
else if (MXAFileInfo::exists(getInputFile()) == false)
{
ss << "The input file does not exist.";
setErrorCondition(-388);
addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition());
}
else
{
const unsigned int size(1024);
char buf[size];
// Read header from data file to figure out how many points there are
std::ifstream in(getInputFile().c_str());
std::string word;
bool headerdone = false;
int xpoints, ypoints, zpoints;
float resx, resy, resz;
while (headerdone == false)
{
in.getline(buf, size);
std::string line = buf;
in >> word;
if (DIMS == word)
{
in >> xpoints >> ypoints >> zpoints;
size_t dims[3] = {xpoints, ypoints, zpoints};
m->setDimensions(dims);
m->setOrigin(0,0,0);
}
if (RES == word)
{
in >> resx >> resy >> resz;
float res[3] = {resx, resy, resz};
m->setResolution(res);
}
}
开发者ID:tuks188,项目名称:DREAM3D,代码行数:50,代码来源:YSChoiAbaqusReader.cpp
示例14: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void UpdateCellQuats::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();
//getting the 5 component quaternions from the data container and down-casting them
IDataArray::Pointer Quats5 = m->getCellData(DREAM3D::CellData::Quats);
if(Quats5->GetNumberOfComponents() != 5)
{
notifyErrorMessage("The Quats array did not contain 5 components", -999);
return;
}
DataArray<float>* quats5 = DataArray<float>::SafePointerDownCast(Quats5.get());
float* quats5ptr = quats5->GetPointer(0);
//creating the 4 component quaternions in the data container
CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, Quats, ss, float, FloatArrayType, 0, totalPoints, 4)
if (getErrorCondition() < 0)
{
return;
}
//copying the 5 component quaternions into the new 4 component quaternions
// This is a special case for dealing with this conversion. If you are dealing with
// quaternions then DO NOT USE THIS CODE as an example. Use another filter instead.
for (int i = 0; i < totalPoints; i++)
{
for(int j=0;j<4;j++)
{
m_Quats[4*i+j] = quats5ptr[5*i+(j+1)];
}
}
notifyStatusMessage("Complete");
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:48,代码来源:UpdateCellQuats.cpp
示例15: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FindAxisODF::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles)
{
setErrorCondition(0);
std::stringstream ss;
VoxelDataContainer* m = getVoxelDataContainer();
int err = 0;
GET_PREREQ_DATA(m, DREAM3D, FieldData, AxisEulerAngles, ss, -301, float, FloatArrayType, fields, 3)
TEST_PREREQ_DATA(m, DREAM3D, FieldData, SurfaceFields, err, -302, bool, BoolArrayType, fields, 1)
if(err == -302)
{
setErrorCondition(0);
FindSurfaceGrains::Pointer find_surfacefields = FindSurfaceGrains::New();
find_surfacefields->setObservers(this->getObservers());
find_surfacefields->setVoxelDataContainer(getVoxelDataContainer());
if(preflight == true) find_surfacefields->preflight();
if(preflight == false) find_surfacefields->execute();
}
GET_PREREQ_DATA(m, DREAM3D, FieldData, SurfaceFields, ss, -302, bool, BoolArrayType, fields, 1)
err = 0;
TEST_PREREQ_DATA(m, DREAM3D, FieldData, FieldPhases, err, -303, int32_t, Int32ArrayType, fields, 1)
if(err == -303)
{
setErrorCondition(0);
FindGrainPhases::Pointer find_grainphases = FindGrainPhases::New();
find_grainphases->setObservers(this->getObservers());
find_grainphases->setVoxelDataContainer(getVoxelDataContainer());
if(preflight == true) find_grainphases->preflight();
if(preflight == false) find_grainphases->execute();
}
GET_PREREQ_DATA(m, DREAM3D, FieldData, FieldPhases, ss, -303, int32_t, Int32ArrayType, fields, 1)
typedef DataArray<unsigned int> PhaseTypeArrayType;
GET_PREREQ_DATA(m, DREAM3D, EnsembleData, PhaseTypes, ss, -307, unsigned int, PhaseTypeArrayType, ensembles, 1)
m_StatsDataArray = StatsDataArray::SafeObjectDownCast<IDataArray*, StatsDataArray*>(m->getEnsembleData(DREAM3D::EnsembleData::Statistics).get());
if(m_StatsDataArray == NULL)
{
StatsDataArray::Pointer p = StatsDataArray::New();
m_StatsDataArray = p.get();
m_StatsDataArray->fillArrayWithNewStatsData(ensembles, m_PhaseTypes);
m->addEnsembleData(DREAM3D::EnsembleData::Statistics, p);
}
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:48,代码来源:FindAxisODF.cpp
示例16: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:leavy,项目名称:DREAM3D,代码行数:44,代码来源:RotateEulerRefFrame.cpp
示例17: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:42,代码来源:FindCellQuats.cpp
示例18: getVoxelDataContainer
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}
}
}
开发者ID:chongbingbao,项目名称:DREAM3D,代码行数:42,代码来源:PerPhaseMinSize.cpp
示例19: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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);
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:41,代码来源:LinkFieldMapToCellArray.cpp
示例20: setErrorCondition
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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");
}
开发者ID:mahendra-ramajayam,项目名称:DREAM3D,代码行数:56,代码来源:ClearData.cpp
注:本文中的VoxelDataContainer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论