// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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 ChangeResolution::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; } setErrorCondition(0); if (getErrorCondition() < 0) { return; } if(m->getXRes() == m_Resolution.x && m->getYRes() == m_Resolution.y && m->getZRes() == m_Resolution.z) { return; } size_t dims[3]; m->getDimensions(dims); float sizex = (dims[0])*m->getXRes(); float sizey = (dims[1])*m->getYRes(); float sizez = (dims[2])*m->getZRes(); int m_XP = int(sizex / m_Resolution.x); int m_YP = int(sizey / m_Resolution.y); int m_ZP = int(sizez / m_Resolution.z); int64_t totalPoints = m_XP*m_YP*m_ZP; float x, y, z; int col, row, plane; int index; int index_old; std::vector<size_t> newindicies; newindicies.resize(totalPoints); for (int i = 0; i < m_ZP; i++) { std::stringstream ss; ss << "Changing Resolution - " << ((float)i/m->getZPoints())*100 << " Percent Complete"; notifyStatusMessage(ss.str()); for (int j = 0; j < m_YP; j++) { for (int k = 0; k < m_XP; k++) { x = (k * m_Resolution.x); y = (j * m_Resolution.y); z = (i * m_Resolution.z); col = int(x / m->getXRes()); row = int(y / m->getYRes()); plane = int(z / m->getZRes()); index_old = (plane * m->getXPoints() * m->getYPoints()) + (row * m->getXPoints()) + col; index = (i * m_XP * m_YP) + (j * m_XP) + k; newindicies[index] = index_old; } } } std::list<std::string> voxelArrayNames = m->getCellArrayNameList(); for (std::list<std::string>::iterator iter = voxelArrayNames.begin(); iter != voxelArrayNames.end(); ++iter) { std::string name = *iter; IDataArray::Pointer p = m->getCellData(*iter); // Make a copy of the 'p' array that has the same name. When placed into // the data container this will over write the current array with // the same name. At least in theory IDataArray::Pointer data = p->createNewArray(p->GetNumberOfTuples(), p->GetNumberOfComponents(), p->GetName()); data->Resize(totalPoints); void* source = NULL; void* destination = NULL; size_t newIndicies_I = 0; int nComp = data->GetNumberOfComponents(); for (size_t i = 0; i < static_cast<size_t>(totalPoints); i++) { newIndicies_I = newindicies[i]; source = p->GetVoidPointer((nComp * newIndicies_I)); destination = data->GetVoidPointer((data->GetNumberOfComponents() * i)); ::memcpy(destination, source, p->GetTypeSize() * data->GetNumberOfComponents()); } m->addCellData(*iter, data); } m->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z); m->setDimensions(m_XP, m_YP, m_ZP); notifyStatusMessage("Complete"); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void RawBinaryReader::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); // Get the total size of the array from the options size_t voxels = m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; if (m_OverRideOriginResolution == true) { m->setOrigin(m_Origin.x, m_Origin.y, m_Origin.z); m->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z); } m->setDimensions(m_Dimensions.x, m_Dimensions.y, m_Dimensions.z); array = IDataArray::NullPointer(); if (m_ScalarType == Detail::Int8) { Int8ArrayType::Pointer p = Int8ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<int8_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::UInt8) { UInt8ArrayType::Pointer p = UInt8ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<uint8_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::Int16) { Int16ArrayType::Pointer p = Int16ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<int16_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::UInt16) { UInt16ArrayType::Pointer p = UInt16ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<uint16_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::Int32) { Int32ArrayType::Pointer p = Int32ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<int32_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::UInt32) { UInt32ArrayType::Pointer p = UInt32ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<uint32_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::Int64) { Int64ArrayType::Pointer p = Int64ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<int64_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::UInt64) { UInt64ArrayType::Pointer p = UInt64ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<uint64_t>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::Float) { FloatArrayType::Pointer p = FloatArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<float>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } else if (m_ScalarType == Detail::Double) { DoubleArrayType::Pointer p = DoubleArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); err = ReadBinaryFile<double>(p, m_InputFile, m_SkipHeaderBytes); if (err >= 0 ) { SWAP_ARRAY(p) array = p;} } if (NULL != array.get()) { m->addCellData(array->GetName(), array); } else if(err == RBR_FILE_NOT_OPEN ) { setErrorCondition(RBR_FILE_NOT_OPEN); notifyErrorMessage("RawBinaryReader was unable to open the specified file.", getErrorCondition()); } else if (err == RBR_FILE_TOO_SMALL) { setErrorCondition(RBR_FILE_TOO_SMALL); notifyErrorMessage("The file size is smaller than the allocated size.", getErrorCondition()); } else if (err == RBR_FILE_TOO_BIG) { notifyWarningMessage("The file size is larger than the allocated size.", RBR_FILE_TOO_BIG); } else if(err == RBR_READ_EOF) { setErrorCondition(RBR_READ_EOF); notifyErrorMessage("RawBinaryReader read past the end of the specified file.", getErrorCondition()); } /* Let the GUI know we are done with this filter */ notifyStatusMessage("Complete"); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void RawBinaryReader::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()); } if(m_OutputArrayName.empty() == true) { ss.str(""); ss << "The Output Array Name is blank (empty) and a value must be filled in for the pipeline to complete."; setErrorCondition(-398); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } if (m_NumberOfComponents < 1) { ss.str(""); ss << "The number of components must be larger than Zero"; setErrorCondition(-391); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } if (m_Dimensionality < 1) { ss.str(""); ss << "The dimensionality must be larger than Zero"; setErrorCondition(-389); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } if ( m_Dimensions.x == 0 || m_Dimensions.y == 0 || m_Dimensions.z == 0) { ss.str(""); ss << "One of the dimensions has a size less than or Equal to Zero (0). The minimum size must be greater than One (1)."; setErrorCondition(-390); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } if (true == preflight) { size_t allocatedBytes = 0; IDataArray::Pointer p = IDataArray::NullPointer(); if (m_ScalarType == Detail::Int8) { p = Int8ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(int8_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::UInt8) { p = UInt8ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(uint8_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::Int16) { p = Int16ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(int16_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::UInt16) { p = UInt16ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(uint16_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::Int32) { p = Int32ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(int32_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::UInt32) { p = UInt32ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(uint32_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::Int64) { p = Int64ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(int64_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::UInt64) { p = UInt64ArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(uint64_t) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::Float) { p = FloatArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(float) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } else if (m_ScalarType == Detail::Double) { p = DoubleArrayType::CreateArray(voxels, m_NumberOfComponents, m_OutputArrayName); allocatedBytes = sizeof(double) * m_NumberOfComponents * m_Dimensions.x * m_Dimensions.y * m_Dimensions.z; } // Sanity Check Allocated Bytes versus size of file uint64_t fileSize = MXAFileInfo::fileSize(m_InputFile); int check = SanityCheckFileSizeVersusAllocatedSize(allocatedBytes, fileSize, m_SkipHeaderBytes); if (check == -1) { ss.str(""); ss << "The file size is " << fileSize << " but the number of bytes needed to fill the array is " << allocatedBytes << ". This condition would cause an error reading the input file."; ss << " Please adjust the input parameters to match the size of the file or select a different data file."; setErrorCondition(RBR_FILE_TOO_SMALL); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } else if (check == 1) { ss.str(""); ss << "The file size is " << fileSize << " but the number of bytes needed to fill the array is " << allocatedBytes << " which is less than the size of the file."; ss << " DREAM3D will read only the first part of the file into the array."; addWarningMessage(getHumanLabel(), ss.str(), RBR_FILE_TOO_BIG); } m->addCellData(p->GetName(), p); m->setDimensions(m_Dimensions.x, m_Dimensions.y, m_Dimensions.z); m->setResolution(m_Resolution.x, m_Resolution.y, m_Resolution.z); m->setOrigin(m_Origin.x, m_Origin.y, m_Origin.z); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ReadH5Ebsd::dataCheck(bool preflight, size_t voxels, size_t fields, size_t ensembles) { setErrorCondition(0); std::stringstream ss; VoxelDataContainer* m = getVoxelDataContainer(); if (NULL == m) { ss.str(""); ss << getHumanLabel() << "The VoxelDataContainer was NULL and this is NOT allowed. There is an error in the programming. Please contact the developers"; setErrorCondition(-1); addErrorMessage(getHumanLabel(), ss.str(), -1); return; } if (m_InputFile.empty() == true && m_Manufacturer == Ebsd::UnknownManufacturer) { ss.str(""); ss << getHumanLabel() << ": Either the H5Ebsd file must exist or the Manufacturer must be set"; setErrorCondition(-1); addErrorMessage(getHumanLabel(), ss.str(), -1); } else if (MXAFileInfo::exists(m_InputFile) == false) { ss << "The input file does not exist."; setErrorCondition(-388); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } else if (m_InputFile.empty() == false) { H5EbsdVolumeInfo::Pointer reader = H5EbsdVolumeInfo::New(); reader->setFileName(m_InputFile); int err = reader->readVolumeInfo(); if (err < 0) { ss << getHumanLabel() << ": Error reading VolumeInfo from H5Ebsd File"; setErrorCondition(-1); addErrorMessage(getHumanLabel(), ss.str(), -1); return; } std::string manufacturer = reader->getManufacturer(); if(manufacturer.compare(Ebsd::Ang::Manufacturer) == 0) { m_Manufacturer = Ebsd::TSL; } else if(manufacturer.compare(Ebsd::Ctf::Manufacturer) == 0) { m_Manufacturer = Ebsd::HKL; } else if(manufacturer.compare(Ebsd::Mic::Manufacturer) == 0) { m_Manufacturer = Ebsd::HEDM; } else { ss << getHumanLabel() << ": Original Data source could not be determined. It should be TSL, HKL or HEDM"; setErrorCondition(-1); addErrorMessage(getHumanLabel(), ss.str(), -1); return; } int64_t dims[3]; float res[3]; reader->getDimsAndResolution(dims[0], dims[1], dims[2], res[0], res[1], res[2]); /* Sanity check what we are trying to load to make sure it can fit in our address space. * Note that this does not guarantee the user has enough left, just that the * size of the volume can fit in the address space of the program */ #if (CMP_SIZEOF_SSIZE_T==4) int64_t max = std::numeric_limits<size_t>::max(); #else int64_t max = std::numeric_limits<int64_t>::max(); #endif if(dims[0] * dims[1] * dims[2] > max) { err = -1; std::stringstream s; s << "The total number of elements '" << (dims[0] * dims[1] * dims[2]) << "' is greater than this program can hold. Try the 64 bit version."; setErrorCondition(err); addErrorMessage(getHumanLabel(), s.str(), -1); return; } if(dims[0] > max || dims[1] > max || dims[2] > max) { err = -1; std::stringstream s; s << "One of the dimensions is greater than the max index for this sysem. Try the 64 bit version."; s << " dim[0]=" << dims[0] << " dim[1]=" << dims[1] << " dim[2]=" << dims[2]; setErrorCondition(err); addErrorMessage(getHumanLabel(), s.str(), -1); return; } /* ************ End Sanity Check *************************** */ size_t dcDims[3] = { dims[0], dims[1], dims[2] }; m->setDimensions(dcDims); m->setResolution(res); m->setOrigin(0.0f, 0.0f, 0.0f); } H5EbsdVolumeReader::Pointer reader; std::vector<std::string> names; if (m_Manufacturer == Ebsd::TSL) { AngFields fields; reader = H5AngVolumeReader::New(); names = fields.getFilterFields<std::vector<std::string> > (); } else if (m_Manufacturer == Ebsd::HKL) { CtfFields fields; reader = H5CtfVolumeReader::New(); names = fields.getFilterFields<std::vector<std::string> > (); } else if (m_Manufacturer == Ebsd::HEDM) { MicFields fields; reader = H5MicVolumeReader::New(); names = fields.getFilterFields<std::vector<std::string> > (); } else { ss << getHumanLabel() << ": Original Data source could not be determined. It should be TSL or HKL"; setErrorCondition(-1); addErrorMessage(getHumanLabel(), ss.str(), -1); return; } for (size_t i = 0; i < names.size(); ++i) { if (reader->getPointerType(names[i]) == Ebsd::Int32) { Int32ArrayType::Pointer array = Int32ArrayType::CreateArray(voxels, names[i]); m->addCellData(names[i], array); } else if (reader->getPointerType(names[i]) == Ebsd::Float) { FloatArrayType::Pointer array = FloatArrayType::CreateArray(voxels, names[i]); m->addCellData(names[i], array); } } CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, CellEulerAngles, ss, float, FloatArrayType, 0, voxels, 3) CREATE_NON_PREREQ_DATA(m, DREAM3D, CellData, CellPhases, ss, int32_t, Int32ArrayType, 0, voxels, 1) typedef DataArray<unsigned int> XTalStructArrayType; CREATE_NON_PREREQ_DATA(m, DREAM3D, EnsembleData, CrystalStructures, ss, unsigned int, XTalStructArrayType, Ebsd::CrystalStructure::UnknownCrystalStructure, ensembles, 1) CREATE_NON_PREREQ_DATA(m, DREAM3D, EnsembleData, LatticeConstants, ss, float, FloatArrayType, 0.0, ensembles, 6) StringDataArray::Pointer materialNames = StringDataArray::CreateArray(1, DREAM3D::EnsembleData::MaterialName); m->addEnsembleData( DREAM3D::EnsembleData::MaterialName, materialNames); ADD_HELP_INDEX_ENTRY(EnsembleData, MaterialName, XTalStructArrayType, 1); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ConvertData::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) { ss.str(""); ss << "The Input Voxel Cell Array Name is blank (empty) and a value must be filled in for the pipeline to complete."; setErrorCondition(-397); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } if(m_OutputArrayName.empty() == true) { ss.str(""); ss << "The Output Array Name is blank (empty) and a value must be filled in for the pipeline to complete."; setErrorCondition(-398); addErrorMessage(getHumanLabel(), ss.str(), getErrorCondition()); } int numberOfComponents = 0; IDataArray::Pointer iArray = m->getCellData(m_SelectedCellArrayName); if (NULL != iArray) { numberOfComponents = iArray->GetNumberOfComponents(); } if (true == preflight) { IDataArray::Pointer p = IDataArray::NullPointer(); if (m_ScalarType == Detail::Int8) { p = Int8ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::UInt8) { p = UInt8ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::Int16) { p = Int16ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::UInt16) { p = UInt16ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::Int32) { p = Int32ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::UInt32) { p = UInt32ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::Int64) { p = Int64ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::UInt64) { p = UInt64ArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::Float) { p = FloatArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } else if (m_ScalarType == Detail::Double) { p = DoubleArrayType::CreateArray(voxels, numberOfComponents, m_OutputArrayName); } m->addCellData(p->GetName(), p); } }