Skip to content

Commit

Permalink
BUG: ReadCTFData-Remove phase=0 value adjustment. (#937)
Browse files Browse the repository at this point in the history
There was a long-standing piece of code that added 1 to the phase value if the phase value was zero. This is not needed and can affect results being put out by DREAM3D.

Other changes in this PR were related to bringing consistency to the Parameter::Separator values for the 7 different filters to read EBSD data. Each of the filters should now present a consistent terminology to the user and be laid out the same.

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed May 1, 2024
1 parent 0690e5c commit 9d7c4e4
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/Plugins/OrientationAnalysis/docs/ReadCtfDataFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ Please see the description file distributed with this **Plugin**

## DREAM3D-NX Help

If you need help, need to file a bug report or want to request a new feature, please head over to the [DREAM3DNX-Issues](https://github.com/BlueQuartzSoftware/DREAM3DNX-Issues/discussions) GItHub site where the community of DREAM3D-NX users can help answer your questions.
If you need help, need to file a bug report or want to request a new feature, please head over to the [DREAM3DNX-Issues](https://github.com/BlueQuartzSoftware/DREAM3DNX-Issues/discussions) GItHub site where the community of DREAM3D-NX users can help answer your questions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,12 @@ void ReadCtfData::copyRawEbsdData(CtfReader* reader) const
// Prepare the Cell Attribute Matrix with the correct number of tuples based on the total Cells being read from the file.
std::vector<size_t> tDims = {imageGeom.getNumXCells(), imageGeom.getNumYCells(), imageGeom.getNumZCells()};

// Adjust the values of the 'phase' data to correct for invalid values and assign the read Phase Data into the actual DataArray
// Copy the Phase Array
{
/* Take from H5CtfVolumeReader.cpp
* For HKL OIM Files if there is a single phase then the value of the phase
* data is one (1). If there are 2 or more phases, the lowest value
* of phase is also one (1). However, if there are "zero solutions" in the data
* then those Cells are assigned a phase of zero. Since those Cells can be identified
* by other methods, the phase of these Cells should be changed to one since in the rest
* of the reconstruction code we follow the convention that the lowest value is One (1)
* even if there is only a single phase. The next if statement converts all zeros to ones
* if there is a single phase in the OIM data.
*/
auto& targetArray = m_DataStructure.getDataRefAs<Int32Array>(cellAttributeMatrixPath.createChildPath(EbsdLib::CtfFile::Phases));
int* phasePtr = reinterpret_cast<int32_t*>(reader->getPointerByName(EbsdLib::Ctf::Phase));
for(size_t i = 0; i < totalCells; i++)
{
if(phasePtr[i] < 1)
{
phasePtr[i] = 1;
}
targetArray[i] = phasePtr[i];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,16 @@ Parameters ReadAngDataFilter::parameters() const
params.insertSeparator(Parameters::Separator{"Input Parameters"});
params.insert(std::make_unique<FileSystemPathParameter>(k_InputFile_Key, "Input File", "The input .ang file path", fs::path("input.ang"), FileSystemPathParameter::ExtensionsType{".ang"},
FileSystemPathParameter::PathType::InputFile));
params.insertSeparator(Parameters::Separator{"Created Data Structure Objects"});
params.insert(
std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Created Image Geometry", "The complete path to the Geometry being created.", DataPath({"DataContainer"})));
params.insert(
std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Created Cell Attribute Matrix", "The Attribute Matrix where the scan data is stored.", ImageGeom::k_CellDataName));
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Created Cell Ensemble Attribute Matrix",
"The Attribute Matrix where the phase information is stored.", "CellEnsembleData"));
params.insertSeparator(Parameters::Separator{"Create Image Geometry"});
params.insert(std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Image Geometry", "The path to the created Image Geometry", DataPath({ImageGeom::k_TypeName})));
params.insertSeparator(Parameters::Separator{"Created Cell Data"});

params.insert(std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Cell Attribute Matrix", "The name of the cell data attribute matrix for the created Image Geometry",
ImageGeom::k_CellDataName));
params.insertSeparator(Parameters::Separator{"Created Ensemble Data"});

params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Ensemble Attribute Matrix", "The Attribute Matrix where the phase information is stored.",
"Cell Ensemble Data"));

return params;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ Parameters ReadCtfDataFilter::parameters() const
params.insert(std::make_unique<BoolParameter>(k_EdaxHexagonalAlignment_Key, "Convert Hexagonal X-Axis to EDAX Standard",
"Whether or not to convert a Hexagonal phase to the EDAX standard for x-axis alignment", false));

params.insertSeparator(Parameters::Separator{"Created Data Structure Objects"});
params.insert(
std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Created Image Geometry", "The complete path to the Geometry being created.", DataPath({"DataContainer"})));
params.insert(
std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Created Cell Attribute Matrix", "The Attribute Matrix where the scan data is stored.", ImageGeom::k_CellDataName));
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Created Cell Ensemble Attribute Matrix",
"The Attribute Matrix where the phase information is stored.", "CellEnsembleData"));
params.insertSeparator(Parameters::Separator{"Create Image Geometry"});
params.insert(std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Image Geometry", "The path to the created Image Geometry", DataPath({ImageGeom::k_TypeName})));
params.insertSeparator(Parameters::Separator{"Created Cell Data"});

params.insert(std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Cell Attribute Matrix", "The name of the cell data attribute matrix for the created Image Geometry",
ImageGeom::k_CellDataName));
params.insertSeparator(Parameters::Separator{"Created Ensemble Data"});

params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Ensemble Attribute Matrix", "The Attribute Matrix where the phase information is stored.",
"Cell Ensemble Data"));

return params;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "OrientationAnalysis/Parameters/ReadH5EbsdFileParameter.h"

#include "simplnx/DataStructure/DataPath.hpp"
#include "simplnx/DataStructure/Geometry/ImageGeom.hpp"
#include "simplnx/Filter/Actions/CreateArrayAction.hpp"
#include "simplnx/Filter/Actions/CreateAttributeMatrixAction.hpp"
#include "simplnx/Filter/Actions/CreateImageGeometryAction.hpp"
Expand Down Expand Up @@ -62,15 +63,14 @@ Parameters ReadH5EbsdFilter::parameters() const
params.insert(std::make_unique<ReadH5EbsdFileParameter>(k_ReadH5EbsdParameter_Key, "Import H5Ebsd File", "Object that holds all relevant information to import data from the file.",
ReadH5EbsdFileParameter::ValueType{}));

params.insertSeparator(Parameters::Separator{"Created Data Structure Objects"});
params.insert(
std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Created Image Geometry", "The complete path to the imported Image Geometry", DataPath({"DataContainer"})));
// params.insertSeparator(Parameters::Separator{"Cell Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Created Cell Attribute Matrix",
"The name of the created cell attribute matrix associated with the imported geometry", "CellData"));
// params.insertSeparator(Parameters::Separator{"Cell Ensemble Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Created Cell Ensemble Attribute Matrix",
"The name of the created cell ensemble attribute matrix associated with the imported geometry", "CellEnsembleData"));
params.insertSeparator(Parameters::Separator{"Create Image Geometry"});
params.insert(std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Image Geometry", "The complete path to the imported Image Geometry", DataPath({"DataContainer"})));
params.insertSeparator(Parameters::Separator{"Created Cell Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Cell Attribute Matrix", "The name of the created cell attribute matrix associated with the imported geometry",
ImageGeom::k_CellDataName));
params.insertSeparator(Parameters::Separator{"Created Ensemble Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Ensemble Attribute Matrix", "The Attribute Matrix where the phase information is stored.",
"Cell Ensemble Data"));

return params;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,22 @@ Parameters ReadH5EspritDataFilter::parameters() const
Parameters params;
// Create the parameter descriptors that are needed for this filter
params.insertSeparator(Parameters::Separator{"Input Parameters"});
params.insert(std::make_unique<OEMEbsdScanSelectionParameter>(k_SelectedScanNames_Key, "Scan Names", "The name of the scan in the .h5 file. Esprit can store multiple scans in a single file",
params.insert(std::make_unique<OEMEbsdScanSelectionParameter>(k_SelectedScanNames_Key, "Scan Names", "The name of the scan(s) in the .h5 file. Esprit can store multiple scans in a single file",
OEMEbsdScanSelectionParameter::ValueType{},
/* OEMEbsdScanSelectionParameter::AllowedManufacturers{EbsdLib::OEM::Bruker, EbsdLib::OEM::DREAM3D},*/
OEMEbsdScanSelectionParameter::EbsdReaderType::Esprit, OEMEbsdScanSelectionParameter::ExtensionsType{".h5", ".hdf5"}));
params.insert(std::make_unique<Float32Parameter>(k_ZSpacing_Key, "Z Spacing (Microns)", "The spacing in microns between each layer.", 1.0f));
params.insert(std::make_unique<VectorFloat32Parameter>(k_Origin_Key, "Origin", "The origin of the volume", std::vector<float32>{0.0F, 0.0F, 0.0F}, std::vector<std::string>{"x", "y", "z"}));
params.insert(std::make_unique<BoolParameter>(k_DegreesToRadians_Key, "Convert Euler Angles to Radians", "Whether or not to convert the euler angles to radians", true));
params.insert(std::make_unique<BoolParameter>(k_ReadPatternData_Key, "Import Pattern Data", "Whether or not to import the pattern data", false));
params.insert(std::make_unique<DataGroupCreationParameter>(k_ImageGeometryName_Key, "Image Geometry", "The path to the created Image Geometry", DataPath({ImageGeom::k_TypeName})));
params.insertSeparator(Parameters::Separator{"Cell Data"});
params.insertSeparator(Parameters::Separator{"Create Image Geometry"});
params.insert(std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Image Geometry", "The path to the created Image Geometry", DataPath({ImageGeom::k_TypeName})));
params.insertSeparator(Parameters::Separator{"Created Cell Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Cell Attribute Matrix", "The name of the cell data attribute matrix for the created Image Geometry",
ImageGeom::k_CellDataName));
params.insertSeparator(Parameters::Separator{"Cell Ensemble Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Cell Ensemble Attribute Matrix",
"The name of the cell ensemble data attribute matrix for the created Image Geometry", "Cell Ensemble Data"));
params.insertSeparator(Parameters::Separator{"Created Ensemble Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Ensemble Attribute Matrix", "The Attribute Matrix where the phase information is stored.",
"Cell Ensemble Data"));

return params;
}
Expand All @@ -100,7 +101,7 @@ IFilter::PreflightResult ReadH5EspritDataFilter::preflightImpl(const DataStructu
auto pOriginValue = filterArgs.value<VectorFloat32Parameter::ValueType>(k_Origin_Key);
auto pDegreesToRadiansValue = filterArgs.value<bool>(k_DegreesToRadians_Key);
auto pReadPatternDataValue = filterArgs.value<bool>(k_ReadPatternData_Key);
auto pImageGeometryNameValue = filterArgs.value<DataPath>(k_ImageGeometryName_Key);
auto pImageGeometryNameValue = filterArgs.value<DataPath>(k_CreatedImageGeometryPath_Key);
auto pCellAttributeMatrixNameValue = filterArgs.value<std::string>(k_CellAttributeMatrixName_Key);
auto pCellEnsembleAttributeMatrixNameValue = filterArgs.value<std::string>(k_CellEnsembleAttributeMatrixName_Key);

Expand Down Expand Up @@ -213,7 +214,7 @@ Result<> ReadH5EspritDataFilter::executeImpl(DataStructure& dataStructure, const

inputValues.SelectedScanNames = filterArgs.value<OEMEbsdScanSelectionParameter::ValueType>(k_SelectedScanNames_Key);
inputValues.ReadPatternData = filterArgs.value<bool>(k_ReadPatternData_Key);
inputValues.ImageGeometryPath = filterArgs.value<DataPath>(k_ImageGeometryName_Key);
inputValues.ImageGeometryPath = filterArgs.value<DataPath>(k_CreatedImageGeometryPath_Key);
inputValues.CellEnsembleAttributeMatrixPath = inputValues.ImageGeometryPath.createChildPath(filterArgs.value<std::string>(k_CellEnsembleAttributeMatrixName_Key));
inputValues.CellAttributeMatrixPath = inputValues.ImageGeometryPath.createChildPath(filterArgs.value<std::string>(k_CellAttributeMatrixName_Key));
espritInputValues.DegreesToRadians = filterArgs.value<bool>(k_DegreesToRadians_Key);
Expand Down Expand Up @@ -251,7 +252,7 @@ Result<Arguments> ReadH5EspritDataFilter::FromSIMPLJson(const nlohmann::json& js
// results.push_back(SIMPLConversion::ConvertParameter<SIMPLConversion::BooleanFilterParameterConverter>(args, json, SIMPL::k_CombineEulerAnglesKey, ));
results.push_back(SIMPLConversion::ConvertParameter<SIMPLConversion::BooleanFilterParameterConverter>(args, json, SIMPL::k_DegreesToRadiansKey, k_DegreesToRadians_Key));
results.push_back(SIMPLConversion::ConvertParameter<SIMPLConversion::BooleanFilterParameterConverter>(args, json, SIMPL::k_ReadPatternDataKey, k_ReadPatternData_Key));
results.push_back(SIMPLConversion::ConvertParameter<SIMPLConversion::DataContainerCreationFilterParameterConverter>(args, json, SIMPL::k_DataContainerNameKey, k_ImageGeometryName_Key));
results.push_back(SIMPLConversion::ConvertParameter<SIMPLConversion::DataContainerCreationFilterParameterConverter>(args, json, SIMPL::k_DataContainerNameKey, k_CreatedImageGeometryPath_Key));
results.push_back(SIMPLConversion::ConvertParameter<SIMPLConversion::LinkedPathCreationFilterParameterConverter>(args, json, SIMPL::k_CellAttributeMatrixNameKey, k_CellAttributeMatrixName_Key));
results.push_back(
SIMPLConversion::ConvertParameter<SIMPLConversion::LinkedPathCreationFilterParameterConverter>(args, json, SIMPL::k_CellEnsembleAttributeMatrixNameKey, k_CellEnsembleAttributeMatrixName_Key));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ORIENTATIONANALYSIS_EXPORT ReadH5EspritDataFilter : public IFilter
static inline constexpr StringLiteral k_Origin_Key = "origin";
static inline constexpr StringLiteral k_DegreesToRadians_Key = "degrees_to_radians";
static inline constexpr StringLiteral k_ReadPatternData_Key = "read_pattern_data";
static inline constexpr StringLiteral k_ImageGeometryName_Key = "output_image_geometry_path";
static inline constexpr StringLiteral k_CreatedImageGeometryPath_Key = "output_image_geometry_path";
static inline constexpr StringLiteral k_CellAttributeMatrixName_Key = "cell_attribute_matrix_name";
static inline constexpr StringLiteral k_CellEnsembleAttributeMatrixName_Key = "cell_ensemble_attribute_matrix_name";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ Parameters ReadH5OimDataFilter::parameters() const
params.insert(std::make_unique<Float32Parameter>(k_ZSpacing_Key, "Z Spacing (Microns)", "The spacing in microns between each layer.", 1.0f));
params.insert(std::make_unique<VectorFloat32Parameter>(k_Origin_Key, "Origin", "The origin of the volume", std::vector<float32>{0.0F, 0.0F, 0.0F}, std::vector<std::string>{"x", "y", "z"}));
params.insert(std::make_unique<BoolParameter>(k_ReadPatternData_Key, "Import Pattern Data", "Whether or not to import the pattern data", false));
params.insertSeparator(Parameters::Separator{"Create Image Geometry"});
params.insert(std::make_unique<DataGroupCreationParameter>(k_CreatedImageGeometryPath_Key, "Image Geometry", "The path to the created Image Geometry", DataPath({ImageGeom::k_TypeName})));
params.insertSeparator(Parameters::Separator{"Cell Data"});
params.insertSeparator(Parameters::Separator{"Created Cell Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellAttributeMatrixName_Key, "Cell Attribute Matrix", "The name of the cell data attribute matrix for the created Image Geometry",
ImageGeom::k_CellDataName));
params.insertSeparator(Parameters::Separator{"Cell Ensemble Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Cell Ensemble Attribute Matrix",
"The name of the cell ensemble data attribute matrix for the created Image Geometry", "Cell Ensemble Data"));
params.insertSeparator(Parameters::Separator{"Created Ensemble Data"});
params.insert(std::make_unique<DataObjectNameParameter>(k_CellEnsembleAttributeMatrixName_Key, "Ensemble Attribute Matrix", "The Attribute Matrix where the phase information is stored.",
"Cell Ensemble Data"));

return params;
}
Expand Down
Loading

0 comments on commit 9d7c4e4

Please sign in to comment.