Skip to content
24 changes: 17 additions & 7 deletions docs/MergeColoniesFilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,33 @@ Reconstruction (Grouping)

## Description ##

This **Filter** groups neighboring **Features** that have a *special* misorientation that is associated with *alpha* variants that transformed from the same *beta* grain in titanium. The algorithm for grouping the **Features** is analogous to the algorithm for segmenting the **Features**, except the average orientation of the **Features** are used instead of the orientations of the individual **Elements** and the criterion for grouping is specific to the *alpha-beta transformation*. The user can specify a tolerance on both the *axis* and the *angle* that defines the misorientation relationship (i.e., a tolerance of 1 degree for both tolerances would allow the neighboring **Features** to be grouped if their misorientation was between 59-61 degrees about an axis within 1 degree of a2, as given by the 3rd *special* misorientation below).
This **Filter** groups neighboring **Features** that have a *special* misorientation that is associated with
*alpha* variants that transformed from the same *beta* grain in titanium. The algorithm for grouping the
**Features** is analogous to the algorithm for segmenting the **Features**, except the average orientation
of the **Features** are used instead of the orientations of the individual **Elements** and the criterion
for grouping is specific to the *alpha-beta transformation*. The user can specify a tolerance on both the
*axis* and the *angle* that defines the misorientation relationship (i.e., a tolerance of 1 degree for both
tolerances would allow the neighboring **Features** to be grouped if their misorientation was between 59-61
degrees about an axis within 1 degree of a2, as given by the 3rd *special* misorientation below).

The list of *special* misorientations can be found in the paper by Germain et al.<sup>1</sup> and are listed here:

| Angle | Axis |
|------|------|
| 0 | Identity |
| 10.529 | c = <0001> |
| 60 | a2 = <-12-10> |
| Angle | Axis |
|--------|---------------------------------------------------|
| 0 | Identity |
| 10.529 | c = <0001> |
| 60 | a2 = <-12-10> |
| 60.832 | d1 at 80.97 degrees from c in the plane of (d3,c) |
| 63.262 | d2 at 72.73 degrees from c in the plane of (a2,c) |
| 90 | d3 at 5.26 degrees from a2 in the basal plane |
| 90 | d3 at 5.26 degrees from a2 in the basal plane |

% Auto generated parameter table will be inserted here

## References

[1] L. Germain, N. Gey and M. Humbert, Reliability of reconstructed Beta orientation maps in titanium alloys, Ultramicrscopy, 2007, 1129-1135.


## Example Pipelines

## License & Copyright
Expand Down
24 changes: 4 additions & 20 deletions src/SimplnxReview/Filters/Algorithms/ComputeGroupingDensity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/NeighborList.hpp"
#include "simplnx/Utilities/MessageHelper.hpp"

using namespace nx::core;

Expand Down Expand Up @@ -66,30 +67,13 @@ class FindDensityGrouping
// Default value-initialized to zeroes: https://en.cppreference.com/w/cpp/named_req/DefaultInsertable
checkedFeatureVolumes.resize(numFeatures);
}
int32_t progInt = 0;
usize prevParentId = 1;
usize currentParentId = 1;
auto start = std::chrono::steady_clock::now();
MessageHelper messageHelper(m_MessageHandler);
ThrottledMessenger throttledMessenger = messageHelper.createThrottledMessenger();

for(usize parentIdx = 1; parentIdx < numParents; parentIdx++)
{
progInt = static_cast<float>(parentIdx) / static_cast<float>(numParents) * 100.0f;
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)
{
currentParentId = parentIdx;
auto totalParentIds = currentParentId - prevParentId;
auto rate = static_cast<float>(totalParentIds) / static_cast<float>(std::chrono::duration_cast<std::chrono::seconds>(now - start).count());

auto remainingParents = numParents - parentIdx;
auto minutesRemain = (remainingParents / rate) / 60; // Convert to minutes
throttledMessenger.sendThrottledMessage([&]() { return fmt::format("[{}%]", CalculatePercentComplete(parentIdx, numParents)); });

std::string message = fmt::format("{}/{} [{}%] at {} parents/sec. Time Remain: {:.2f} Minutes", parentIdx, numParents, progInt, rate, minutesRemain);
m_MessageHandler(nx::core::IFilter::ProgressMessage{nx::core::IFilter::Message::Type::Info, message, progInt});
start = std::chrono::steady_clock::now();
prevParentId = currentParentId;
}
if(m_ShouldCancel)
{
return {};
Expand Down
Loading
Loading