Skip to content

Commit 39ad2e1

Browse files
authored
ENH: Add API to H5EbsdVolumeReader to add compatibility with ReadAng and ReadCtf (#32)
This is mainly added for the SIMPLNX project. Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
1 parent ba01067 commit 39ad2e1

4 files changed

Lines changed: 109 additions & 1 deletion

File tree

Source/EbsdLib/IO/HKL/H5CtfVolumeReader.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,48 @@ std::vector<CtfPhase::Pointer> H5CtfVolumeReader::getPhases()
251251
return m_Phases;
252252
}
253253

254+
// -----------------------------------------------------------------------------
255+
std::vector<CtfPhase::Pointer> H5CtfVolumeReader::getPhaseVector()
256+
{
257+
return getPhases();
258+
}
259+
260+
int32_t H5CtfVolumeReader::getXCells()
261+
{
262+
int64_t x = 0;
263+
int64_t y = 0;
264+
int64_t z = 0;
265+
getDims(x, y, x);
266+
return static_cast<int32_t>(x);
267+
}
268+
269+
int32_t H5CtfVolumeReader::getYCells()
270+
{
271+
int64_t x = 0;
272+
int64_t y = 0;
273+
int64_t z = 0;
274+
getDims(x, y, x);
275+
return static_cast<int32_t>(y);
276+
}
277+
278+
float H5CtfVolumeReader::getXStep()
279+
{
280+
float x = 0.0f;
281+
float y = 0.0f;
282+
float z = 0.0f;
283+
getSpacing(x, y, x);
284+
return x;
285+
}
286+
287+
float H5CtfVolumeReader::getYStep()
288+
{
289+
float x = 0.0f;
290+
float y = 0.0f;
291+
float z = 0.0f;
292+
getSpacing(x, y, x);
293+
return y;
294+
}
295+
254296
// -----------------------------------------------------------------------------
255297
//
256298
// -----------------------------------------------------------------------------

Source/EbsdLib/IO/HKL/H5CtfVolumeReader.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ class EbsdLib_EXPORT H5CtfVolumeReader : public H5EbsdVolumeReader
108108
*/
109109
std::vector<CtfPhase::Pointer> getPhases();
110110

111+
/**
112+
* @brief Returns the vector of Phase Objects
113+
* @note This is here to provide compatibility with AngReader
114+
* @return
115+
*/
116+
std::vector<CtfPhase::Pointer> getPhaseVector();
117+
118+
int32_t getXCells();
119+
int32_t getYCells();
120+
float getXStep();
121+
float getYStep();
122+
111123
/**
112124
* @brief Returns the pointer to the data for a given feature
113125
* @param featureName The name of the feature to return the pointer to.

Source/EbsdLib/IO/TSL/H5AngVolumeReader.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,47 @@ std::vector<AngPhase::Pointer> H5AngVolumeReader::getPhases()
256256
return m_Phases;
257257
}
258258

259+
std::vector<AngPhase::Pointer> H5AngVolumeReader::getPhaseVector()
260+
{
261+
return getPhases();
262+
}
263+
264+
int32_t H5AngVolumeReader::getNumEvenCols()
265+
{
266+
int64_t x = 0;
267+
int64_t y = 0;
268+
int64_t z = 0;
269+
getDims(x, y, x);
270+
return static_cast<int32_t>(x);
271+
}
272+
273+
int32_t H5AngVolumeReader::getNumRows()
274+
{
275+
int64_t x = 0;
276+
int64_t y = 0;
277+
int64_t z = 0;
278+
getDims(x, y, x);
279+
return static_cast<int32_t>(y);
280+
}
281+
282+
float H5AngVolumeReader::getXStep()
283+
{
284+
float x = 0.0f;
285+
float y = 0.0f;
286+
float z = 0.0f;
287+
getSpacing(x, y, x);
288+
return x;
289+
}
290+
291+
float H5AngVolumeReader::getYStep()
292+
{
293+
float x = 0.0f;
294+
float y = 0.0f;
295+
float z = 0.0f;
296+
getSpacing(x, y, x);
297+
return y;
298+
}
299+
259300
// -----------------------------------------------------------------------------
260301
//
261302
// -----------------------------------------------------------------------------

Source/EbsdLib/IO/TSL/H5AngVolumeReader.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,23 @@ class EbsdLib_EXPORT H5AngVolumeReader : public H5EbsdVolumeReader
9090
int loadData(int64_t xpoints, int64_t ypoints, int64_t zpoints, uint32_t ZDir) override;
9191

9292
/**
93-
* @brief
93+
* @brief Returns the vector of Phase Objects
9494
* @return
9595
*/
9696
std::vector<AngPhase::Pointer> getPhases();
97+
98+
/**
99+
* @brief Returns the vector of Phase Objects
100+
* @note This is here to provide compatibility with AngReader
101+
* @return
102+
*/
103+
std::vector<AngPhase::Pointer> getPhaseVector();
104+
105+
int32_t getNumEvenCols();
106+
int32_t getNumRows();
107+
float getXStep();
108+
float getYStep();
109+
97110
/**
98111
* @brief Returns the pointer to the data for a given feature
99112
* @param featureName The name of the feature to return the pointer to.

0 commit comments

Comments
 (0)