Skip to content

Commit

Permalink
Merge pull request #1111 from thewtex/transform-io
Browse files Browse the repository at this point in the history
docs: add TransformList, Transform LinkML model
  • Loading branch information
thewtex authored Jul 2, 2024
2 parents 9ab6074 + 3005861 commit cf79eca
Show file tree
Hide file tree
Showing 32 changed files with 2,756 additions and 562 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/cxx-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ env:

jobs:
cxx-build-workflow:
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
# itk-wasm branch
uses: thewtex/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-cxx.yml@6868c9879405def5d7532e0437b57e78cbe0b6ea
with:
itk-module-deps: '[email protected]'
ctest-options: '-E itkPipelineTest'

python-build-workflow:
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
with:
itk-module-deps: 'InsightSoftwareConsortium/[email protected]'
secrets:
pypi_password: ${{ secrets.pypi_password }}
#python-build-workflow:
## itk-wasm branch
#uses: thewtex/ITKRemoteModuleBuildTestPackageAction/.github/workflows/build-test-package-python.yml@6868c9879405def5d7532e0437b57e78cbe0b6ea
#with:
#itk-module-deps: 'InsightSoftwareConsortium/[email protected]'
#manylinux-platforms: '["_2_28-x64","_2_28-aarch64"]'
#secrets:
#pypi_password: ${{ secrets.pypi_password }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,5 @@ cypress/screenshots/
cypress/videos/

packages/core/typescript/itk-wasm/dist

CMakePresets.json
34 changes: 11 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,6 @@ endif()

set(WebAssemblyInterface_LIBRARIES WebAssemblyInterface)

option(BUILD_ITK_WASM_IO_MODULES "Build the itk-wasm ImageIO's and MeshIO's" OFF)
if(BUILD_ITK_WASM_IO_MODULES)
set(WebAssemblyInterface_MeshIOModules
"ITKIOMeshBYU"
"ITKIOMeshFreeSurfer"
"ITKIOMeshOBJ"
"ITKIOMeshOFF"
"IOMeshSTL"
"IOMeshSWC"
"ITKIOMeshVTK"
CACHE STRING
"String delimited list of ITK mesh IO modules to support.")
set(meshios_ITKIOMeshBYU itkBYUMeshIO)
set(meshios_ITKIOMeshFreeSurfer itkFreeSurferAsciiMeshIO itkFreeSurferBinaryMeshIO)
set(meshios_ITKIOMeshVTK itkVTKPolyDataMeshIO)
set(meshios_ITKIOMeshOBJ itkOBJMeshIO)
set(meshios_ITKIOMeshOFF itkOFFMeshIO)
set(meshios_IOMeshSTL itkSTLMeshIO)
set(meshios_IOMeshSWC itkSWCMeshIO)
endif()

include(FetchContent)
set(_itk_build_testing ${BUILD_TESTING})
set(BUILD_TESTING OFF)
Expand Down Expand Up @@ -100,14 +79,23 @@ FetchContent_Declare(
)

set(glaze_GIT_REPOSITORY "https://github.com/stephenberry/glaze")
# glaze v2.6.9
set(glaze_GIT_TAG 6bcc20ce7eb59df60b94488a4f6be723731db00e)
# glaze v2.9.3
set(glaze_GIT_TAG fe49c8e1a057d11484e0bd88ffcbe60277e356fd)
FetchContent_Declare(
glaze
GIT_REPOSITORY ${glaze_GIT_REPOSITORY}
GIT_TAG ${glaze_GIT_TAG}
GIT_SHALLOW TRUE
)
if (MSVC)
string(REGEX MATCH "\/cl(.exe)?$" matched_cl ${CMAKE_CXX_COMPILER})
if (matched_cl)
# for a C++ standards compliant preprocessor, not needed for clang-cl
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor /permissive- /Zc:lambda")
endif()
# avoid warnings
set(CMAKE_CXX_STANDARD 23)
endif()

list(APPEND CMAKE_MODULE_PATH ${libcbor_SOURCE_DIR}/CMakeModules)
FetchContent_MakeAvailable(rapidjson_lib cli11 rang libcbor cpp_base64 glaze)
Expand Down
1 change: 1 addition & 0 deletions ITKKWStyleOverwrite.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ itkSupportInputImageTypesMemoryIOTest\.cxx Namespace Disable
itkSupportInputMeshTypesTest\.cxx Namespace Disable
itkSupportInputMeshTypesMemoryIOTest\.cxx Namespace Disable
itkSupportInputPolyDataTypesTest\.cxx Namespace Disable
itkFloatTypesJSON\.h Namespace Disable
42 changes: 42 additions & 0 deletions include/itkFloatTypesJSON.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkFloatTypesJSON_h
#define itkFloatTypesJSON_h

#include <vector>

#include "glaze/glaze.hpp"

namespace itk
{
enum class JSONFloatTypesEnum
{
float32,
float64,
};
} // end namespace itk

template <>
struct glz::meta<itk::JSONFloatTypesEnum> {
using enum itk::JSONFloatTypesEnum;
static constexpr auto value = glz::enumerate(float32,
float64
);
};

#endif // itkFloatTypesJSON_h
9 changes: 5 additions & 4 deletions include/itkInputMeshIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "itkPipeline.h"
#include "itkWasmMeshIOBase.h"
#include "itkWasmMeshIO.h"
#include "itkWasmIOCommon.h"

#ifndef ITK_WASM_NO_MEMORY_IO
#include "itkWasmExports.h"
Expand Down Expand Up @@ -87,15 +88,15 @@ bool lexical_cast(const std::string &input, InputMeshIO &inputMeshIO)
const std::string pointsString( pointsJson.GetString() );
const char * pointsPtr = reinterpret_cast< char * >( std::strtoull(pointsString.substr(35).c_str(), nullptr, 10) );
WasmMeshIOBase::DataContainerType * pointsContainer = wasmMeshIOBase->GetPointsContainer();
SizeValueType numberOfBytes = wasmMeshIO->GetNumberOfPoints() * wasmMeshIO->GetPointDimension() * WasmMeshIO::ITKComponentSize( wasmMeshIO->GetPointComponentType() );
SizeValueType numberOfBytes = wasmMeshIO->GetNumberOfPoints() * wasmMeshIO->GetPointDimension() * ITKComponentSize( wasmMeshIO->GetPointComponentType() );
pointsContainer->resize(numberOfBytes);
pointsContainer->assign(pointsPtr, pointsPtr + numberOfBytes);

const rapidjson::Value & cellsJson = document["cells"];
const std::string cellsString( cellsJson.GetString() );
const char * cellsPtr = reinterpret_cast< char * >( std::strtoull(cellsString.substr(35).c_str(), nullptr, 10) );
WasmMeshIOBase::DataContainerType * cellsContainer = wasmMeshIOBase->GetCellsContainer();
numberOfBytes = static_cast< SizeValueType >( wasmMeshIO->GetCellBufferSize() * WasmMeshIO::ITKComponentSize( wasmMeshIO->GetCellComponentType() ));
numberOfBytes = static_cast< SizeValueType >( wasmMeshIO->GetCellBufferSize() * ITKComponentSize( wasmMeshIO->GetCellComponentType() ));
cellsContainer->resize(numberOfBytes);
cellsContainer->assign(cellsPtr, cellsPtr + numberOfBytes);

Expand All @@ -105,7 +106,7 @@ bool lexical_cast(const std::string &input, InputMeshIO &inputMeshIO)
WasmMeshIOBase::DataContainerType * pointDataContainer = wasmMeshIOBase->GetPointDataContainer();
numberOfBytes =
static_cast< SizeValueType >(
wasmMeshIO->GetNumberOfPointPixels() * wasmMeshIO->GetNumberOfPointPixelComponents() * WasmMeshIO::ITKComponentSize( wasmMeshIO->GetPointPixelComponentType() )
wasmMeshIO->GetNumberOfPointPixels() * wasmMeshIO->GetNumberOfPointPixelComponents() * ITKComponentSize( wasmMeshIO->GetPointPixelComponentType() )
);
pointDataContainer->resize(numberOfBytes);
pointDataContainer->assign(pointDataPtr, pointDataPtr + numberOfBytes);
Expand All @@ -116,7 +117,7 @@ bool lexical_cast(const std::string &input, InputMeshIO &inputMeshIO)
WasmMeshIOBase::DataContainerType * cellDataContainer = wasmMeshIOBase->GetCellDataContainer();
numberOfBytes =
static_cast< SizeValueType >(
wasmMeshIO->GetNumberOfPointPixels() * wasmMeshIO->GetNumberOfPointPixelComponents() * WasmMeshIO::ITKComponentSize( wasmMeshIO->GetPointPixelComponentType() )
wasmMeshIO->GetNumberOfPointPixels() * wasmMeshIO->GetNumberOfPointPixelComponents() * ITKComponentSize( wasmMeshIO->GetPointPixelComponentType() )
);
cellDataContainer->resize(numberOfBytes);
cellDataContainer->assign(cellDataPtr, cellDataPtr + numberOfBytes);
Expand Down
Loading

0 comments on commit cf79eca

Please sign in to comment.