Skip to content

Commit

Permalink
ENH: Use "Mask" instead of "GoodVoxels" consistently for human facing…
Browse files Browse the repository at this point in the history
… strings. (#755)

* RawBinaryReader: Allow user to read part of a file
* Mask: Consistently use "Mask" instead of "GoodVoxels"

Source and pipelines should be updated.

Signed-off-by: Michael Jackson <[email protected]>

---------

Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Oct 27, 2023
1 parent c4e5572 commit 816d375
Show file tree
Hide file tree
Showing 91 changed files with 323 additions and 331 deletions.
8 changes: 4 additions & 4 deletions pipelines/Combo-EBSD-osc_r0c0.d3dpipeline
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@
"cell_ipf_colors_array_name": "IPFColors",
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"reference_dir": [
0.0,
0.0,
1.0
],
"use_good_voxels": true
"use_mask": true
},
"comments": "",
"filter": {
Expand Down Expand Up @@ -164,12 +164,12 @@
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"feature_ids_array_name": "FeatureIds",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"image_geometry_path": "DataContainer",
"misorientation_tolerance": 5.0,
"quats_array_path": "DataContainer/CellData/Quats",
"randomize_feature_ids": true,
"use_good_voxels": true
"use_mask": true
},
"comments": "",
"filter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"feature_ids_array_name": "FeatureIds",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"grid_geometry_path": "DataContainer",
"misorientation_tolerance": 5.0,
"quats_array_path": "DataContainer/CellData/Quats",
"randomize_features": true,
"use_good_voxels": true
"use_mask": true
},
"comments": "",
"filter": {
Expand Down
4 changes: 2 additions & 2 deletions src/Plugins/ComplexCore/pipelines/Import_ASCII.d3dpipeline
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@
"cell_ipf_colors_array_name": "IPFColors",
"cell_phases_array_path": "[Image Geometry]/CellData/Phase",
"crystal_structures_array_path": "[Image Geometry]/CellEnsembleData/CrystalStructures",
"good_voxels_array_path": "",
"mask_array_path": "",
"reference_dir": [
0.0,
0.0,
1.0
],
"use_good_voxels": false
"use_mask": false
},
"comments": "",
"filter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@
"cell_ipf_colors_array_name": "IPFColors",
"cell_phases_array_path": "DataContainer/Cell Data/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"good_voxels_array_path": "DataContainer/Cell Data/Mask",
"mask_array_path": "DataContainer/Cell Data/Mask",
"reference_dir": [
0.0,
0.0,
1.0
],
"use_good_voxels": true
"use_mask": true
},
"comments": "",
"filter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@
"alignment_shift_file_name": "Data/Output/Alignment_By_Misorientation_Shifts.txt",
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"misorientation_tolerance": 5.0,
"quats_array_path": "DataContainer/CellData/Quats",
"selected_image_geometry_path": "DataContainer",
"use_good_voxels": true,
"use_mask": true,
"write_alignment_shifts": false
},
"comments": "",
Expand All @@ -145,7 +145,7 @@
{
"args": {
"fill_holes": false,
"good_voxels": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"image_geometry": "DataContainer"
},
"comments": "",
Expand All @@ -158,7 +158,7 @@
{
"args": {
"alignment_shift_file_name": "Data/Output/Alignment_By_Feature_Centroid_Shifts.txt",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"reference_slice": 0,
"selected_cell_data_path": "DataContainer/CellData",
"selected_image_geometry_path": "DataContainer",
Expand All @@ -176,7 +176,7 @@
"args": {
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"image_geometry_path": "DataContainer",
"misorientation_tolerance": 5.0,
"number_of_neighbors": 4,
Expand Down Expand Up @@ -215,12 +215,12 @@
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"feature_ids_array_name": "FeatureIds",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"grid_geometry_path": "DataContainer",
"misorientation_tolerance": 5.0,
"quats_array_path": "DataContainer/CellData/Quats",
"randomize_features": true,
"use_good_voxels": true
"use_mask": true
},
"comments": "",
"filter": {
Expand Down Expand Up @@ -434,13 +434,13 @@
"cell_ipf_colors_array_name": "IPFColors",
"cell_phases_array_path": "DataContainer/CellData/Phases",
"crystal_structures_array_path": "DataContainer/CellEnsembleData/CrystalStructures",
"good_voxels_array_path": "DataContainer/CellData/Mask",
"mask_array_path": "DataContainer/CellData/Mask",
"reference_dir": [
0.0,
0.0,
1.0
],
"use_good_voxels": true
"use_mask": true
},
"comments": "",
"filter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ Result<> AlignSectionsFeatureCentroid::findShifts(std::vector<int64_t>& xShifts,
std::unique_ptr<MaskCompare> maskCompare;
try
{
maskCompare = InstantiateMaskCompare(m_DataStructure, m_InputValues->GoodVoxelsArrayPath);
maskCompare = InstantiateMaskCompare(m_DataStructure, m_InputValues->MaskArrayPath);
} catch(const std::out_of_range& exception)
{
// This really should NOT be happening as the path was verified during preflight BUT we may be calling this from
// somewhere else that is NOT going through the normal complex::IFilter API of Preflight and Execute
std::string message = fmt::format("Mask Array DataPath does not exist or is not of the correct type (Bool | UInt8) {}", m_InputValues->GoodVoxelsArrayPath.toString());
std::string message = fmt::format("Mask Array DataPath does not exist or is not of the correct type (Bool | UInt8) {}", m_InputValues->MaskArrayPath.toString());
return MakeErrorResult(-53900, message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct COMPLEXCORE_EXPORT AlignSectionsFeatureCentroidInputValues
FileSystemPathParameter::ValueType AlignmentShiftFileName;
bool UseReferenceSlice;
int32 ReferenceSlice;
DataPath GoodVoxelsArrayPath;
DataPath MaskArrayPath;
DataPath inputImageGeometry;
DataPath cellDataGroupPath;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct COMPLEXCORE_EXPORT FindArrayStatisticsInputValues
bool FindStdDeviation;
bool FindSummation;
bool UseMask;
;
bool ComputeByIndex;
bool StandardizeData;
bool FindNumUniqueValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ struct GenerateColorArrayFunctor
auto& colorArray = dataStructure.getDataRefAs<UInt8Array>(rgbArrayPath);

complex::IDataArray* goodVoxelsArray = nullptr;
if(inputValues->UseGoodVoxels)
if(inputValues->UseMask)
{
goodVoxelsArray = dataStructure.getDataAs<IDataArray>(inputValues->GoodVoxelsArrayPath);
goodVoxelsArray = dataStructure.getDataAs<IDataArray>(inputValues->MaskArrayPath);
}

ParallelDataAlgorithm dataAlg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ struct COMPLEXCORE_EXPORT GenerateColorTableInputValues
nlohmann::json SelectedPreset;
DataPath SelectedDataArrayPath;
DataPath RgbArrayPath;
bool UseGoodVoxels;
DataPath GoodVoxelsArrayPath;
bool UseMask;
DataPath MaskArrayPath;
std::vector<uint8> InvalidColor;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ Result<> GenerateVectorColors::operator()()
std::unique_ptr<MaskCompare> maskCompare;
try
{
maskCompare = InstantiateMaskCompare(m_DataStructure, m_InputValues->GoodVoxelsArrayPath);
maskCompare = InstantiateMaskCompare(m_DataStructure, m_InputValues->MaskArrayPath);
} catch(const std::out_of_range& exception)
{
// This really should NOT be happening as the path was verified during preflight BUT we may be calling this from
// somewhere else that is NOT going through the normal complex::IFilter API of Preflight and Execute
return MakeErrorResult(-54700, fmt::format("Mask Array DataPath does not exist or is not of the correct type (Bool | UInt8) {}", m_InputValues->GoodVoxelsArrayPath.toString()));
return MakeErrorResult(-54700, fmt::format("Mask Array DataPath does not exist or is not of the correct type (Bool | UInt8) {}", m_InputValues->MaskArrayPath.toString()));
}

auto& vectors = m_DataStructure.getDataRefAs<Float32Array>(m_InputValues->VectorsArrayPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ namespace complex

struct COMPLEXCORE_EXPORT GenerateVectorColorsInputValues
{
bool UseGoodVoxels;
bool UseMask;
DataPath VectorsArrayPath;
DataPath GoodVoxelsArrayPath;
DataPath MaskArrayPath;
DataPath CellVectorColorsArrayPath;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ Result<> ReadBinaryFile(IDataArray& dataArrayPtr, const std::string& filename, u
{
return MakeErrorResult(k_RbrFileTooSmall, "The file size is smaller than the allocated size");
}
if(err > 0)
{
return MakeWarningVoidResult(k_RbrFileTooBig, "The file size is larger than the allocated size");
}

Result<> result = ImportFromBinaryFile(fs::path(filename), dataArray, skipHeaderBytes, k_DefaultBlocksize);
if(result.invalid())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Parameters AlignSectionsFeatureCentroidFilter::parameters() const
params.insert(std::make_unique<GeometrySelectionParameter>(k_SelectedImageGeometry_Key, "Selected Image Geometry", "The target geometry on which to perform the alignment",
DataPath({"Data Container"}), GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image}));
params.insert(std::make_unique<AttributeMatrixSelectionParameter>(k_SelectedCellDataGroup_Key, "Cell Data Attribute Matrix", "Cell Data Attribute Matrix", DataPath{}));
params.insert(std::make_unique<ArraySelectionParameter>(k_GoodVoxelsArrayPath_Key, "Mask", "Path to the DataArray Mask", DataPath({"Mask"}),
params.insert(std::make_unique<ArraySelectionParameter>(k_MaskArrayPath_Key, "Mask Array", "Path to the DataArray Mask", DataPath({"Mask"}),
ArraySelectionParameter::AllowedTypes{DataType::boolean, DataType::uint8}, ArraySelectionParameter::AllowedComponentShapes{{1}}));

params.insertSeparator(Parameters::Separator{"Optional File Output"});
Expand All @@ -101,7 +101,7 @@ IFilter::PreflightResult AlignSectionsFeatureCentroidFilter::preflightImpl(const
auto pWriteAlignmentShifts = filterArgs.value<bool>(k_WriteAlignmentShifts_Key);
auto pAlignmentShiftFileName = filterArgs.value<FileSystemPathParameter::ValueType>(k_AlignmentShiftFileName_Key);
auto pReferenceSliceValue = filterArgs.value<int32>(k_ReferenceSlice_Key);
auto pGoodVoxelsArrayPath = filterArgs.value<DataPath>(k_GoodVoxelsArrayPath_Key);
auto pGoodVoxelsArrayPath = filterArgs.value<DataPath>(k_MaskArrayPath_Key);
auto inputImageGeometry = filterArgs.value<DataPath>(k_SelectedImageGeometry_Key);
auto cellDataGroupPath = filterArgs.value<DataPath>(k_SelectedCellDataGroup_Key);

Expand Down Expand Up @@ -151,7 +151,7 @@ Result<> AlignSectionsFeatureCentroidFilter::executeImpl(DataStructure& dataStru
inputValues.AlignmentShiftFileName = filterArgs.value<FileSystemPathParameter::ValueType>(k_AlignmentShiftFileName_Key);
inputValues.UseReferenceSlice = filterArgs.value<bool>(k_UseReferenceSlice_Key);
inputValues.ReferenceSlice = filterArgs.value<int32>(k_ReferenceSlice_Key);
inputValues.GoodVoxelsArrayPath = filterArgs.value<DataPath>(k_GoodVoxelsArrayPath_Key);
inputValues.MaskArrayPath = filterArgs.value<DataPath>(k_MaskArrayPath_Key);
inputValues.inputImageGeometry = filterArgs.value<DataPath>(k_SelectedImageGeometry_Key);
inputValues.cellDataGroupPath = filterArgs.value<DataPath>(k_SelectedCellDataGroup_Key);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class COMPLEXCORE_EXPORT AlignSectionsFeatureCentroidFilter : public IFilter
static inline constexpr StringLiteral k_AlignmentShiftFileName_Key = "alignment_shift_file_name";
static inline constexpr StringLiteral k_UseReferenceSlice_Key = "use_reference_slice";
static inline constexpr StringLiteral k_ReferenceSlice_Key = "reference_slice";
static inline constexpr StringLiteral k_GoodVoxelsArrayPath_Key = "good_voxels_array_path";
static inline constexpr StringLiteral k_MaskArrayPath_Key = "mask_array_path";
static inline constexpr StringLiteral k_SelectedImageGeometry_Key = "selected_image_geometry_path";
static inline constexpr StringLiteral k_SelectedCellDataGroup_Key = "selected_cell_data_path";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Parameters ExtractVertexGeometryFilter::parameters() const
params.insert(
std::make_unique<ChoicesParameter>(k_ArrayHandling_Key, "Array Handling", "Move or Copy input data arrays", 0, ChoicesParameter::Choices{"Move Attribute Arrays", "Copy Attribute Arrays"}));
params.insertLinkableParameter(std::make_unique<BoolParameter>(k_UseMask_Key, "Use Mask", "Specifies whether or not to use a mask array", false));
params.insert(std::make_unique<ArraySelectionParameter>(k_MaskArrayPath_Key, "Mask", "DataPath to the boolean mask array. Values that are true will mark that cell/point as usable.", DataPath{},
ArraySelectionParameter::AllowedTypes{DataType::boolean}, ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<ArraySelectionParameter>(k_MaskArrayPath_Key, "Mask Array", "DataPath to the boolean mask array. Values that are true will mark that cell/point as usable.",
DataPath{}, ArraySelectionParameter::AllowedTypes{DataType::boolean}, ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<DataGroupSelectionParameter>(k_InputGeometryPath_Key, "Input Geometry", "The input Image/RectilinearGrid Geometry to convert", DataPath{},
DataGroupSelectionParameter::AllowedTypes{BaseGroup::GroupType::ImageGeom, BaseGroup::GroupType::RectGridGeom}));
params.insert(std::make_unique<MultiArraySelectionParameter>(k_IncludedDataArrayPaths_Key, "Included Attribute Arrays", "The arrays to copy/move to the vertex array",
Expand Down Expand Up @@ -104,12 +104,12 @@ IFilter::PreflightResult ExtractVertexGeometryFilter::preflightImpl(const DataSt
usize geomElementCount = dims[0] * dims[1] * dims[2];
if(pUseMaskValue)
{
const BoolArray& maskArray = dataStructure.getDataRefAs<BoolArray>(pMaskArrayPathValue);
if(maskArray.getNumberOfTuples() != geomElementCount)
const BoolArray* maskArray = dataStructure.getDataAs<BoolArray>(pMaskArrayPathValue);
if(maskArray->getNumberOfTuples() != geomElementCount)
{
return {MakeErrorResult<OutputActions>(-2003, fmt::format("{0}: The data array with path '{1}' has a tuple count of {2}, but this does not match the "
"number of tuples required by geometry '{3}' ({4})",
humanName(), pMaskArrayPathValue.toString(), maskArray.getNumberOfTuples(), geometry.getName(), geomElementCount))};
humanName(), pMaskArrayPathValue.toString(), maskArray->getNumberOfTuples(), geometry.getName(), geomElementCount))};
}
}

Expand All @@ -119,7 +119,7 @@ IFilter::PreflightResult ExtractVertexGeometryFilter::preflightImpl(const DataSt
DataPath parentPath = dataPath.getParent();
if(parentPath.empty())
{
return {MakeErrorResult<OutputActions>(-2004, fmt::format("{}: The data array with path '{}' has no parent. It must have an AttributeMatrix as a parent.", humanName(), dataPath.toString()))};
return {MakeErrorResult<OutputActions>(-2004, fmt::format("{}: The data array with path '{}' has no parent. It must have an AttributeMatrix as a parent.", humanName(), dataPath.toString()))};
}
if(dataStructure.getDataAs<AttributeMatrix>(parentPath) == nullptr)
{
Expand Down Expand Up @@ -168,14 +168,8 @@ IFilter::PreflightResult ExtractVertexGeometryFilter::preflightImpl(const DataSt
}
}

PreflightResult preflightResult;

std::vector<PreflightValue> preflightUpdatedValues;

// Store the preflight updated value(s) into the preflightUpdatedValues vector using
// the appropriate methods.
// None found based on the filter parameters

// Return both the resultOutputActions and the preflightUpdatedValues via std::move()
return {std::move(resultOutputActions), std::move(preflightUpdatedValues)};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ Parameters FindArrayStatisticsFilter::parameters() const

params.insertSeparator(Parameters::Separator{"Optional Data Mask"});
params.insertLinkableParameter(std::make_unique<BoolParameter>(k_UseMask_Key, "Use Mask", "Specifies whether or not to use a mask array", false));
params.insert(std::make_unique<ArraySelectionParameter>(k_MaskArrayPath_Key, "Mask", "DataPath to the boolean mask array. Values that are true will mark that cell/point as usable.", DataPath{},
ArraySelectionParameter::AllowedTypes{DataType::boolean, DataType::uint8}, ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<ArraySelectionParameter>(k_MaskArrayPath_Key, "Mask Array", "DataPath to the boolean mask array. Values that are true will mark that cell/point as usable.",
DataPath{}, ArraySelectionParameter::AllowedTypes{DataType::boolean, DataType::uint8}, ArraySelectionParameter::AllowedComponentShapes{{1}}));

params.insertSeparator(Parameters::Separator{"Algorithm Options"});
params.insertLinkableParameter(
Expand Down
Loading

0 comments on commit 816d375

Please sign in to comment.