Skip to content

Commit daab6e4

Browse files
ENH/BUG: Alignment Filters Modernization (#1237)
* Change All Alignment Filters (inheriting from AlignSections) to work from Arrays * Added the option to work from relative or cumulative shifts in AlignSectionsList * Patched a bug in AlignSectionsFeatureCentroids that caused it to write 0s for relative paths * Extensive reworks and cleanup * Documentation updates and tutorial * Test cases * Add 3 example pipelines and example data - Implemented `getSelectedDataPaths()` in the AlignSections class since all subclasses were doing the same thing - Align Sections Feature Centroid: Removed the Cell Data Array path parameter since we get that from the Image geometry - Fixed a pipeline file that was throwing warnings about non-existent parameters - Parameter terminology is consistently used among the Align Section filters. Signed-off-by: Michael Jackson <[email protected]> --------- Signed-off-by: Michael Jackson <[email protected]> Co-authored-by: Michael Jackson <[email protected]>
1 parent 3e9aba6 commit daab6e4

File tree

37 files changed

+2051
-929
lines changed

37 files changed

+2051
-929
lines changed

src/Plugins/OrientationAnalysis/docs/AlignSectionsMisorientationFilter.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,32 @@ This **Filter** attempts to align consecutive 'sections' perpendicular to the Z-
1717

1818
**Note that this is similar to a downhill simplex and can get caught in a local minimum!**
1919

20-
If the user elects to use a mask array, the **Cells** flagged as *false* in the mask array will not be considered during the alignment process.
21-
22-
The user can choose to write the determined shift to an output file by enabling *Write Alignment Shifts File* and providing a file path.
20+
If the user elects to use a mask array, the **Cells** flagged as *false* in the mask array will not be considered during the alignment process.
2321

2422
The user can also decide to remove a *background shift* present in the sample. The process for this is to fit a line to the X and Y shifts along the Z-direction of the sample. The individual shifts are then modified to make the slope of the fit line be 0. Effectively, this process is trying to keep the top and bottom section of the sample fixed. Some combinations of sample geometry and internal features can result in this algorithm introducing a 'shear' in the sample and the *Linear Background Subtraction* will attempt to correct for this.
2523

26-
## Optional Output File Format
24+
## Optional Output Data
25+
26+
The user can optionally have the shifts that are generated by the filter stored in various DataArrays in a new Attribute Matrix.
2727

28-
The user can optionally have the shifts that are generated by the filter written to a file. The format of the file follows:
28+
The structure for which looks like this
2929

3030
```console
31-
slice_m slice_m+1 newxshift newyshift xshifts yshifts
32-
slice_n slice_n+1 newxshift newyshift xshifts yshifts
33-
etc...
31+
|-- Image Geometry
32+
|-- Alignment Shifts Data
33+
|-- Slices
34+
|-- Relative Shifts
35+
|-- Cumulative Shifts
3436
```
3537

36-
where the `newxshift` and `newyshift` are the shifts from the previous slice and
37-
`xshifts` and `yshifts` are the accumulated shift for the slice.
38+
In this new structure, what follows is what the created structures represent:
39+
40+
- Alignment Shifts Data (Attribute Matrix) - The tuple size here is defined by the number of slices [ie the Z Dimension of the Image Geometry]
41+
- Slices (DataArray | 2 component) - The slice indices (stored as uint32s)
42+
- Relative Shifts (DataArray | 2 component) - The slices shift relative to previous shift (stored as int64s) [*previously known as `newxshift` and `newyshift`*]
43+
- Cumulative Shifts (DataArray | 2 component) - The slice's accumulated shift (stored as int64s)
44+
45+
In previous versions a file would have been produced instead. If you wish to recreate this, you can write the Attribute Matrix as a CSV/Text file.
3846

3947

4048
% Auto generated parameter table will be inserted here

src/Plugins/OrientationAnalysis/docs/AlignSectionsMutualInformationFilter.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,30 @@ The user choses the level of *misorientation tolerance* by which to align **Cell
2424

2525
The approach used in this **Filter** is to group neighboring **Cells** on a slice that have a *misorientation* below the tolerance the user entered. *Misorientation* here means the minimum rotation angle of one **Cell's** crystal axis needed to coincide with another **Cell's** crystal axis. When the **Features** in the slices are defined, they are moved until *disks* in neighboring slices align with each other.
2626

27-
If the user elects to use a mask array, the **Cells** flagged as *false* in the mask array will not be considered during the alignment process.
27+
If the user elects to use a mask array, the **Cells** flagged as *false* in the mask array will not be considered during the alignment process.
2828

29-
The user can choose to write the determined shift to an output file by enabling *Write Alignment Shifts File* and providing a file path.
29+
## Optional Output Data
3030

31-
## Optional Output File Format
31+
The user can optionally have the shifts that are generated by the filter stored in various DataArrays in a new Attribute Matrix.
3232

33-
The user can optionally have the shifts that are generated by the filter written to a file. The format of the file follows:
33+
The structure for which looks like this
3434

3535
```console
36-
slice_m slice_m+1 newxshift newyshift xshifts yshifts
37-
slice_n slice_n+1 newxshift newyshift xshifts yshifts
38-
etc...
36+
|-- Image Geometry
37+
|-- Alignment Shifts Data
38+
|-- Slices
39+
|-- Relative Shifts
40+
|-- Cumulative Shifts
3941
```
4042

41-
where the `newxshift` and `newyshift` are the shifts from the previous slice and
42-
`xshifts` and `yshifts` are the accumulated shift for the slice.
43+
In this new structure, what follows is what the created structures represent:
4344

45+
- Alignment Shifts Data (Attribute Matrix) - The tuple size here is defined by the number of slices [ie the Z Dimension of the Image Geometry]
46+
- Slices (DataArray | 2 component) - The slice indices (stored as uint32s)
47+
- Relative Shifts (DataArray | 2 component) - The slices shift relative to previous shift (stored as int64s) [*previously known as `newxshift` and `newyshift`*]
48+
- Cumulative Shifts (DataArray | 2 component) - The slice's accumulated shift (stored as int64s)
49+
50+
In previous versions a file would have been produced instead. If you wish to recreate this, you can write the Attribute Matrix as a CSV/Text file.
4451

4552
% Auto generated parameter table will be inserted here
4653

src/Plugins/OrientationAnalysis/pipelines/AlignSectionsMutualInformation.d3dpipeline

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@
135135
},
136136
{
137137
"args": {
138-
"alignment_shift_file_name": {
139-
"value": "Data/Output/OrientationAnalysis/Alignment_By_Mutual_Information_Shifts.txt",
140-
"version": 1
141-
},
142138
"cell_phases_array_path": {
143139
"value": "DataContainer/Cell Data/Phases",
144140
"version": 1
@@ -159,18 +155,13 @@
159155
"value": 5.0,
160156
"version": 1
161157
},
162-
"parameters_version": 1,
163158
"quats_array_path": {
164159
"value": "DataContainer/Cell Data/Quats",
165160
"version": 1
166161
},
167162
"use_mask": {
168163
"value": true,
169164
"version": 1
170-
},
171-
"write_alignment_shifts": {
172-
"value": true,
173-
"version": 1
174165
}
175166
},
176167
"comments": "",

0 commit comments

Comments
 (0)