Skip to content

Commit

Permalink
ENH: Misc user facing labels and help text updates (#845)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson authored Feb 2, 2024
1 parent d1d613b commit 62e6ece
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 16 deletions.
11 changes: 6 additions & 5 deletions docs/Porting_Filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ code such as `vertex[index]` to get/set a value but the code `vertex = i` to mov

## Selecting Geometry from a Parameter

If you need to have the user select a Geometry then you should use a `DataPathSelectionParameter`.
If you need to have the user select a Geometry then you should use a `GeometrySelectionParameter`.

```cpp
params.insert(std::make_unique<DataPathSelectionParameter>(k_TriangleGeometry_Key, "Triangle Geometry to Sample", "", DataPath{}));
params.insert(std::make_unique<GeometrySelectionParameter>(k_GridGeomPath_Key, "Input Image Geometry", "DataPath to input Image Geometry", DataPath{},
GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image}));
```
## Transferring Data from one Geometry to Another
Expand All @@ -152,8 +153,8 @@ of how to perform this transfer of data.
There are several classes that can be used to help the developer write parallel algorithms.
`simplnx/Utilities/ParallelAlgorithm` and `simplnx/Utilties/ParallelTaskAlgorithm` are the two main classes depending
on the situation. `AlignSections.cpp` and `CropImageGeoemtry.cpp` both use a task based
`simplnx/Utilities/ParallelAlgorithm` and `simplnx/Utilities/ParallelTaskAlgorithm` are the two main classes depending
on the situation. `AlignSections.cpp` and `CropImageGeometry.cpp` both use a task based
parallelism. `RotateSampleRefFrameFilter.cpp` shows an example
of using ParallelData3DAlgorithm.
Expand Down Expand Up @@ -257,4 +258,4 @@ these should be used as needed by the filter.

## Processing a Geometry In Place

Sometimes a filter needs allow the user to process it's geometry "in place" in order to ease the number of filters that are needed to remove temporary DataObjecsts. If your filter needs this kind of capability, then take a look at the "CropImageGeometry" or "RotateSampleRefFrame" filters.
Sometimes a filter needs allow the user to process it's geometry "in place" in order to ease the number of filters that are needed to remove temporary DataObjects. If your filter needs this kind of capability, then take a look at the "CropImageGeometry" or "RotateSampleRefFrame" filters.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Parameters EBSDSegmentFeaturesFilter::parameters() const
params.linkParameters(k_UseMask_Key, k_MaskArrayPath_Key, true);

params.insertSeparator(Parameters::Separator{"Required Input Cell Data"});
params.insert(std::make_unique<GeometrySelectionParameter>(k_GridGeomPath_Key, "Grid Geometry", "DataPath to target Grid Geometry", DataPath{},
params.insert(std::make_unique<GeometrySelectionParameter>(k_GridGeomPath_Key, "Input Grid Geometry", "DataPath to input Grid Geometry", DataPath{},
GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image, IGeometry::Type::RectGrid}));
params.insert(std::make_unique<ArraySelectionParameter>(k_QuatsArrayPath_Key, "Quaternions", "Specifies the orientation of the Cell in quaternion representation", DataPath{},
ArraySelectionParameter::AllowedTypes{nx::core::DataType::float32}, ArraySelectionParameter::AllowedComponentShapes{{4}}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

#include "simplnx/Common/Numbers.hpp"
#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/DataStore.hpp"
#include "simplnx/DataStructure/Geometry/ImageGeom.hpp"
#include "simplnx/Filter/Actions/CreateArrayAction.hpp"
#include "simplnx/Parameters/ArraySelectionParameter.hpp"
#include "simplnx/Parameters/AttributeMatrixSelectionParameter.hpp"
#include "simplnx/Parameters/BoolParameter.hpp"
#include "simplnx/Parameters/DataObjectNameParameter.hpp"
#include "simplnx/Parameters/DataPathSelectionParameter.hpp"
#include "simplnx/Parameters/GeometrySelectionParameter.hpp"

#include "simplnx/Utilities/SIMPLConversion.hpp"

Expand Down Expand Up @@ -61,7 +60,9 @@ Parameters CalculateFeatureSizesFilter::parameters() const
"If checked this will generate and store the element sizes ONLY if the geometry does not already contain them.", false));

params.insertSeparator(Parameters::Separator{"Required Input Cell Data"});
params.insert(std::make_unique<DataPathSelectionParameter>(k_GeometryPath_Key, "Target Geometry", "DataPath to target geometry", DataPath{}));
params.insert(std::make_unique<GeometrySelectionParameter>(k_GeometryPath_Key, "Input Image Geometry", "DataPath to input Image Geometry", DataPath{},
GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image}));

params.insert(std::make_unique<ArraySelectionParameter>(k_CellFeatureIdsArrayPath_Key, "Cell Feature Ids", "Specifies to which Feature each Element belongs", DataPath({"FeatureIds"}),
ArraySelectionParameter::AllowedTypes{DataType::int32}, ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<AttributeMatrixSelectionParameter>(k_CellFeatureAttributeMatrixPath_Key, "Feature Attribute Matrix", "Feature Attribute Matrix of the selected Feature Ids",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "simplnx/Parameters/ArraySelectionParameter.hpp"
#include "simplnx/Parameters/BoolParameter.hpp"
#include "simplnx/Parameters/DataObjectNameParameter.hpp"
#include "simplnx/Parameters/DataPathSelectionParameter.hpp"
#include "simplnx/Parameters/GeometrySelectionParameter.hpp"

#include "simplnx/Utilities/SIMPLConversion.hpp"

Expand Down Expand Up @@ -76,7 +76,8 @@ Parameters ScalarSegmentFeaturesFilter::parameters() const
params.linkParameters(k_UseMask_Key, k_MaskArrayPath_Key, std::make_any<bool>(true));

params.insertSeparator(Parameters::Separator{"Required Input Cell Data"});
params.insert(std::make_unique<DataPathSelectionParameter>(k_GridGeomPath_Key, "Grid Geometry", "DataPath to target Grid Geometry", DataPath{}));
params.insert(std::make_unique<GeometrySelectionParameter>(k_GridGeomPath_Key, "Input Image Geometry", "DataPath to input Image Geometry", DataPath{},
GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image}));
params.insert(std::make_unique<ArraySelectionParameter>(k_InputArrayPathKey, "Scalar Array to Segment", "Path to the DataArray to segment", DataPath(), nx::core::GetIntegerDataTypes(),
ArraySelectionParameter::AllowedComponentShapes{{1}}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "simplnx/Parameters/DataGroupCreationParameter.hpp"
#include "simplnx/Parameters/DataObjectNameParameter.hpp"
#include "simplnx/Parameters/DataPathSelectionParameter.hpp"
#include "simplnx/Parameters/GeometrySelectionParameter.hpp"
#include "simplnx/Parameters/MultiArraySelectionParameter.hpp"
#include "simplnx/Parameters/NumberParameter.hpp"

Expand Down Expand Up @@ -67,8 +68,8 @@ Parameters SurfaceNetsFilter::parameters() const
params.insert(std::make_unique<Float32Parameter>(k_RelaxationFactor_Key, "Relaxation Factor", "The factor used to determine how far a node can move in each smoothing iteration", 0.5F));

params.insertSeparator(Parameters::Separator{"Required Cell Data"});
params.insert(
std::make_unique<DataPathSelectionParameter>(k_GridGeometryDataPath_Key, "Grid Geometry", "The complete path to the Grid Geometry from which to create a Triangle Geometry", DataPath{}));
params.insert(std::make_unique<GeometrySelectionParameter>(k_GridGeometryDataPath_Key, "Input Image Geometry", "DataPath to input Image Geometry", DataPath{},
GeometrySelectionParameter::AllowedTypes{IGeometry::Type::Image}));
params.insert(std::make_unique<ArraySelectionParameter>(k_CellFeatureIdsArrayPath_Key, "Feature Ids", "The complete path to the Array specifying which Feature each Cell belongs to", DataPath{},
ArraySelectionParameter::AllowedTypes{DataType::int32}, ArraySelectionParameter::AllowedComponentShapes{{1}}));
params.insert(std::make_unique<MultiArraySelectionParameter>(
Expand Down
13 changes: 10 additions & 3 deletions src/simplnx/Utilities/SegmentFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Result<> SegmentFeatures::execute(IGridGeometry* gridGeom)
neighpoints[5] = (dims[0] * dims[1]);
int64 nextSeed = 0;

auto start = std::chrono::steady_clock::now();

while(seed >= 0)
{
if(m_ShouldCancel)
Expand Down Expand Up @@ -113,13 +115,18 @@ Result<> SegmentFeatures::execute(IGridGeometry* gridGeom)

voxelslist.assign(initialVoxelsListSize, -1);
gnum++;
if(gnum % 100 == 0)

auto now = std::chrono::steady_clock::now();
// Only send updates every 1 second
if(std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count() > 1000)
{
std::string ss = fmt::format("Current Feature Count: {}", gnum);
m_MessageHandler({IFilter::Message::Type::Info, ss});
std::string message = fmt::format("Features Found: {}", gnum);
m_MessageHandler(nx::core::IFilter::ProgressMessage{nx::core::IFilter::Message::Type::Info, message, 0});
start = std::chrono::steady_clock::now();
}
}
}

m_MessageHandler({IFilter::Message::Type::Info, fmt::format("Total Features Found: {}", gnum)});

return {};
Expand Down

0 comments on commit 62e6ece

Please sign in to comment.