Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] FILTER: Merge Colonies #620

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,20 @@
return MakeErrorResult(-84500, fmt::format("Keeping the original geometry is not supported."));
}

auto* imageGeometryPtr = m_DataStructure.getDataAs<ImageGeom>(m_InputValues->SelectedGeometryPath);
const bool isNodeBased = (imageGeometryPtr == nullptr);

ImageRotationUtilities::Matrix4fR translationToGlobalOriginMat = ImageRotationUtilities::Matrix4fR::Identity();
ImageRotationUtilities::Matrix4fR translationFromGlobalOriginMat = ImageRotationUtilities::Matrix4fR::Identity();
if(isNodeBased)
{
auto& nodeGeometry0D = m_DataStructure.getDataRefAs<INodeGeometry0D>(m_InputValues->SelectedGeometryPath);
auto boundingBox = nodeGeometry0D.getBoundingBox();
Point3Df minPoint = boundingBox.getMinPoint();
translationToGlobalOriginMat = ImageRotationUtilities::GenerateTranslationTransformationMatrix({-minPoint[0], -minPoint[1], -minPoint[2]});
translationFromGlobalOriginMat = ImageRotationUtilities::GenerateTranslationTransformationMatrix({minPoint[0], minPoint[1], minPoint[2]});
}

switch(m_InputValues->TransformationSelection)
{
case k_NoTransformIdx: // No-Op
Expand All @@ -168,6 +182,12 @@
case k_RotationIdx: // Rotation via axis-angle
{
m_TransformationMatrix = ImageRotationUtilities::GenerateRotationTransformationMatrix(m_InputValues->Rotation);
if(isNodeBased)
{
// Translate the geometry to/from the global origin
m_TransformationMatrix = translationFromGlobalOriginMat * m_TransformationMatrix * translationToGlobalOriginMat;
}

break;
}
case k_TranslationIdx: // Translation
Expand All @@ -178,12 +198,17 @@
case k_ScaleIdx: // Scale
{
m_TransformationMatrix = ImageRotationUtilities::GenerateScaleTransformationMatrix(m_InputValues->Scale);
if(isNodeBased)
{
// Translate the geometry to/from the global origin
m_TransformationMatrix = translationFromGlobalOriginMat * m_TransformationMatrix * translationToGlobalOriginMat;
}
break;
}
}

// Apply geometry transformation
auto* imageGeometryPtr = m_DataStructure.getDataAs<ImageGeom>(m_InputValues->SelectedGeometryPath);

Check failure on line 211 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (macos-11)

redefinition of 'imageGeometryPtr'

Check failure on line 211 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, g++-9)

conflicting declaration ‘auto* imageGeometryPtr’

Check failure on line 211 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

'imageGeometryPtr': redefinition; different basic types [D:\a\complex\complex\build\Plugins\ComplexCore\ComplexCore.vcxproj]

Check failure on line 211 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, g++-10)

conflicting declaration ‘auto* imageGeometryPtr’

Check failure on line 211 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

'imageGeometryPtr': redefinition; different basic types [D:\a\complex\complex\build\Plugins\ComplexCore\ComplexCore.vcxproj]

Check failure on line 211 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, clang++-10)

redefinition of 'imageGeometryPtr'
if(imageGeometryPtr == nullptr)
{
if(m_InputValues->TranslateGeometryToGlobalOrigin)
Expand All @@ -191,8 +216,8 @@
auto& nodeGeometry0D = m_DataStructure.getDataRefAs<INodeGeometry0D>(m_InputValues->SelectedGeometryPath);
auto boundingBox = nodeGeometry0D.getBoundingBox();
Point3Df minPoint = boundingBox.getMinPoint();
const ImageRotationUtilities::Matrix4fR translationToGlobalOriginMat = ImageRotationUtilities::GenerateTranslationTransformationMatrix({-minPoint[0], -minPoint[1], -minPoint[2]});

Check failure on line 219 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (macos-11)

declaration shadows a local variable [-Werror,-Wshadow]

Check failure on line 219 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, g++-9)

declaration of ‘translationToGlobalOriginMat’ shadows a previous local [-Werror=shadow]

Check failure on line 219 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

declaration of 'translationToGlobalOriginMat' hides previous local declaration [D:\a\complex\complex\build\Plugins\ComplexCore\ComplexCore.vcxproj]

Check failure on line 219 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, g++-10)

declaration of ‘translationToGlobalOriginMat’ shadows a previous local [-Werror=shadow]

Check failure on line 219 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

declaration of 'translationToGlobalOriginMat' hides previous local declaration [D:\a\complex\complex\build\Plugins\ComplexCore\ComplexCore.vcxproj]

Check failure on line 219 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, clang++-10)

declaration shadows a local variable [-Werror,-Wshadow]
const ImageRotationUtilities::Matrix4fR translationFromGlobalOriginMat = ImageRotationUtilities::GenerateTranslationTransformationMatrix({minPoint[0], minPoint[1], minPoint[2]});

Check failure on line 220 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (macos-11)

declaration shadows a local variable [-Werror,-Wshadow]

Check failure on line 220 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, g++-9)

declaration of ‘translationFromGlobalOriginMat’ shadows a previous local [-Werror=shadow]

Check failure on line 220 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v142)

declaration of 'translationFromGlobalOriginMat' hides previous local declaration [D:\a\complex\complex\build\Plugins\ComplexCore\ComplexCore.vcxproj]

Check failure on line 220 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, g++-10)

declaration of ‘translationFromGlobalOriginMat’ shadows a previous local [-Werror=shadow]

Check failure on line 220 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (windows-2022, v143)

declaration of 'translationFromGlobalOriginMat' hides previous local declaration [D:\a\complex\complex\build\Plugins\ComplexCore\ComplexCore.vcxproj]

Check failure on line 220 in src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/ApplyTransformationToGeometry.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-20.04, clang++-10)

declaration shadows a local variable [-Werror,-Wshadow]
m_TransformationMatrix = translationFromGlobalOriginMat * m_TransformationMatrix * translationToGlobalOriginMat;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Plugins/OrientationAnalysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ set(FilterList
ImportH5EspritDataFilter
ImportH5OimDataFilter
INLWriterFilter
MergeColoniesFilter
MergeTwinsFilter
NeighborOrientationCorrelationFilter
ReadAngDataFilter
Expand Down Expand Up @@ -199,6 +200,7 @@ set(filter_algorithms
ImportH5EspritData
ImportH5OimData
INLWriter
MergeColonies
MergeTwins
NeighborOrientationCorrelation
ReadAngData
Expand Down
69 changes: 69 additions & 0 deletions src/Plugins/OrientationAnalysis/docs/MergeColoniesFilter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Merge Colonies #

## Group (Subgroup) ##

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).

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> |
| 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 |

## Parameters ##

| Name | Type | Description |
|------|------| ----------- |
| Use Seed | bool | Whether a seed shouold be used for random generation |
| Seed | uint64 | This is the value fed into the random generator |
| Axis Tolerance (Degrees) | float32 | Tolerance allowed when comparing the axis part of the axis-angle representation of the misorientation to the *special* misorientations listed above |
| Angle Tolerance (Degrees) | float32 | Tolerance allowed when comparing the angle part of the axis-angle representation of the misorientation to the *special* misorientations listed above |
| Use Non-Contiguous Neighbors | bool | Whether to use a non-contiguous neighbor list during the merging process |

## Required Geometry ##

Not Applicable

## Required Objects ##

| Kind | Default Name | Type | Component Dimensions | Description |
|------|--------------|------|----------------------|-------------|
| **Feature Attribute Array** | NonContiguousNeighbors | Int32NeighborList | (1) | List of non-contiguous neighbors for each **Feature**. Only needed if *Use Non-Contiguous Neighbors* is checked |
| **Feature Attribute Array** | NeighborList | Int32NeighborList | (1) | List of neighbors for each **Feature** |
| **Element Attribute Array** | FeatureIds | int32 | (1) | Specifies to which **Feature** each **Element** belongs |
| **Element Attribute Array** | Phases | int32 | (1) | Specifies to which **Ensemble** each **Element** belongs |
| **Feature Attribute Array** | Phases | int32 | (1) | Specifies to which **Ensemble** each **Feature** belongs |
| **Feature Attribute Array** | AvgQuats | float32 | (4) | Specifies the average orientation of the **Feature** in quaternion representation |
| **Ensemble Attribute Array** | CrystalStructures | uint32 | (1) | Enumeration representing the crystal structure for each **Ensemble** |

## Created Objects ##

| Kind | Default Name | Type | Component Dimensions | Description |
|------|--------------|------|----------------------|-------------|
| **Element Attribute Array** | ParentIds | int32 | (1) | Specifies to which *parent* each **Element** belongs |
| **Attribute Matrix** | NewFeatureData | Feature | N/A | Created **Feature Attribute Matrix** name |
| **Feature Attribute Array** | ParentIds | int32 | (1) | Specifies to which *parent* each **Feature** belongs |
| **Feature Attribute Array** | Active | bool | (1) | Specifies if the **Feature** is still in the sample (*true* if the **Feature** is in the sample and *false* if it is not). At the end of the **Filter**, all **Features** will be *Active* |

## 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 ##

Please see the description file distributed with this **Plugin**

## DREAM.3D Mailing Lists ##

If you need more help with a **Filter**, please consider asking your question on the [DREAM.3D Users Google group!](https://groups.google.com/forum/?hl=en#!forum/dream3d-users)
Loading
Loading