Skip to content

Commit

Permalink
Update to latest API changes
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Jackson <[email protected]>
  • Loading branch information
imikejackson committed Feb 19, 2024
1 parent 0e6ed8f commit fc99e7a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 49 deletions.
7 changes: 2 additions & 5 deletions src/Plugins/OrientationAnalysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# ------------------------------------------------------------------------------
# Required EbsdLib and H5Support
# ------------------------------------------------------------------------------
#find_package(H5Support REQUIRED)
find_package(H5Support REQUIRED)

#find_package(EbsdLib REQUIRED)

add_subdirectory(${complex_SOURCE_DIR}/../H5Support ${complex_BINARY_DIR}/H5Support)
add_subdirectory(${complex_SOURCE_DIR}/../EbsdLib ${complex_BINARY_DIR}/EbsdLib)
find_package(EbsdLib REQUIRED)

# ------------------------------------------------------------------------------
# EbsdLib needs install rules for creating packages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include "ReadH5OinaData.hpp"

#include "complex/DataStructure/DataArray.hpp"
#include "complex/DataStructure/Geometry/ImageGeom.hpp"
#include "simplnx/DataStructure/DataArray.hpp"
#include "simplnx/DataStructure/Geometry/ImageGeom.hpp"

using namespace complex;
using namespace nx::core;

namespace
{

template <typename T>
void copyRawData(const ImportH5DataInputValues* m_InputValues, size_t totalPoints, DataStructure& m_DataStructure, H5OINAReader& m_Reader, const std::string& name, usize offset)
void copyRawData(const ReadH5DataInputValues* m_InputValues, size_t totalPoints, DataStructure& m_DataStructure, H5OINAReader& m_Reader, const std::string& name, usize offset)
{
using ArrayType = DataArray<T>;
auto& dataRef = m_DataStructure.getDataRefAs<ArrayType>(m_InputValues->CellAttributeMatrixPath.createChildPath(name));
Expand All @@ -21,7 +21,7 @@ void copyRawData(const ImportH5DataInputValues* m_InputValues, size_t totalPoint
}

template <typename T>
void convertHexEulerAngle(const ImportH5DataInputValues* m_InputValues, size_t totalPoints, DataStructure& m_DataStructure)
void convertHexEulerAngle(const ReadH5DataInputValues* m_InputValues, size_t totalPoints, DataStructure& m_DataStructure)
{
using ArrayType = DataArray<T>;

Expand Down Expand Up @@ -49,8 +49,8 @@ void convertHexEulerAngle(const ImportH5DataInputValues* m_InputValues, size_t t
} // namespace

// -----------------------------------------------------------------------------
ReadH5OinaData::ReadH5OinaData(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, ImportH5DataInputValues* inputValues)
: ImportH5Data<H5OINAReader>(dataStructure, mesgHandler, shouldCancel, inputValues)
ReadH5OinaData::ReadH5OinaData(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, ReadH5DataInputValues* inputValues)
: ReadH5Data<H5OINAReader>(dataStructure, mesgHandler, shouldCancel, inputValues)
{
}

Expand Down Expand Up @@ -106,7 +106,6 @@ Result<> ReadH5OinaData::copyRawEbsdData(int index)
}
}


if(m_InputValues->ReadPatternData)
{
const uint16* patternDataPtr = m_Reader->getPatternData();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "OrientationAnalysis/OrientationAnalysis_export.hpp"
#include "OrientationAnalysis/utilities/ImportH5Data.hpp"
#include "OrientationAnalysis/utilities/ReadH5Data.hpp"

namespace complex
namespace nx::core
{

/**
Expand All @@ -12,10 +12,10 @@ namespace complex
* intermediate .h5ebsd file.
*/

class ORIENTATIONANALYSIS_EXPORT ReadH5OinaData : public ImportH5Data<H5OINAReader>
class ORIENTATIONANALYSIS_EXPORT ReadH5OinaData : public ReadH5Data<H5OINAReader>
{
public:
ReadH5OinaData(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, ImportH5DataInputValues* inputValues);
ReadH5OinaData(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, ReadH5DataInputValues* inputValues);
~ReadH5OinaData() noexcept override;

ReadH5OinaData(const ReadH5OinaData&) = delete;
Expand All @@ -26,7 +26,6 @@ class ORIENTATIONANALYSIS_EXPORT ReadH5OinaData : public ImportH5Data<H5OINARead
Result<> operator()();

Result<> copyRawEbsdData(int index) override;

};

} // namespace complex
} // namespace nx::core
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
#include "OrientationAnalysis/Filters/Algorithms/ReadH5OinaData.hpp"
#include "OrientationAnalysis/Parameters/OEMEbsdScanSelectionParameter.h"

#include "complex/DataStructure/DataPath.hpp"
#include "complex/DataStructure/Geometry/ImageGeom.hpp"
#include "complex/Filter/Actions/CreateArrayAction.hpp"
#include "complex/Filter/Actions/CreateAttributeMatrixAction.hpp"
#include "complex/Filter/Actions/CreateImageGeometryAction.hpp"
#include "complex/Filter/Actions/CreateStringArrayAction.hpp"
#include "complex/Parameters/BoolParameter.hpp"
#include "complex/Parameters/DataGroupCreationParameter.hpp"
#include "complex/Parameters/DataObjectNameParameter.hpp"
#include "complex/Parameters/FileSystemPathParameter.hpp"
#include "complex/Parameters/NumberParameter.hpp"
#include "complex/Parameters/VectorParameter.hpp"
#include "simplnx/DataStructure/DataPath.hpp"
#include "simplnx/DataStructure/Geometry/ImageGeom.hpp"
#include "simplnx/Filter/Actions/CreateArrayAction.hpp"
#include "simplnx/Filter/Actions/CreateAttributeMatrixAction.hpp"
#include "simplnx/Filter/Actions/CreateImageGeometryAction.hpp"
#include "simplnx/Filter/Actions/CreateStringArrayAction.hpp"
#include "simplnx/Parameters/BoolParameter.hpp"
#include "simplnx/Parameters/DataGroupCreationParameter.hpp"
#include "simplnx/Parameters/DataObjectNameParameter.hpp"
#include "simplnx/Parameters/FileSystemPathParameter.hpp"
#include "simplnx/Parameters/NumberParameter.hpp"
#include "simplnx/Parameters/VectorParameter.hpp"

#include "EbsdLib/IO/HKL/CtfFields.h"
#include "EbsdLib/IO/HKL/H5OINAReader.h"

#include <filesystem>
namespace fs = std::filesystem;

using namespace complex;
using namespace nx::core;

namespace complex
namespace nx::core
{
//------------------------------------------------------------------------------
std::string ReadH5OinaDataFilter::name() const
Expand Down Expand Up @@ -66,12 +66,10 @@ Parameters ReadH5OinaDataFilter::parameters() const
params.insert(std::make_unique<OEMEbsdScanSelectionParameter>(k_SelectedScanNames_Key, "Scan Names", "The name of the scan in the .h5oina file. Oxford can store multiple scans in a single file",
OEMEbsdScanSelectionParameter::ValueType{},
/* OEMEbsdScanSelectionParameter::AllowedManufacturers{EbsdLib::OEM::EDAX}, */
OEMEbsdScanSelectionParameter::EbsdReaderType::H5Oina,
OEMEbsdScanSelectionParameter::ExtensionsType{".h5oina"}));
OEMEbsdScanSelectionParameter::EbsdReaderType::H5Oina, OEMEbsdScanSelectionParameter::ExtensionsType{".h5oina"}));
params.insert(std::make_unique<BoolParameter>(k_EdaxHexagonalAlignment_Key, "Convert Hexagonal X-Axis to EDAX Standard",
"Whether or not to convert a Hexagonal phase to the EDAX standard for x-axis alignment", true));
params.insert(std::make_unique<BoolParameter>(k_ConvertPhaseToInt32_Key, "Convert Phase Data to In32",
"Native Phases data value is uint8. Convert to Int32 for better filter compatibility", true));
params.insert(std::make_unique<BoolParameter>(k_ConvertPhaseToInt32_Key, "Convert Phase Data to Int32", "Native Phases data value is uint8. Convert to Int32 for better filter compatibility", true));
params.insert(std::make_unique<Float32Parameter>(k_ZSpacing_Key, "Z Spacing (Microns)", "The spacing in microns between each layer.", 1.0f));
params.insert(std::make_unique<VectorFloat32Parameter>(k_Origin_Key, "Origin", "The origin of the volume", std::vector<float32>{0.0F, 0.0F, 0.0F}, std::vector<std::string>{"x", "y", "z"}));
params.insert(std::make_unique<BoolParameter>(k_ReadPatternData_Key, "Import Pattern Data", "Whether or not to import the pattern data", false));
Expand All @@ -94,7 +92,7 @@ IFilter::UniquePointer ReadH5OinaDataFilter::clone() const

//------------------------------------------------------------------------------
IFilter::PreflightResult ReadH5OinaDataFilter::preflightImpl(const DataStructure& dataStructure, const Arguments& filterArgs, const MessageHandler& messageHandler,
const std::atomic_bool& shouldCancel) const
const std::atomic_bool& shouldCancel) const
{
auto pSelectedScanNamesValue = filterArgs.value<OEMEbsdScanSelectionParameter::ValueType>(k_SelectedScanNames_Key);
auto pZSpacingValue = filterArgs.value<float32>(k_ZSpacing_Key);
Expand All @@ -105,12 +103,11 @@ IFilter::PreflightResult ReadH5OinaDataFilter::preflightImpl(const DataStructure
auto pCellEnsembleAttributeMatrixNameValue = filterArgs.value<std::string>(k_CellEnsembleAttributeMatrixName_Key);
auto pConvertPhaseData = filterArgs.value<bool>(k_ConvertPhaseToInt32_Key);


DataPath cellEnsembleAMPath = pImageGeometryNameValue.createChildPath(pCellEnsembleAttributeMatrixNameValue);
DataPath cellAMPath = pImageGeometryNameValue.createChildPath(pCellAttributeMatrixNameValue);

PreflightResult preflightResult;
complex::Result<OutputActions> resultOutputActions;
nx::core::Result<OutputActions> resultOutputActions;
std::vector<PreflightValue> preflightUpdatedValues;

if(pZSpacingValue <= 0)
Expand Down Expand Up @@ -198,9 +195,9 @@ IFilter::PreflightResult ReadH5OinaDataFilter::preflightImpl(const DataStructure

//------------------------------------------------------------------------------
Result<> ReadH5OinaDataFilter::executeImpl(DataStructure& dataStructure, const Arguments& filterArgs, const PipelineFilter* pipelineNode, const MessageHandler& messageHandler,
const std::atomic_bool& shouldCancel) const
const std::atomic_bool& shouldCancel) const
{
ImportH5DataInputValues inputValues;
ReadH5DataInputValues inputValues;

inputValues.SelectedScanNames = filterArgs.value<OEMEbsdScanSelectionParameter::ValueType>(k_SelectedScanNames_Key);
inputValues.ReadPatternData = filterArgs.value<bool>(k_ReadPatternData_Key);
Expand All @@ -212,4 +209,4 @@ Result<> ReadH5OinaDataFilter::executeImpl(DataStructure& dataStructure, const A

return ReadH5OinaData(dataStructure, messageHandler, shouldCancel, &inputValues)();
}
} // namespace complex
} // namespace nx::core
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include "OrientationAnalysis/OrientationAnalysis_export.hpp"

#include "complex/Filter/FilterTraits.hpp"
#include "complex/Filter/IFilter.hpp"
#include "simplnx/Filter/FilterTraits.hpp"
#include "simplnx/Filter/IFilter.hpp"

namespace complex
namespace nx::core
{
/**
* @class ReadH5OinaDataFilter
Expand Down Expand Up @@ -99,7 +99,7 @@ class ORIENTATIONANALYSIS_EXPORT ReadH5OinaDataFilter : public IFilter
*/
Result<> executeImpl(DataStructure& data, const Arguments& filterArgs, const PipelineFilter* pipelineNode, const MessageHandler& messageHandler, const std::atomic_bool& shouldCancel) const override;
};
} // namespace complex
} // namespace nx::core

COMPLEX_DEF_FILTER_TRAITS(complex, ReadH5OinaDataFilter, "fad3d47f-f1e1-4429-bc65-5e021be62ba0");
SIMPLNX_DEF_FILTER_TRAITS(nx::core, ReadH5OinaDataFilter, "fad3d47f-f1e1-4429-bc65-5e021be62ba0");
/* LEGACY UUID FOR THIS FILTER 3ff4701b-3a0c-52e3-910a-fa927aa6584c */
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "simplnx/Filter/IFilter.hpp"

#include "EbsdLib/IO/BrukerNano/H5EspritReader.h"
#include "EbsdLib/IO/TSL/H5OIMReader.h"
#include "EbsdLib/IO/HKL/H5OINAReader.h"
#include "EbsdLib/IO/TSL/H5OIMReader.h"

namespace nx::core
{
Expand Down
2 changes: 2 additions & 0 deletions vcpkg-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
"blosc",
"boost-mp11",
"catch2",
"ebsdlib",
"eigen3",
"expected-lite",
"fmt",
"h5support",
"hdf5",
"lz4",
"itk",
Expand Down

0 comments on commit fc99e7a

Please sign in to comment.