// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ReadH5Ebsd::copyTSLArrays(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_CellPhasesArrayName) != m_SelectedVoxelCellArrays.end() ) { phasePtr = reinterpret_cast<int*>(ebsdReader->getPointerByName(Ebsd::Ang::PhaseData)); 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(m_CellEulerAnglesArrayName) != m_SelectedVoxelCellArrays.end() ) { f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::Phi1)); f2 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::Phi)); f3 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::Phi2)); fArray = FloatArrayType::CreateArray(totalPoints, 3, DREAM3D::CellData::EulerAngles); 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(Ebsd::Ang::ImageQuality) != m_SelectedVoxelCellArrays.end() ) { f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::ImageQuality)); fArray = FloatArrayType::CreateArray(totalPoints, Ebsd::Ang::ImageQuality); ::memcpy(fArray->GetPointer(0), f1, sizeof(float) * totalPoints); m->addCellData(Ebsd::Ang::ImageQuality, fArray); } if (m_SelectedVoxelCellArrays.find(Ebsd::Ang::ConfidenceIndex) != m_SelectedVoxelCellArrays.end() ) { f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::ConfidenceIndex)); fArray = FloatArrayType::CreateArray(totalPoints, Ebsd::Ang::ConfidenceIndex); ::memcpy(fArray->GetPointer(0), f1, sizeof(float) * totalPoints); m->addCellData(Ebsd::Ang::ConfidenceIndex, fArray); } if (m_SelectedVoxelCellArrays.find(Ebsd::Ang::SEMSignal) != m_SelectedVoxelCellArrays.end() ) { f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::SEMSignal)); fArray = FloatArrayType::CreateArray(totalPoints, Ebsd::Ang::SEMSignal); ::memcpy(fArray->GetPointer(0), f1, sizeof(float) * totalPoints); m->addCellData(Ebsd::Ang::SEMSignal, fArray); } if (m_SelectedVoxelCellArrays.find(Ebsd::Ang::Fit) != m_SelectedVoxelCellArrays.end() ) { f1 = reinterpret_cast<float*>(ebsdReader->getPointerByName(Ebsd::Ang::Fit)); fArray = FloatArrayType::CreateArray(totalPoints, Ebsd::Ang::Fit); ::memcpy(fArray->GetPointer(0), f1, sizeof(float) * totalPoints); m->addCellData(Ebsd::Ang::Fit, fArray); } }