Skip to content

Commit

Permalink
PY: Added Python Code for Most Example Pipelines (#800)
Browse files Browse the repository at this point in the history
Python code examples including pipelines, plugins and generic examples have been updated.

Signed-off-by: Michael Jackson <[email protected]>
Co-authored-by: Michael Jackson <[email protected]>
Co-authored-by: Jared Duffey <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2024
1 parent 6eef763 commit f282e77
Show file tree
Hide file tree
Showing 97 changed files with 6,494 additions and 309 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ test_data/
CMakeUserPresets.json
Workspace
/__pycache__/
/Data/
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ endforeach()

set(SIMPLNX_GENERATED_PYTHON_HEADER ${SIMPLNX_GENERATED_HEADER_DIR}/SimplnxPython.hpp)
set(SIMPLNX_PYTHON_MODULE "simplnx")
configure_file(${simplnx_SOURCE_DIR}/wrapping/python/SimplnxPython.hpp.in ${SIMPLNX_GENERATED_PYTHON_HEADER})
configure_file(${simplnx_SOURCE_DIR}/wrapping/python/CxPybind/SimplnxPython.hpp.in ${SIMPLNX_GENERATED_PYTHON_HEADER})

list(APPEND SIMPLNX_GENERATED_HEADERS
${SIMPLNX_GENERATED_PYTHON_HEADER}
Expand Down
5 changes: 3 additions & 2 deletions cmake/Summary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ OSInformation()
message(STATUS "* -------------- Dependent Libraries -------------------------------------------")
message(STATUS "* Eigen (${Eigen3_VERSION}) ${Eigen3_DIR}")
message(STATUS "* HDF5 (${HDF5_VERSION}) ${HDF5_INSTALL}")
# message(STATUS "* ITK (${ITK_VERSION}) ${ITK_DIR}")
message(STATUS "* Pybind11 (${pybind11_VERSION}) ${pybind11_DIR}")
message(STATUS "* ITK (${ITK_VERSION}) ${ITK_DIR}")
message(STATUS "* TBB (${TBB_VERSION}) ${TBB_DIR}")
message(STATUS "* fmt (${fmt_VERSION}) ${fmt_DIR}")
message(STATUS "* nlohmann_json (${nlohmann_json_VERSION}) ${nlohmann_json_DIR}")
Expand All @@ -73,7 +72,9 @@ message(STATUS "* SIMPLNX_BUILD_DOCS: ${SIMPLNX_BUILD_DOCS}")
message(STATUS "* DREAM3D_DATA_DIR: ${DREAM3D_DATA_DIR}")

message(STATUS "* -------------- Simplnx Python Configuration Options -------------------------------------")
message(STATUS "* Pybind11 (${pybind11_VERSION}) ${pybind11_DIR}")
message(STATUS "* Python3_EXECUTABLE: ${Python3_EXECUTABLE}")
message(STATUS "* PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
message(STATUS "* SIMPLNX_BUILD_PYTHON: ${SIMPLNX_BUILD_PYTHON}")
message(STATUS "* SIMPLNX_BUILD_PYTHON_DOCS: ${SIMPLNX_BUILD_PYTHON_DOCS}")
message(STATUS "* SIMPLNX_BUILD_PYTHON_TESTS: ${SIMPLNX_BUILD_PYTHON_TESTS}")
Expand Down
4 changes: 2 additions & 2 deletions cmake/Utility.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ function(create_pipeline_tests)
get_filename_component(test_file_name ${pipeline_file_path} NAME_WE)
string(REPLACE "/" "-" test_file_name "${test_file_name}")

add_test(NAME "${ARGS_PLUGIN_NAME} ${padding}${test_index} ${test_file_name}"
add_test(NAME "PIPELINE::${ARGS_PLUGIN_NAME}::${padding}${test_index}_${test_file_name}"
COMMAND "${PIPELINE_RUNNER_NAME}$<$<CONFIG:Debug>:${PIPELINE_RUNNER_DEBUG}>" --execute ${pipeline_file_path}
#CONFIGURATIONS Debug
WORKING_DIRECTORY ${TEST_WORKING_DIR})
Expand Down Expand Up @@ -473,7 +473,7 @@ function(AddPythonTest)
set(oneValueArgs NAME FILE)
set(multiValueArgs PYTHONPATH)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
message(STATUS "ARGS_FILE:${ARGS_FILE}")
# message(STATUS "ARGS_FILE:${ARGS_FILE}")
if(SIMPLNX_BUILD_PYTHON)
if(WIN32)
add_test(NAME ${ARGS_NAME}
Expand Down
4 changes: 2 additions & 2 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ cxx_compiler:
- vs2019 # [win]

c_compiler_version: # [unix]
- 9.3.0 # [linux]
- 10.4.0 # [linux]

cxx_compiler_version:
- 9.3.0 # [linux]
- 10.4.0 # [linux]

python:
- 3.11
Expand Down
4 changes: 2 additions & 2 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "simplnx" %}
{% set version = "1.2.2" %}
{% set version = "1.2.3" %}

package:
name: {{ name|lower }}
Expand Down Expand Up @@ -40,7 +40,7 @@ build:
requirements:
build:
- {{ compiler('cxx') }}
- cmake >=3.19
- cmake >=3.26
- ninja
- git
host:
Expand Down
12 changes: 6 additions & 6 deletions conda/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
context:
version: "1.2.1"
version: "1.2.3"
name: simplnx

package:
Expand All @@ -26,7 +26,10 @@ source:
folder: span-lite
- url: https://raw.githubusercontent.com/bluequartzsoftware/simplnx-registry/9a5db7b5fa02b2495eb51654cbaab3c63820c779/ports/nod/CMakeLists.txt
folder: nod

- git_url: https://github.com/insightsoftwareconsortium/ITK
git_rev: v5.2.1
folder: itk

build:
number: 0
script_env:
Expand All @@ -38,7 +41,7 @@ build:
requirements:
build:
- "{{ compiler('cxx') }}"
- cmake >=3.19
- cmake >=3.26
- ninja
- git
host:
Expand All @@ -49,8 +52,6 @@ requirements:
- eigen
- fmt =10
- hdf5 =1.12
- libitk =5.2
- libitk-devel =5.2
- nlohmann_json
- pybind11 >=2.10
- reproc-cpp
Expand All @@ -66,7 +67,6 @@ requirements:
- numpy
- fmt =10
- hdf5 =1.12
- libitk =5.2
- reproc-cpp
- tbb
- zlib
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/OrientationAnalysis/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ fi
"${SIMPLNX_CTEST_TEST_DRIVER}" @ONLY)

string(REPLACE "/" "_" test "${test}")
add_test(NAME ${PLUGIN_NAME}_${ARGS_TEST_INDEX} COMMAND "${SIMPLNX_CTEST_TEST_DRIVER}")
add_test(NAME "PIPELINE::${PLUGIN_NAME}::${ARGS_TEST_INDEX}" COMMAND "${SIMPLNX_CTEST_TEST_DRIVER}")
endfunction()

# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/OrientationAnalysis/test/MergeTwinsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ TEST_CASE("Reconstruction::MergeTwinsFilter: Valid Execution", "[Reconstruction]
{
constexpr StringLiteral k_ImportFileData = "import_file_data";

auto filter = filterList->createFilter(k_ImportDream3dFilterHandle);
auto filter = filterList->createFilter(k_ReadDREAM3DFilterHandle);
REQUIRE(nullptr != filter);

Dream3dImportParameter::ImportData parameter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace nx::core
const Uuid k_ReadTextDataArrayFilterId = *Uuid::FromString("25f7df3e-ca3e-4634-adda-732c0e56efd4");
const FilterHandle k_ReadTextDataArrayFilterHandle(k_ReadTextDataArrayFilterId, k_SimplnxCorePluginId);
// Make sure we can instantiate the Read DREAM3D Data File
const Uuid k_ImportDream3dFilterId = *Uuid::FromString("0dbd31c7-19e0-4077-83ef-f4a6459a0e2d");
const FilterHandle k_ImportDream3dFilterHandle(k_ImportDream3dFilterId, k_SimplnxCorePluginId);
const Uuid k_ReadDREAM3DFilterId = *Uuid::FromString("0dbd31c7-19e0-4077-83ef-f4a6459a0e2d");
const FilterHandle k_ReadDREAM3DFilterHandle(k_ReadDREAM3DFilterId, k_SimplnxCorePluginId);
// Make sure we can instantiate the Read RenameDataObject
const Uuid k_RenameDataObjectFilterId = *Uuid::FromString("911a3aa9-d3c2-4f66-9451-8861c4b726d5");
const FilterHandle k_RenameDataObjectFilterHandle(k_RenameDataObjectFilterId, k_SimplnxCorePluginId);
Expand Down
101 changes: 45 additions & 56 deletions src/Plugins/SimplnxCore/pipelines/Import_ASCII.d3dpipeline
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"args": {
"cell_data_name": "CellData",
"dimensions": [
189,
201,
1
60,
40,
100
],
"geometry_data_path": "[Image Geometry]",
"origin": [
Expand All @@ -33,54 +33,36 @@
{
"args": {
"created_data_group": "",
"selected_data_group": "[Image Geometry]/CellData",
"tuple_dimensions": [
[
1.0,
201.0,
189.0
]
],
"use_existing_group": true,
"wizard_data": {
"Begin Index": 33,
"Comma As Delimiter": false,
"Consecutive Delimiters": true,
"Data Headers": [
"read_csv_data": {
"Consecutive Delimiters": false,
"Custom Headers": [
"phi1",
"Phi",
"phi2",
"x",
"y",
"Image Quality",
"Confidence Index",
"Phase",
"SEM Signal",
"Fit"
"phi2"
],
"Data Types": [
8,
8,
8,
8,
8,
8,
8,
4,
8,
8
],
"Delimiters": [
32
","
],
"Header Line": 1,
"Header Mode": 1,
"Input File Path": "Data/Small_IN100/Slice_1.ang",
"Number of Lines": 38021,
"Semicolon As Delimiter": false,
"Space As Delimiter": true,
"Tab As Delimiter": false
}
"Input File Path": "C:/Users/alejo/Downloads/DREAM3DNX-7.0.0-RC-7-UDRI-20231027.2-windows-AMD64/DREAM3DNX-7.0.0-RC-7-UDRI-20231027.2-windows-AMD64/Data/ASCIIData/EulersRotated.csv",
"Skipped Array Mask": [
false,
false,
false
],
"Start Import Row": 1,
"Tuple Dimensions": [
480001
]
},
"selected_data_group": "[Image Geometry]/CellData",
"use_existing_group": true
},
"comments": "",
"filter": {
Expand All @@ -91,7 +73,7 @@
},
{
"args": {
"move_values": false,
"move_values": true,
"normalize_data": false,
"selected_data_array_paths": [
"[Image Geometry]/CellData/phi1",
Expand All @@ -107,21 +89,6 @@
},
"isDisabled": false
},
{
"args": {
"removed_data_path": [
"[Image Geometry]/CellData/phi1",
"[Image Geometry]/CellData/Phi",
"[Image Geometry]/CellData/phi2"
]
},
"comments": "",
"filter": {
"name": "simplnx::DeleteData",
"uuid": "bf286740-e987-49fe-a7c8-6e566e3a0606"
},
"isDisabled": false
},
{
"args": {
"cell_ensemble_attribute_matrix_name": "[Image Geometry]/CellEnsembleData",
Expand All @@ -143,11 +110,32 @@
},
"isDisabled": false
},
{
"args": {
"advanced_options": true,
"component_count": 1,
"data_format": "",
"initialization_value": "1",
"numeric_type": 4,
"output_data_array": "[Image Geometry]/CellData/Phases",
"tuple_dimensions": [
[
0.0
]
]
},
"comments": "",
"filter": {
"name": "complex::CreateDataArray",
"uuid": "67041f9b-bdc6-4122-acc6-c9fe9280e90d"
},
"isDisabled": false
},
{
"args": {
"cell_euler_angles_array_path": "[Image Geometry]/CellData/Eulers",
"cell_ipf_colors_array_name": "IPFColors",
"cell_phases_array_path": "[Image Geometry]/CellData/Phase",
"cell_phases_array_path": "[Image Geometry]/CellData/Phases",
"crystal_structures_array_path": "[Image Geometry]/CellEnsembleData/CrystalStructures",
"mask_array_path": "",
"reference_dir": [
Expand Down Expand Up @@ -192,5 +180,6 @@
"isDisabled": true
}
],
"version": 1,
"workflowParams": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ Result<ReadVolumeGraphicsFileFilter::HeaderMetadata> ReadHeaderMetaData(const st
return {metadata};
}

struct ImportVolumeGraphicsFileFilterCache
struct ReadVolumeGraphicsFileFilterCache
{
fs::path VgiDataFilePath;
};

std::atomic_int32_t s_InstanceId = 0;
std::map<int32, ImportVolumeGraphicsFileFilterCache> s_HeaderCache;
std::map<int32, ReadVolumeGraphicsFileFilterCache> s_HeaderCache;

} // namespace

Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/TestOne/test/ErrorWarningFilterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constexpr int32 k_ExecuteWarning = -666000;
constexpr int32 k_ExecuteError = -666001;
} // namespace

TEST_CASE("ErrorWarningFilter: Instantiate Filter", "[ErrorWarningFilter]")
TEST_CASE("ErrorWarningFilter::Instantiate Filter", "[ErrorWarningFilter]")
{
DataStructure dataStructure;

Expand Down
Loading

0 comments on commit f282e77

Please sign in to comment.