@@ -23,74 +23,147 @@ Result<> ReadH5OimData::operator()()
23
23
// -----------------------------------------------------------------------------
24
24
Result<> ReadH5OimData::copyRawEbsdData (int index)
25
25
{
26
+ const auto & imageGeom = m_DataStructure.getDataRefAs <ImageGeom>(m_InputValues->ImageGeometryPath );
27
+ const usize totalPoints = imageGeom.getNumXCells () * imageGeom.getNumYCells ();
28
+ const usize offset = index * totalPoints;
26
29
27
- if (m_InputValues->CombineScans )
28
- {
29
- const auto & imageGeom = m_DataStructure.getDataRefAs <ImageGeom>(m_InputValues->ImageGeometryPath );
30
- const usize totalPoints = imageGeom.getNumXCells () * imageGeom.getNumYCells ();
31
- const usize offset = index * totalPoints;
30
+ // Adjust the values of the 'phase' data to correct for invalid values
31
+ auto & phases = m_DataStructure.getDataRefAs <Int32Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::AngFile::Phases));
32
+ auto * phasePtr = reinterpret_cast <int32*>(m_Reader->getPointerByName (EbsdLib::Ang::PhaseData));
33
+
34
+ const auto * phi1 = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::Phi1));
35
+ const auto * phi = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::Phi));
36
+ const auto * phi2 = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::Phi2));
37
+ auto & eulerAngles =
38
+ m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::AngFile::EulerAngles));
39
+
40
+ const auto * imageQual = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::ImageQuality));
41
+ auto & imageQuality = m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::ImageQuality));
42
+
43
+ const auto * confIndex = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::ConfidenceIndex));
44
+ auto & confidenceIndex =
45
+ m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::ConfidenceIndex));
32
46
33
- // Adjust the values of the 'phase' data to correct for invalid values
34
- auto & phases = m_DataStructure.getDataRefAs <Int32Array>(m_InputValues->CellAttributeMatrixPath .createChildPath (EbsdLib::AngFile::Phases));
35
- auto * phasePtr = reinterpret_cast <int32*>(m_Reader->getPointerByName (EbsdLib::Ang::PhaseData));
47
+ const auto * semSig = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::SEMSignal));
48
+ auto & semSignal = m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::SEMSignal));
49
+
50
+ const auto * f1 = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::Fit));
51
+ auto & fit = m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::Fit));
52
+
53
+ for (size_t i = 0 ; i < totalPoints; i++)
54
+ {
55
+ if (phasePtr[i] < 1 )
56
+ {
57
+ phasePtr[i] = 1 ;
58
+ }
59
+ phases[offset + i] = phasePtr[i];
36
60
37
- const auto * phi1 = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Phi1));
38
- const auto * phi = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Phi)) ;
39
- const auto * phi2 = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Phi2)) ;
40
- auto & eulerAngles = m_DataStructure. getDataRefAs <Float32Array>(m_InputValues-> CellAttributeMatrixPath . createChildPath (EbsdLib::AngFile::EulerAngles)) ;
61
+ // Condense the Euler Angles from 3 separate arrays into a single 1x3 array
62
+ eulerAngles[offset + 3 * i] = phi1[i] ;
63
+ eulerAngles[offset + 3 * i + 1 ] = phi[i] ;
64
+ eulerAngles[offset + 3 * i + 2 ] = phi2[i] ;
41
65
42
- const auto * imageQual = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::ImageQuality));
43
- auto & imageQuality = m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->CellAttributeMatrixPath .createChildPath (EbsdLib::Ang::ImageQuality));
66
+ imageQuality[offset + i] = imageQual[i];
44
67
45
- const auto * confIndex = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::ConfidenceIndex));
46
- auto & confidenceIndex = m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->CellAttributeMatrixPath .createChildPath (EbsdLib::Ang::ConfidenceIndex));
68
+ confidenceIndex[offset + i] = confIndex[i];
47
69
48
- const auto * semSig = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::SEMSignal));
49
- auto & semSignal = m_DataStructure.getDataRefAs <Float32Array>(m_InputValues->CellAttributeMatrixPath .createChildPath (EbsdLib::Ang::SEMSignal));
70
+ semSignal[offset + i] = semSig[i];
50
71
51
- const auto * f1 = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Fit)) ;
52
- auto & fit = m_DataStructure. getDataRefAs <Float32Array>(m_InputValues-> CellAttributeMatrixPath . createChildPath (EbsdLib::Ang::Fit));
72
+ fit[offset + i] = f1[i] ;
73
+ }
53
74
54
- for (size_t i = 0 ; i < totalPoints; i++)
75
+ if (m_InputValues->ReadPatternData )
76
+ {
77
+ const uint8* patternDataPtr = m_Reader->getPatternData ();
78
+ std::array<int32, 2 > pDims = {{0 , 0 }};
79
+ m_Reader->getPatternDims (pDims);
80
+ if (pDims[0 ] != 0 && pDims[1 ] != 0 )
55
81
{
56
- if (phasePtr[i] < 1 )
82
+ std::vector<usize> pDimsV (2 );
83
+ pDimsV[0 ] = pDims[0 ];
84
+ pDimsV[1 ] = pDims[1 ];
85
+ auto & patternData = m_DataStructure.getDataRefAs <UInt8Array>(m_InputValues->ImageGeometryPath .createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::PatternData));
86
+ const usize numComponents = patternData.getNumberOfComponents ();
87
+ for (usize i = 0 ; i < totalPoints; i++)
57
88
{
58
- phasePtr[i] = 1 ;
89
+ for (usize j = 0 ; j < numComponents; ++j)
90
+ {
91
+ patternData[offset + numComponents * i + j] = patternDataPtr[numComponents * i + j];
92
+ }
59
93
}
60
- phases[offset + i] = phasePtr[i];
94
+ }
95
+ }
96
+
97
+ return {};
98
+ }
99
+
100
+ // -----------------------------------------------------------------------------
101
+ Result<> ReadH5OimData::copyRawEbsdData (const std::string& scanName)
102
+ {
103
+ DataPath imagePath ({scanName});
104
+ const auto & imageGeom = m_DataStructure.getDataRefAs <ImageGeom>(imagePath);
105
+ const usize totalPoints = imageGeom.getNumXCells () * imageGeom.getNumYCells ();
106
+
107
+ // Adjust the values of the 'phase' data to correct for invalid values
108
+ auto & phases = m_DataStructure.getDataRefAs <Int32Array>(imagePath.createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::AngFile::Phases));
109
+ auto * phasePtr = reinterpret_cast <int32*>(m_Reader->getPointerByName (EbsdLib::Ang::PhaseData));
61
110
62
- // Condense the Euler Angles from 3 separate arrays into a single 1x3 array
63
- eulerAngles[offset + 3 * i] = phi1[i] ;
64
- eulerAngles[offset + 3 * i + 1 ] = phi[i] ;
65
- eulerAngles[offset + 3 * i + 2 ] = phi2[i] ;
111
+ const auto * phi1 = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Phi1));
112
+ const auto * phi = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Phi)) ;
113
+ const auto * phi2 = reinterpret_cast <float32*>(m_Reader-> getPointerByName (EbsdLib::Ang::Phi2)) ;
114
+ auto & eulerAngles = m_DataStructure. getDataRefAs <Float32Array>(imagePath. createChildPath (m_InputValues-> CellAttributeMatrixName ). createChildPath (EbsdLib::AngFile::EulerAngles)) ;
66
115
67
- imageQuality[offset + i] = imageQual[i];
116
+ const auto * imageQual = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::ImageQuality));
117
+ auto & imageQuality = m_DataStructure.getDataRefAs <Float32Array>(imagePath.createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::ImageQuality));
68
118
69
- confidenceIndex[offset + i] = confIndex[i];
119
+ const auto * confIndex = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::ConfidenceIndex));
120
+ auto & confidenceIndex = m_DataStructure.getDataRefAs <Float32Array>(imagePath.createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::ConfidenceIndex));
70
121
71
- semSignal[offset + i] = semSig[i];
122
+ const auto * semSig = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::SEMSignal));
123
+ auto & semSignal = m_DataStructure.getDataRefAs <Float32Array>(imagePath.createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::SEMSignal));
72
124
73
- fit[offset + i] = f1[i];
125
+ const auto * f1 = reinterpret_cast <float32*>(m_Reader->getPointerByName (EbsdLib::Ang::Fit));
126
+ auto & fit = m_DataStructure.getDataRefAs <Float32Array>(imagePath.createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::Fit));
127
+
128
+ for (usize i = 0 ; i < totalPoints; i++)
129
+ {
130
+ if (phasePtr[i] < 1 )
131
+ {
132
+ phasePtr[i] = 1 ;
74
133
}
134
+ phases[i] = phasePtr[i];
135
+
136
+ // Condense the Euler Angles from 3 separate arrays into a single 1x3 array
137
+ eulerAngles[3 * i] = phi1[i];
138
+ eulerAngles[3 * i + 1 ] = phi[i];
139
+ eulerAngles[3 * i + 2 ] = phi2[i];
140
+
141
+ imageQuality[i] = imageQual[i];
142
+
143
+ confidenceIndex[i] = confIndex[i];
75
144
76
- if (m_InputValues->ReadPatternData )
145
+ semSignal[i] = semSig[i];
146
+
147
+ fit[i] = f1[i];
148
+ }
149
+
150
+ if (m_InputValues->ReadPatternData )
151
+ {
152
+ const uint8* patternDataPtr = m_Reader->getPatternData ();
153
+ std::array<int32, 2 > pDims = {{0 , 0 }};
154
+ m_Reader->getPatternDims (pDims);
155
+ if (pDims[0 ] != 0 && pDims[1 ] != 0 )
77
156
{
78
- const uint8* patternDataPtr = m_Reader->getPatternData ();
79
- std::array<int32, 2 > pDims = {{0 , 0 }};
80
- m_Reader->getPatternDims (pDims);
81
- if (pDims[0 ] != 0 && pDims[1 ] != 0 )
157
+ std::vector<usize> pDimsV (2 );
158
+ pDimsV[0 ] = pDims[0 ];
159
+ pDimsV[1 ] = pDims[1 ];
160
+ auto & patternData = m_DataStructure.getDataRefAs <UInt8Array>(imagePath.createChildPath (m_InputValues->CellAttributeMatrixName ).createChildPath (EbsdLib::Ang::PatternData));
161
+ const usize numComponents = patternData.getNumberOfComponents ();
162
+ for (usize i = 0 ; i < totalPoints; i++)
82
163
{
83
- std::vector<usize> pDimsV (2 );
84
- pDimsV[0 ] = pDims[0 ];
85
- pDimsV[1 ] = pDims[1 ];
86
- auto & patternData = m_DataStructure.getDataRefAs <UInt8Array>(m_InputValues->CellAttributeMatrixPath .createChildPath (EbsdLib::Ang::PatternData));
87
- const usize numComponents = patternData.getNumberOfComponents ();
88
- for (usize i = 0 ; i < totalPoints; i++)
164
+ for (usize j = 0 ; j < numComponents; ++j)
89
165
{
90
- for (usize j = 0 ; j < numComponents; ++j)
91
- {
92
- patternData[offset + numComponents * i + j] = patternDataPtr[numComponents * i + j];
93
- }
166
+ patternData[numComponents * i + j] = patternDataPtr[numComponents * i + j];
94
167
}
95
168
}
96
169
}
0 commit comments