From df5aa7f2676db88267e3c1dbf9fd9f818ad0a434 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Tue, 30 Aug 2022 14:16:06 -0400 Subject: [PATCH] style(Pipelines): Use dash delimited names for name and positional args For consistency with long name options. --- .github/workflows/javascript-typescript.yml | 2 +- .gitignore | 22 +++++++++--------- cypress/e2e/core/web_worker_pool.cy.ts | 2 +- doc/content/docs/interface_types.md | 2 +- include/itkSupportInputImageTypes.h | 6 ++--- .../itkSupportInputImageTypesNoVectorImage.h | 6 ++--- include/itkSupportInputMeshTypes.h | 6 ++--- include/itkSupportInputPolyDataTypes.h | 4 ++-- package.json | 4 ++-- src/CMakeLists.txt | 12 +++++----- src/build-emscripten.js | 8 +++---- src/build-wasi.js | 8 +++---- .../internal/loadEmscriptenModuleWebWorker.ts | 8 ++++++- src/docker/itk-wasm/Dockerfile | 2 +- .../itk-wasm/ITKWebAssemblyInterface.cmake | 14 ++++++++++- src/docker/itk-wasm/build.sh | 6 ++--- src/docker/itk-wasm/populate-cache.sh | 4 ++-- .../BuildZstd.cmake | 0 .../CMakeLists.txt | 18 +++++++------- .../compress-stringify.cxx} | 8 +++---- .../parse-string-decompress.cxx} | 10 ++++---- .../CMakeLists.txt | 12 +++++----- .../itkWASMZstdImageIO.cxx | 0 .../itkWASMZstdImageIO.h | 0 .../read-image.cxx} | 4 ++-- .../write-image.cxx} | 6 ++--- .../{ReadDICOM => read-dicom}/CMakeLists.txt | 20 ++++++++-------- .../read-dicom-tags.cxx} | 4 ++-- .../read-image-dicom-file-series.cxx} | 2 +- .../CMakeLists.txt | 10 ++++---- .../itkWASMZstdMeshIO.cxx | 0 .../itkWASMZstdMeshIO.h | 0 .../read-mesh.cxx} | 6 ++--- .../write-mesh.cxx} | 6 ++--- .../CMakeLists.txt | 14 +++++------ .../mesh-to-polydata.cxx} | 8 +++---- .../polydata-to-mesh.cxx} | 8 +++---- src/io/meshToPolyData.ts | 2 +- src/io/meshToPolyDataNode.ts | 2 +- src/io/polyDataToMesh.ts | 2 +- src/io/polyDataToMeshNode.ts | 2 +- src/io/readDICOMTagsArrayBuffer.ts | 2 +- src/io/readDICOMTagsLocalFile.ts | 2 +- src/io/readImageArrayBuffer.ts | 2 +- src/io/readImageLocalDICOMFileSeries.ts | 2 +- src/io/readImageLocalFile.ts | 4 ++-- src/io/readMeshArrayBuffer.ts | 2 +- src/io/readMeshLocalFile.ts | 4 ++-- src/io/writeImageLocalFile.ts | 4 ++-- src/io/writeMeshLocalFile.ts | 4 ++-- src/web-workers/loadImageIOPipelineModule.ts | 2 +- src/web-workers/loadMeshIOPipelineModule.ts | 2 +- src/web-workers/pipeline.worker.ts | 16 ++++++------- test/browser/core/WebWorkerPoolTest.js | 2 +- test/browser/pipeline/runPipelineTest.js | 18 +++++++------- test/itkPipelineMemoryIOTest.cxx | 22 +++++++++--------- test/itkPipelineTest.cxx | 22 +++++++++--------- .../itkSupportInputImageTypesMemoryIOTest.cxx | 8 +++---- test/itkSupportInputImageTypesTest.cxx | 8 +++---- test/itkSupportInputMeshTypesMemoryIOTest.cxx | 8 +++---- test/itkSupportInputMeshTypesTest.cxx | 8 +++---- test/itkSupportInputPolyDataTypesTest.cxx | 8 +++---- .../node/core/loadEmscriptenModuleNodeTest.js | 4 ++-- test/node/pipeline/runPipelineNodeTest.js | 12 +++++----- .../StdoutStderrPipeline/CMakeLists.txt | 12 ---------- .../CMakeLists.txt | 12 +++++----- .../input-output-files-test.cxx} | 18 +++++++------- .../input.bin | 0 .../input.txt | 0 .../CMakeLists.txt | 10 ++++---- .../cthead1.iwi.cbor | Bin .../median-filter-test.cxx} | 12 +++++----- .../CMakeLists.txt | 16 ++++++------- .../cow.vtk | 0 .../mesh-read-write-test.cxx} | 6 ++--- .../{ReadImage => read-image}/CMakeLists.txt | 10 ++++---- .../{ReadImage => read-image}/cthead1.png | Bin .../read-image.cxx} | 0 .../stdout-stderr-pipeline/CMakeLists.txt | 12 ++++++++++ .../stdout-stderr-test.cxx} | 0 80 files changed, 276 insertions(+), 258 deletions(-) rename src/io/internal/pipelines/common/{CompressStringify => compress-stringify}/BuildZstd.cmake (100%) rename src/io/internal/pipelines/common/{CompressStringify => compress-stringify}/CMakeLists.txt (62%) rename src/io/internal/pipelines/common/{CompressStringify/CompressStringify.cxx => compress-stringify/compress-stringify.cxx} (88%) rename src/io/internal/pipelines/common/{CompressStringify/ParseStringDecompress.cxx => compress-stringify/parse-string-decompress.cxx} (84%) rename src/io/internal/pipelines/image/{ConvertImage => convert-image}/CMakeLists.txt (95%) rename src/io/internal/pipelines/image/{ConvertImage => convert-image}/itkWASMZstdImageIO.cxx (100%) rename src/io/internal/pipelines/image/{ConvertImage => convert-image}/itkWASMZstdImageIO.h (100%) rename src/io/internal/pipelines/image/{ConvertImage/ReadImage.cxx => convert-image/read-image.cxx} (95%) rename src/io/internal/pipelines/image/{ConvertImage/WriteImage.cxx => convert-image/write-image.cxx} (96%) rename src/io/internal/pipelines/image/{ReadDICOM => read-dicom}/CMakeLists.txt (82%) rename src/io/internal/pipelines/image/{ReadDICOM/ReadDICOMTags.cxx => read-dicom/read-dicom-tags.cxx} (98%) rename src/io/internal/pipelines/image/{ReadDICOM/ReadImageDICOMFileSeries.cxx => read-dicom/read-image-dicom-file-series.cxx} (99%) rename src/io/internal/pipelines/mesh/{ConvertMesh => convert-mesh}/CMakeLists.txt (93%) rename src/io/internal/pipelines/mesh/{ConvertMesh => convert-mesh}/itkWASMZstdMeshIO.cxx (100%) rename src/io/internal/pipelines/mesh/{ConvertMesh => convert-mesh}/itkWASMZstdMeshIO.h (100%) rename src/io/internal/pipelines/mesh/{ConvertMesh/ReadMesh.cxx => convert-mesh/read-mesh.cxx} (91%) rename src/io/internal/pipelines/mesh/{ConvertMesh/WriteMesh.cxx => convert-mesh/write-mesh.cxx} (95%) rename src/io/internal/pipelines/mesh/{MeshToPolyData => mesh-to-polydata}/CMakeLists.txt (67%) rename src/io/internal/pipelines/mesh/{MeshToPolyData/MeshToPolyData.cxx => mesh-to-polydata/mesh-to-polydata.cxx} (84%) rename src/io/internal/pipelines/mesh/{MeshToPolyData/PolyDataToMesh.cxx => mesh-to-polydata/polydata-to-mesh.cxx} (82%) delete mode 100644 test/pipelines/StdoutStderrPipeline/CMakeLists.txt rename test/pipelines/{InputOutputFilesPipeline => input-output-files-pipeline}/CMakeLists.txt (72%) rename test/pipelines/{InputOutputFilesPipeline/InputOutputFilesTest.cxx => input-output-files-pipeline/input-output-files-test.cxx} (85%) rename test/pipelines/{InputOutputFilesPipeline => input-output-files-pipeline}/input.bin (100%) rename test/pipelines/{InputOutputFilesPipeline => input-output-files-pipeline}/input.txt (100%) rename test/pipelines/{MedianFilterPipeline => median-filter-pipeline}/CMakeLists.txt (61%) rename test/pipelines/{MedianFilterPipeline => median-filter-pipeline}/cthead1.iwi.cbor (100%) rename test/pipelines/{MedianFilterPipeline/MedianFilterTest.cxx => median-filter-pipeline/median-filter-test.cxx} (90%) rename test/pipelines/{MeshReadWritePipeline => mesh-read-write-pipeline}/CMakeLists.txt (55%) rename test/pipelines/{MeshReadWritePipeline => mesh-read-write-pipeline}/cow.vtk (100%) rename test/pipelines/{MeshReadWritePipeline/MeshReadWriteTest.cxx => mesh-read-write-pipeline/mesh-read-write-test.cxx} (80%) rename test/pipelines/{ReadImage => read-image}/CMakeLists.txt (53%) rename test/pipelines/{ReadImage => read-image}/cthead1.png (100%) rename test/pipelines/{ReadImage/ReadImage.cxx => read-image/read-image.cxx} (100%) create mode 100644 test/pipelines/stdout-stderr-pipeline/CMakeLists.txt rename test/pipelines/{StdoutStderrPipeline/StdoutStderrTest.cxx => stdout-stderr-pipeline/stdout-stderr-test.cxx} (100%) diff --git a/.github/workflows/javascript-typescript.yml b/.github/workflows/javascript-typescript.yml index b8faaa625..a3d720a24 100644 --- a/.github/workflows/javascript-typescript.yml +++ b/.github/workflows/javascript-typescript.yml @@ -56,7 +56,7 @@ jobs: - name: Test building a pipeline run: | - cd test/pipelines/MedianFilterPipeline + cd test/pipelines/median-filter-pipeline node ../../../src/itk-wasm-cli.js build -i itkwasm/emscripten:latest . rm -rf web-build diff --git a/.gitignore b/.gitignore index 1c2a1deaf..ba5d72e74 100644 --- a/.gitignore +++ b/.gitignore @@ -29,19 +29,19 @@ examples/UMD/package-lock.json examples/Webpack/package-lock.json examples/Webpack/cypress/videos/ -test/MedianFilterPipeline/itk-wasm -test/pipelines/MedianFilterPipeline/web-build -test/pipelines/MedianFilterPipeline/wasi-build -src/docker/itk-wasm/MedianFilterPipelineCopy/ +test/median-filter-pipeline/itk-wasm +test/pipelines/median-filter-pipeline/web-build +test/pipelines/median-filter-pipeline/wasi-build +src/docker/itk-wasm/median-filter-pipelineCopy/ src/docker/itk-wasm/ITKWebAssemblyInterfaceModuleCopy/ -test/StdoutStderrPipeline/itk-wasm -test/pipelines/StdoutStderrPipeline/web-build/ -test/pipelines/InputOutputFilesPipeline/web-build/ -test/pipelines/MeshReadWritePipeline/web-build/ -test/pipelines/StdoutStderrPipeline/wasi-build/ -test/pipelines/InputOutputFilesPipeline/wasi-build/ -test/pipelines/MeshReadWritePipeline/wasi-build/ +test/stdout-stderr-pipeline/itk-wasm +test/pipelines/stdout-stderr-pipeline/web-build/ +test/pipelines/input-output-files-pipeline/web-build/ +test/pipelines/mesh-read-write-pipeline/web-build/ +test/pipelines/stdout-stderr-pipeline/wasi-build/ +test/pipelines/input-output-files-pipeline/wasi-build/ +test/pipelines/mesh-read-write-pipeline/wasi-build/ cypress/screenshots/ cypress/videos/ diff --git a/cypress/e2e/core/web_worker_pool.cy.ts b/cypress/e2e/core/web_worker_pool.cy.ts index 5c518e1bb..9690de34e 100644 --- a/cypress/e2e/core/web_worker_pool.cy.ts +++ b/cypress/e2e/core/web_worker_pool.cy.ts @@ -28,7 +28,7 @@ describe('WebWorkerPool', () => { const taskArgsArray = [] for (let index = 0; index < maxTotalSplits; index++) { - const pipelinePath = 'MedianFilterTest' + const pipelinePath = 'median-filter-test' const args = ['--memory-io', '0', '0', '--radius', '4', '-m', '' + maxTotalSplits, '-s', '' + index] const desiredOutputs = [ { type: itk.InterfaceTypes.Image } diff --git a/doc/content/docs/interface_types.md b/doc/content/docs/interface_types.md index ffe88e126..91622d96f 100644 --- a/doc/content/docs/interface_types.md +++ b/doc/content/docs/interface_types.md @@ -24,7 +24,7 @@ The following [`itk::wasm::Pipeline`](https://github.com/InsightSoftwareConsorti int main(argc, char * argv[]) { - itk::wasm::Pipeline pipeline("TestPipeline", "A test ITK WASM Pipeline", argc, argv); + itk::wasm::Pipeline pipeline("test-pipeline", "A test ITK WASM Pipeline", argc, argv); itk::wasm::InputTextStream inputTextStream; pipeline.add_option("InputText", inputTextStream, "The input text")->required()->type_name("INPUT_TEXT"); diff --git a/include/itkSupportInputImageTypes.h b/include/itkSupportInputImageTypes.h index 39c267b97..c7111b7b6 100644 --- a/include/itkSupportInputImageTypes.h +++ b/include/itkSupportInputImageTypes.h @@ -66,7 +66,7 @@ class PipelineFunctor using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image")->required(); + pipeline.add_option("input-image", inputImage, "The input image")->required(); ``` [...] @@ -74,14 +74,14 @@ class PipelineFunctor int main(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("Test supporting multiple input image types", argc, argv); + itk::wasm::Pipeline pipeline("support-multiple", "Test supporting multiple input image types", argc, argv); // Supports the pixels types uint8_t, float // Supports the image dimensions 2, 3 return itk::wasm::SupportInputImageTypes - ::Dimensions<2U,3U>("InputImage", pipeline); + ::Dimensions<2U,3U>("input-image", pipeline); } ``` * diff --git a/include/itkSupportInputImageTypesNoVectorImage.h b/include/itkSupportInputImageTypesNoVectorImage.h index a78a2ac43..3502c765d 100644 --- a/include/itkSupportInputImageTypesNoVectorImage.h +++ b/include/itkSupportInputImageTypesNoVectorImage.h @@ -66,7 +66,7 @@ class PipelineFunctor using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image")->required(); + pipeline.add_option("input-image", inputImage, "The input image")->required(); ``` [...] @@ -74,14 +74,14 @@ class PipelineFunctor int main(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("Test supporting multiple input image types", argc, argv); + itk::wasm::Pipeline pipeline("support-multiple", "Test supporting multiple input image types", argc, argv); // Supports the pixels types uint8_t, float // Supports the image dimensions 2, 3 return itk::wasm::SupportInputImageTypesNoVectorImage - ::Dimensions<2U,3U>("InputImage", pipeline); + ::Dimensions<2U,3U>("input-image", pipeline); } ``` * diff --git a/include/itkSupportInputMeshTypes.h b/include/itkSupportInputMeshTypes.h index 9248c2171..6110526eb 100644 --- a/include/itkSupportInputMeshTypes.h +++ b/include/itkSupportInputMeshTypes.h @@ -65,7 +65,7 @@ class PipelineFunctor using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "The input mesh")->required(); + pipeline.add_option("input-mesh", inputMesh, "The input mesh")->required(); ``` [...] @@ -73,14 +73,14 @@ class PipelineFunctor int main(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("Test supporting multiple input mesh types", argc, argv); + itk::wasm::Pipeline pipeline("support-multiple", "Test supporting multiple input mesh types", argc, argv); // Supports the pixels types uint8_t, float // Supports the mesh dimensions 2, 3 return itk::wasm::SupportInputMeshTypes - ::Dimensions<2U,3U>("InputMesh", pipeline); + ::Dimensions<2U,3U>("input-mesh", pipeline); } ``` * It is assumed that the cell and point data will have the same pixel type. diff --git a/include/itkSupportInputPolyDataTypes.h b/include/itkSupportInputPolyDataTypes.h index 1c397c350..d2a0a38b1 100644 --- a/include/itkSupportInputPolyDataTypes.h +++ b/include/itkSupportInputPolyDataTypes.h @@ -72,11 +72,11 @@ class PipelineFunctor int main(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("TestPipeline", "Test supporting multiple input polydata types", argc, argv); + itk::wasm::Pipeline pipeline("support-multiple", "Test supporting multiple input polydata types", argc, argv); // Supports the pixels types uint8_t, float return itk::wasm::SupportInputPolyDataTypes - ::PixelTypes("InputPolyData", pipeline); + ::PixelTypes("input-polydata", pipeline); } ``` * It is assumed that the cell and point data will have the same pixel type. diff --git a/package.json b/package.json index dfe5593cc..75ec07868 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "test": "npm run test:lint && npm run test:node && npm run test:browser && npm run test:chrome && npm run test:firefox", "test:lint": "ts-standard --fix \"src/**/*.ts\" && standard --fix \"test/**/*.js\"", "test:node": "ava test/node/core/*.js test/node/io/image/*.js test/node/io/mesh/*.js test/node/pipeline/*.js", - "test:cliRun": "node src/itk-wasm-cli.js -b wasi-build -s ./test/pipelines/StdoutStderrPipeline run -r wasmtime StdoutStderrTest.wasi.wasm", - "test:cliTest": "node src/itk-wasm-cli.js -b wasi-build -s ./test/pipelines/StdoutStderrPipeline test", + "test:cliRun": "node src/itk-wasm-cli.js -b wasi-build -s ./test/pipelines/stdout-stderr-pipeline run -r wasmtime stdout-stderr-test.wasi.wasm", + "test:cliTest": "node src/itk-wasm-cli.js -b wasi-build -s ./test/pipelines/stdout-stderr-pipeline test", "test:browser": "karma start ./karma.conf.cjs", "test:browser:debug": "karma start ./karma.conf.cjs --no-single-run", "test:browser:debug:cypress": "start-server-and-test start http-get://localhost:8083 cypress:open", diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d14e9f69a..1ed66a44d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,11 +35,11 @@ if(EMSCRIPTEN) set(esm_link_flags " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0") endif() -include(${CMAKE_CURRENT_SOURCE_DIR}/io/internal/pipelines/common/CompressStringify/BuildZstd.cmake) -add_subdirectory(io/internal/pipelines/common/CompressStringify) -add_subdirectory(io/internal/pipelines/image/ConvertImage) -add_subdirectory(io/internal/pipelines/image/ReadDICOM) -add_subdirectory(io/internal/pipelines/mesh/ConvertMesh) -add_subdirectory(io/internal/pipelines/mesh/MeshToPolyData) +include(${CMAKE_CURRENT_SOURCE_DIR}/io/internal/pipelines/common/compress-stringify/BuildZstd.cmake) +add_subdirectory(io/internal/pipelines/common/compress-stringify) +add_subdirectory(io/internal/pipelines/image/convert-image) +add_subdirectory(io/internal/pipelines/image/read-dicom) +add_subdirectory(io/internal/pipelines/mesh/convert-mesh) +add_subdirectory(io/internal/pipelines/mesh/mesh-to-polydata) endif() # BUILD_ITK_WASM_IO_MODULES diff --git a/src/build-emscripten.js b/src/build-emscripten.js index 9fa6cbe8d..19b633b8e 100644 --- a/src/build-emscripten.js +++ b/src/build-emscripten.js @@ -169,10 +169,10 @@ if (options.copyBuildArtifacts) { } // options.copySources const testPipelines = [ - path.join('test', 'pipelines', 'StdoutStderrPipeline'), - path.join('test', 'pipelines', 'MedianFilterPipeline'), - path.join('test', 'pipelines', 'InputOutputFilesPipeline'), - path.join('test', 'pipelines', 'MeshReadWritePipeline'), + path.join('test', 'pipelines', 'stdout-stderr-pipeline'), + path.join('test', 'pipelines', 'median-filter-pipeline'), + path.join('test', 'pipelines', 'input-output-files-pipeline'), + path.join('test', 'pipelines', 'mesh-read-write-pipeline'), ] if (options.buildTestPipelines) { diff --git a/src/build-wasi.js b/src/build-wasi.js index 5cc34fbfb..7e7cd5f48 100644 --- a/src/build-wasi.js +++ b/src/build-wasi.js @@ -153,10 +153,10 @@ if (options.copyBuildArtifacts) { } // options.copySources const testPipelines = [ - path.join('test', 'pipelines', 'StdoutStderrPipeline'), - path.join('test', 'pipelines', 'MedianFilterPipeline'), - path.join('test', 'pipelines', 'InputOutputFilesPipeline'), - path.join('test', 'pipelines', 'MeshReadWritePipeline'), + path.join('test', 'pipelines', 'stdout-stderr-pipeline'), + path.join('test', 'pipelines', 'median-filter-pipeline'), + path.join('test', 'pipelines', 'input-output-files-pipeline'), + path.join('test', 'pipelines', 'mesh-read-write-pipeline'), ] if (options.buildTestPipelines) { diff --git a/src/core/internal/loadEmscriptenModuleWebWorker.ts b/src/core/internal/loadEmscriptenModuleWebWorker.ts index eb31c7892..9d0fff6ea 100644 --- a/src/core/internal/loadEmscriptenModuleWebWorker.ts +++ b/src/core/internal/loadEmscriptenModuleWebWorker.ts @@ -2,6 +2,12 @@ import axios from 'axios' import ITKWASMEmscriptenModule from '../ITKWASMEmscriptenModule.js' +function camelCase(kebobCase: string) { + return kebobCase.replace(/-([a-z])/g, (kk) => { + return kk[1].toUpperCase(); + }); +} + // Load the Emscripten module in the browser in a WebWorker. // // baseUrl is usually taken from '../itkConfig.js', but a different value @@ -29,7 +35,7 @@ async function loadEmscriptenModuleWebWorker(moduleRelativePathOrURL: string | U const wasmBinary = response.data const modulePath = `${modulePrefix}.umd.js` importScripts(modulePath) - const moduleBaseName: string = modulePrefix.replace(/.*\//, '') + const moduleBaseName: string = camelCase(modulePrefix.replace(/.*\//, '')) // @ts-ignore: error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'WorkerGlobalScope & typeof globalThis'. const wrapperModule = self[moduleBaseName] as (moduleParams: object) => object const emscriptenModule = wrapperModule({ wasmBinary }) as ITKWASMEmscriptenModule diff --git a/src/docker/itk-wasm/Dockerfile b/src/docker/itk-wasm/Dockerfile index 99aa37a67..efaaa1b90 100644 --- a/src/docker/itk-wasm/Dockerfile +++ b/src/docker/itk-wasm/Dockerfile @@ -39,7 +39,7 @@ RUN cd / && \ COPY web-build /usr/local/bin/ # Trigger Emscripten to cache builds of required system libraries -ADD MedianFilterPipelineCopy /MedianFilterPipelineCopy +ADD median-filter-pipelineCopy /median-filter-pipelineCopy ADD populate-cache.sh /usr/local/bin/populate-cache.sh RUN /usr/local/bin/populate-cache.sh && rm /usr/local/bin/populate-cache.sh diff --git a/src/docker/itk-wasm/ITKWebAssemblyInterface.cmake b/src/docker/itk-wasm/ITKWebAssemblyInterface.cmake index 575ab9e1b..a2a8adecd 100644 --- a/src/docker/itk-wasm/ITKWebAssemblyInterface.cmake +++ b/src/docker/itk-wasm/ITKWebAssemblyInterface.cmake @@ -5,6 +5,17 @@ set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT 17) if(NOT _ITKWebAssemblyInterface_INCLUDED) +function(kebab_to_camel kebab camel) + set(result "${kebab}") + while(result MATCHES "-([a-z])") + string(REGEX MATCH "-([a-z])" post_dash "${result}") + string(SUBSTRING "${post_dash}" 1 1 post_dash) + string(TOUPPER "${post_dash}" post_dash_upper) + string(REGEX REPLACE "(-${post_dash})" "${post_dash_upper}" result "${result}") + endwhile() + set(${camel} "${result}" PARENT_SCOPE) +endfunction() + set(_target_link_libraries target_link_libraries) function(target_link_libraries target) _target_link_libraries(${target} ${ARGN}) @@ -34,8 +45,9 @@ function(add_executable target) set(umd_target ${wasm_target}.umd) _add_executable(${umd_target} ${ARGN}) + kebab_to_camel(${target} targetCamel) get_property(_link_flags TARGET ${target} PROPERTY LINK_FLAGS) - set(common_link_flags " -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS='[\"callMain\",\"cwrap\",\"ccall\",\"writeArrayToMemory\",\"writeAsciiToMemory\",\"AsciiToString\"]' -flto -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -lnodefs.js -s WASM_ASYNC_COMPILATION=1 -s EXPORT_NAME=${target} -s MODULARIZE=1 -s EXIT_RUNTIME=0 -s INVOKE_RUN=0 --pre-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPipelinePre.js --post-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPost.js -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORTED_FUNCTIONS='[\"_main\"]' ${_link_flags}") + set(common_link_flags " -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS='[\"callMain\",\"cwrap\",\"ccall\",\"writeArrayToMemory\",\"writeAsciiToMemory\",\"AsciiToString\"]' -flto -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -lnodefs.js -s WASM_ASYNC_COMPILATION=1 -s EXPORT_NAME=${targetCamel} -s MODULARIZE=1 -s EXIT_RUNTIME=0 -s INVOKE_RUN=0 --pre-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPipelinePre.js --post-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPost.js -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORTED_FUNCTIONS='[\"_main\"]' ${_link_flags}") set_property(TARGET ${wasm_target} PROPERTY LINK_FLAGS "${common_link_flags} -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0") set_property(TARGET ${umd_target} PROPERTY LINK_FLAGS "${common_link_flags}") diff --git a/src/docker/itk-wasm/build.sh b/src/docker/itk-wasm/build.sh index f2c2b5ba6..347b2af45 100755 --- a/src/docker/itk-wasm/build.sh +++ b/src/docker/itk-wasm/build.sh @@ -10,8 +10,8 @@ mkdir -p ITKWebAssemblyInterfaceModuleCopy rsync -a ../../../{include,CMakeLists.txt,itk-module.cmake} ./ITKWebAssemblyInterfaceModuleCopy/ rsync -a ../../../src/{*.cxx,CMakeLists.txt} ./ITKWebAssemblyInterfaceModuleCopy/src/ rsync -a ../../../src/emscripten-module ./ITKWebAssemblyInterfaceModuleCopy/src/ -mkdir -p MedianFilterPipelineCopy -rsync -a ../../../test/pipelines/MedianFilterPipeline/{CMakeLists.txt,MedianFilterTest.cxx} ./MedianFilterPipelineCopy +mkdir -p median-filter-pipelineCopy +rsync -a ../../../test/pipelines/median-filter-pipeline/{CMakeLists.txt,median-filter-test.cxx} ./median-filter-pipelineCopy TAG=$(date '+%Y%m%d')-$(git rev-parse --short HEAD) VCS_REF=$(git rev-parse --short HEAD) @@ -121,4 +121,4 @@ if $debug; then fi -rm -rf ITKWebAssemblyInterfaceModuleCopy MedianFilterPipelineCopy +rm -rf ITKWebAssemblyInterfaceModuleCopy median-filter-pipelineCopy diff --git a/src/docker/itk-wasm/populate-cache.sh b/src/docker/itk-wasm/populate-cache.sh index 34805c4d4..80123f13e 100755 --- a/src/docker/itk-wasm/populate-cache.sh +++ b/src/docker/itk-wasm/populate-cache.sh @@ -1,7 +1,7 @@ #!/bin/sh if [ $BASE_IMAGE = "itkwasm/emscripten-base" ]; then - cd /MedianFilterPipelineCopy + cd /median-filter-pipelineCopy /usr/local/bin/web-build web-build -DCMAKE_EXE_LINKER_FLAGS='-flto=thin -s DISABLE_EXCEPTION_CATCHING=0' rm -rf ./web-build @@ -11,6 +11,6 @@ if [ $BASE_IMAGE = "itkwasm/emscripten-base" ]; then /usr/local/bin/web-build web-build -DCMAKE_EXE_LINKER_FLAGS='-fno-lto -s DISABLE_EXCEPTION_CATCHING=1' - rm -rf /MedianFilterPipelineCopy + rm -rf /median-filter-pipelineCopy chmod -R 777 /emsdk/upstream/emscripten/cache fi diff --git a/src/io/internal/pipelines/common/CompressStringify/BuildZstd.cmake b/src/io/internal/pipelines/common/compress-stringify/BuildZstd.cmake similarity index 100% rename from src/io/internal/pipelines/common/CompressStringify/BuildZstd.cmake rename to src/io/internal/pipelines/common/compress-stringify/BuildZstd.cmake diff --git a/src/io/internal/pipelines/common/CompressStringify/CMakeLists.txt b/src/io/internal/pipelines/common/compress-stringify/CMakeLists.txt similarity index 62% rename from src/io/internal/pipelines/common/CompressStringify/CMakeLists.txt rename to src/io/internal/pipelines/common/compress-stringify/CMakeLists.txt index d0a230e54..02c7d5456 100644 --- a/src/io/internal/pipelines/common/CompressStringify/CMakeLists.txt +++ b/src/io/internal/pipelines/common/compress-stringify/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(CompressStringify) +project(compress-stringify) set(CMAKE_CXX_STANDARD 17) @@ -20,16 +20,16 @@ FetchContent_MakeAvailable(cpp_base64) find_package(ITK REQUIRED COMPONENTS WebAssemblyInterface) -add_executable(CompressStringify CompressStringify.cxx) -target_include_directories(CompressStringify PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${zstd_lib_INCLUDE_DIR}) -target_link_libraries(CompressStringify PUBLIC libzstd_static cpp-base64 ${ITK_LIBRARIES}) +add_executable(compress-stringify compress-stringify.cxx) +target_include_directories(compress-stringify PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${zstd_lib_INCLUDE_DIR}) +target_link_libraries(compress-stringify PUBLIC libzstd_static cpp-base64 ${ITK_LIBRARIES}) -add_executable(ParseStringDecompress ParseStringDecompress.cxx) -target_include_directories(ParseStringDecompress PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${zstd_lib_INCLUDE_DIR}) -target_link_libraries(ParseStringDecompress PUBLIC libzstd_static cpp-base64 ${ITK_LIBRARIES}) +add_executable(parse-string-decompress parse-string-decompress.cxx) +target_include_directories(parse-string-decompress PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${zstd_lib_INCLUDE_DIR}) +target_link_libraries(parse-string-decompress PUBLIC libzstd_static cpp-base64 ${ITK_LIBRARIES}) if (DEFINED WebAssemblyInterface_SOURCE_DIR AND EMSCRIPTEN) - foreach(target CompressStringify CompressStringify.umd ParseStringDecompress ParseStringDecompress.umd) + foreach(target compress-stringify compress-stringify.umd parse-string-decompress parse-string-decompress.umd) itk_module_target_label(${target}) itk_module_target_export(${target}) itk_module_target_install(${target}) @@ -40,7 +40,7 @@ if (DEFINED WebAssemblyInterface_SOURCE_DIR AND EMSCRIPTEN) endforeach() endif() if (DEFINED WebAssemblyInterface_SOURCE_DIR AND WASI) - foreach(target CompressStringify ParseStringDecompress) + foreach(target compress-stringify parse-string-decompress) itk_module_target_label(${target}) itk_module_target_export(${target}) itk_module_target_install(${target}) diff --git a/src/io/internal/pipelines/common/CompressStringify/CompressStringify.cxx b/src/io/internal/pipelines/common/compress-stringify/compress-stringify.cxx similarity index 88% rename from src/io/internal/pipelines/common/CompressStringify/CompressStringify.cxx rename to src/io/internal/pipelines/common/compress-stringify/compress-stringify.cxx index 76ffd4512..e59167293 100644 --- a/src/io/internal/pipelines/common/CompressStringify/CompressStringify.cxx +++ b/src/io/internal/pipelines/common/compress-stringify/compress-stringify.cxx @@ -34,7 +34,7 @@ int compress(itk::wasm::Pipeline & pipeline, itk::wasm::InputBinaryStream & inputBinaryStream, int compressionLevel) { itk::wasm::OutputBinaryStream outputBinaryStream; - pipeline.add_option("Output", outputBinaryStream, "Output compressed binary"); + pipeline.add_option("output", outputBinaryStream, "Output compressed binary")->type_name("OUTPUT_BINARY_STREAM"); ITK_WASM_PARSE(pipeline); @@ -58,7 +58,7 @@ int compress(itk::wasm::Pipeline & pipeline, itk::wasm::InputBinaryStream & inpu int compressStringify(itk::wasm::Pipeline & pipeline, itk::wasm::InputBinaryStream & inputBinaryStream, int compressionLevel, const std::string & dataURLPrefix) { itk::wasm::OutputTextStream outputTextStream; - pipeline.add_option("Output", outputTextStream, "Output dataURL+base64 compressed binary"); + pipeline.add_option("output", outputTextStream, "Output dataURL+base64 compressed binary")->type_name("OUTPUT_TEXT_STREAM"); ITK_WASM_PARSE(pipeline); @@ -86,10 +86,10 @@ int compressStringify(itk::wasm::Pipeline & pipeline, itk::wasm::InputBinaryStre int main(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("CompressStringify", "Given a binary, compress optionally base64 encode", argc, argv); + itk::wasm::Pipeline pipeline("compress-stringify", "Given a binary, compress optionally base64 encode", argc, argv); itk::wasm::InputBinaryStream inputBinaryStream; - pipeline.add_option("InputBinary", inputBinaryStream, "Input binary"); + pipeline.add_option("input", inputBinaryStream, "Input binary")->type_name("INPUT_BINARY_STREAM"); bool stringify = false; pipeline.add_flag("-s,--stringify", stringify, "Stringify the output"); diff --git a/src/io/internal/pipelines/common/CompressStringify/ParseStringDecompress.cxx b/src/io/internal/pipelines/common/compress-stringify/parse-string-decompress.cxx similarity index 84% rename from src/io/internal/pipelines/common/CompressStringify/ParseStringDecompress.cxx rename to src/io/internal/pipelines/common/compress-stringify/parse-string-decompress.cxx index 84f9b21c6..a625959e9 100644 --- a/src/io/internal/pipelines/common/CompressStringify/ParseStringDecompress.cxx +++ b/src/io/internal/pipelines/common/compress-stringify/parse-string-decompress.cxx @@ -34,10 +34,10 @@ int decompress(itk::wasm::Pipeline & pipeline) { itk::wasm::InputBinaryStream inputBinaryStream; - pipeline.add_option("Input", inputBinaryStream, "Compressed input"); + pipeline.add_option("input", inputBinaryStream, "Compressed input")->type_name("INPUT_BINARY_STREAM"); itk::wasm::OutputBinaryStream outputBinaryStream; - pipeline.add_option("Output", outputBinaryStream, "Output decompressed binary"); + pipeline.add_option("output", outputBinaryStream, "Output decompressed binary")->type_name("OUTPUT_BINARY_STREAM"); ITK_WASM_PARSE(pipeline); @@ -61,10 +61,10 @@ int decompress(itk::wasm::Pipeline & pipeline) int decodeDecompress(itk::wasm::Pipeline & pipeline) { itk::wasm::InputTextStream inputTextStream; - pipeline.add_option("Input", inputTextStream, "Compressed input"); + pipeline.add_option("input", inputTextStream, "Compressed input")->type_name("INPUT_TEXT_STREAM"); itk::wasm::OutputBinaryStream outputBinaryStream; - pipeline.add_option("Output", outputBinaryStream, "Output decompressed binary"); + pipeline.add_option("output", outputBinaryStream, "Output decompressed binary")->type_name("OUTPUT_BINARY_STREAM"); ITK_WASM_PARSE(pipeline); @@ -96,7 +96,7 @@ int decodeDecompress(itk::wasm::Pipeline & pipeline) int main(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("ParseStringDecompress", "Given a binary or string produced with CompressedStringify, decompress optionally base64 deencode", argc, argv); + itk::wasm::Pipeline pipeline("parse-string-decompress", "Given a binary or string produced with CompressedStringify, decompress optionally base64 deencode", argc, argv); bool parseString = false; pipeline.add_flag("-s,--parse-string", parseString, "Parse the input string before decompression"); diff --git a/src/io/internal/pipelines/image/ConvertImage/CMakeLists.txt b/src/io/internal/pipelines/image/convert-image/CMakeLists.txt similarity index 95% rename from src/io/internal/pipelines/image/ConvertImage/CMakeLists.txt rename to src/io/internal/pipelines/image/convert-image/CMakeLists.txt index 72f569d1f..0241800d8 100644 --- a/src/io/internal/pipelines/image/ConvertImage/CMakeLists.txt +++ b/src/io/internal/pipelines/image/convert-image/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.16) -project(ConvertImage) +project(convert-image) set(CMAKE_CXX_STANDARD 17) if (NOT TARGET libzstd_static) - include(${CMAKE_CURRENT_SOURCE_DIR}/../../common/CompressStringify/BuildZstd.cmake) + include(${CMAKE_CURRENT_SOURCE_DIR}/../../common/compress-stringify/BuildZstd.cmake) endif() if(WASI) @@ -141,8 +141,8 @@ foreach(io_module ${WebAssemblyInterface_ImageIOModules} WebAssemblyInterface) endif() foreach(imageio ${imageios_${io_module}}) string(SUBSTRING "${imageio}" 3 -1 ioname) - set(read_binary "${ioname}ReadImage") - set(write_binary "${ioname}WriteImage") + set(read_binary "${ioname}-read-image") + set(write_binary "${ioname}-write-image") set(ImageIOIndex_ARRAY "${ImageIOIndex_ARRAY}'${ioname}', ") set(extra_srcs) if(${imageio} STREQUAL "itkWASMZstdImageIO") @@ -150,10 +150,10 @@ foreach(io_module ${WebAssemblyInterface_ImageIOModules} WebAssemblyInterface) list(APPEND extra_srcs itkWASMZstdImageIO.cxx) endif() - add_executable(${read_binary} ReadImage.cxx ${extra_srcs}) + add_executable(${read_binary} read-image.cxx ${extra_srcs}) target_link_libraries(${read_binary} PUBLIC ${ITK_LIBRARIES}) target_compile_definitions(${read_binary} PUBLIC -DIMAGE_IO_CLASS=${imageio_id_${imageio}}) - add_executable(${write_binary} WriteImage.cxx ${extra_srcs}) + add_executable(${write_binary} write-image.cxx ${extra_srcs}) target_link_libraries(${write_binary} PUBLIC ${ITK_LIBRARIES}) target_compile_definitions(${write_binary} PUBLIC -DIMAGE_IO_CLASS=${imageio_id_${imageio}}) if (EMSCRIPTEN AND DEFINED WebAssemblyInterface_BINARY_DIR) diff --git a/src/io/internal/pipelines/image/ConvertImage/itkWASMZstdImageIO.cxx b/src/io/internal/pipelines/image/convert-image/itkWASMZstdImageIO.cxx similarity index 100% rename from src/io/internal/pipelines/image/ConvertImage/itkWASMZstdImageIO.cxx rename to src/io/internal/pipelines/image/convert-image/itkWASMZstdImageIO.cxx diff --git a/src/io/internal/pipelines/image/ConvertImage/itkWASMZstdImageIO.h b/src/io/internal/pipelines/image/convert-image/itkWASMZstdImageIO.h similarity index 100% rename from src/io/internal/pipelines/image/ConvertImage/itkWASMZstdImageIO.h rename to src/io/internal/pipelines/image/convert-image/itkWASMZstdImageIO.h diff --git a/src/io/internal/pipelines/image/ConvertImage/ReadImage.cxx b/src/io/internal/pipelines/image/convert-image/read-image.cxx similarity index 95% rename from src/io/internal/pipelines/image/ConvertImage/ReadImage.cxx rename to src/io/internal/pipelines/image/convert-image/read-image.cxx index a25800da7..a10c59a83 100644 --- a/src/io/internal/pipelines/image/ConvertImage/ReadImage.cxx +++ b/src/io/internal/pipelines/image/convert-image/read-image.cxx @@ -101,10 +101,10 @@ int readImage(const std::string & inputFileName, itk::wasm::OutputImageIO & outp int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("ReadImage", "Read an image file format and convert it to the itk-wasm file format", argc, argv); + itk::wasm::Pipeline pipeline("read-image", "Read an image file format and convert it to the itk-wasm file format", argc, argv); std::string inputFileName; - pipeline.add_option("InputImage", inputFileName, "Input image")->required()->check(CLI::ExistingFile); + pipeline.add_option("input-image", inputFileName, "Input image")->required()->check(CLI::ExistingFile); itk::wasm::OutputImageIO outputImageIO; pipeline.add_option("OutputImage", outputImageIO, "Output image")->required(); diff --git a/src/io/internal/pipelines/image/ConvertImage/WriteImage.cxx b/src/io/internal/pipelines/image/convert-image/write-image.cxx similarity index 96% rename from src/io/internal/pipelines/image/ConvertImage/WriteImage.cxx rename to src/io/internal/pipelines/image/convert-image/write-image.cxx index 44f83189d..702a4c1bf 100644 --- a/src/io/internal/pipelines/image/ConvertImage/WriteImage.cxx +++ b/src/io/internal/pipelines/image/convert-image/write-image.cxx @@ -134,13 +134,13 @@ int writeImage(itk::wasm::InputImageIO & inputImageIO, const std::string & outpu int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("WriteImage", "Write an itk-wasm file format converted to an image file format", argc, argv); + itk::wasm::Pipeline pipeline("write-image", "Write an itk-wasm file format converted to an image file format", argc, argv); itk::wasm::InputImageIO inputImageIO; - pipeline.add_option("InputImage", inputImageIO, "Input image")->required(); + pipeline.add_option("input-image", inputImageIO, "Input image")->required(); std::string outputFileName; - pipeline.add_option("OutputImage", outputFileName, "Output image")->required(); + pipeline.add_option("output-image", outputFileName, "Output image")->required(); bool quiet = false; pipeline.add_flag("-q,--quiet", quiet, "Less verbose output"); diff --git a/src/io/internal/pipelines/image/ReadDICOM/CMakeLists.txt b/src/io/internal/pipelines/image/read-dicom/CMakeLists.txt similarity index 82% rename from src/io/internal/pipelines/image/ReadDICOM/CMakeLists.txt rename to src/io/internal/pipelines/image/read-dicom/CMakeLists.txt index 41216f815..affd19b51 100644 --- a/src/io/internal/pipelines/image/ReadDICOM/CMakeLists.txt +++ b/src/io/internal/pipelines/image/read-dicom/CMakeLists.txt @@ -12,14 +12,14 @@ find_package(ITK REQUIRED ) include(${ITK_USE_FILE}) -add_executable(ReadImageDICOMFileSeries ReadImageDICOMFileSeries.cxx) -target_link_libraries(ReadImageDICOMFileSeries PUBLIC ${ITK_LIBRARIES}) +add_executable(read-image-dicom-file-series read-image-dicom-file-series.cxx) +target_link_libraries(read-image-dicom-file-series PUBLIC ${ITK_LIBRARIES}) if (WASI AND DEFINED WebAssemblyInterface_BINARY_DIR) - itk_module_target_label(ReadImageDICOMFileSeries) - itk_module_target_export(ReadImageDICOMFileSeries) - itk_module_target_install(ReadImageDICOMFileSeries) - set_property(TARGET ReadImageDICOMFileSeries + itk_module_target_label(read-image-dicom-file-series) + itk_module_target_export(read-image-dicom-file-series) + itk_module_target_install(read-image-dicom-file-series) + set_property(TARGET read-image-dicom-file-series PROPERTY RUNTIME_OUTPUT_DIRECTORY ${WebAssemblyInterface_BINARY_DIR}/wasi-image-io ) @@ -71,13 +71,13 @@ set_target_properties(${Iconv} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${Iconv_INCLUDE_DIRS}) add_dependencies(${Iconv} ${Iconv_LIBRARY}) -add_executable(ReadDICOMTags ReadDICOMTags.cxx) -target_link_libraries(ReadDICOMTags PUBLIC ${ITK_LIBRARIES} ${Iconv_LIBRARIES} ${Iconv}) +add_executable(read-dicom-tags read-dicom-tags.cxx) +target_link_libraries(read-dicom-tags PUBLIC ${ITK_LIBRARIES} ${Iconv_LIBRARIES} ${Iconv}) if (EMSCRIPTEN AND DEFINED WebAssemblyInterface_BINARY_DIR) foreach(dicom_io_module - ReadImageDICOMFileSeries - ReadDICOMTags + read-image-dicom-file-series + read-dicom-tags ) set(target_esm "${dicom_io_module}") set(target_umd "${dicom_io_module}.umd") diff --git a/src/io/internal/pipelines/image/ReadDICOM/ReadDICOMTags.cxx b/src/io/internal/pipelines/image/read-dicom/read-dicom-tags.cxx similarity index 98% rename from src/io/internal/pipelines/image/ReadDICOM/ReadDICOMTags.cxx rename to src/io/internal/pipelines/image/read-dicom/read-dicom-tags.cxx index f17b6d70c..48acbf6bb 100644 --- a/src/io/internal/pipelines/image/ReadDICOM/ReadDICOMTags.cxx +++ b/src/io/internal/pipelines/image/read-dicom/read-dicom-tags.cxx @@ -581,10 +581,10 @@ class DICOMTagReader int main( int argc, char * argv[] ) { - itk::wasm::Pipeline pipeline("ReadDICOMTags", "Read the tags from a DICOM file", argc, argv); + itk::wasm::Pipeline pipeline("read-dicom-tags", "Read the tags from a DICOM file", argc, argv); std::string dicomFile; - pipeline.add_option("DICOMFile", dicomFile, "Input DICOM file.")->required()->check(CLI::ExistingFile); + pipeline.add_option("dicom-file", dicomFile, "Input DICOM file.")->required()->check(CLI::ExistingFile); itk::wasm::InputTextStream tagsToReadStream; pipeline.add_option("--tags-to-read", tagsToReadStream, "A JSON object with a \"tags\" array of the tags to read. If not provided, all tags are read. Example tag: \"0010|0020\"."); diff --git a/src/io/internal/pipelines/image/ReadDICOM/ReadImageDICOMFileSeries.cxx b/src/io/internal/pipelines/image/read-dicom/read-image-dicom-file-series.cxx similarity index 99% rename from src/io/internal/pipelines/image/ReadDICOM/ReadImageDICOMFileSeries.cxx rename to src/io/internal/pipelines/image/read-dicom/read-image-dicom-file-series.cxx index d1a378e2c..5e1fe8e61 100644 --- a/src/io/internal/pipelines/image/ReadDICOM/ReadImageDICOMFileSeries.cxx +++ b/src/io/internal/pipelines/image/read-dicom/read-image-dicom-file-series.cxx @@ -288,7 +288,7 @@ int runPipeline(itk::wasm::Pipeline & pipeline, std::vector & input int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("ReadImageDICOMFileSeries", "Read a DICOM image series and return the associated image volume", argc, argv); + itk::wasm::Pipeline pipeline("read-image-dicom-file-series", "Read a DICOM image series and return the associated image volume", argc, argv); std::vector inputFileNames; pipeline.add_option("-i,--input-images", inputFileNames, "File names in the series")->required()->check(CLI::ExistingFile)->expected(1,-1); diff --git a/src/io/internal/pipelines/mesh/ConvertMesh/CMakeLists.txt b/src/io/internal/pipelines/mesh/convert-mesh/CMakeLists.txt similarity index 93% rename from src/io/internal/pipelines/mesh/ConvertMesh/CMakeLists.txt rename to src/io/internal/pipelines/mesh/convert-mesh/CMakeLists.txt index f2a5b5afc..5a9623421 100644 --- a/src/io/internal/pipelines/mesh/ConvertMesh/CMakeLists.txt +++ b/src/io/internal/pipelines/mesh/convert-mesh/CMakeLists.txt @@ -4,7 +4,7 @@ project(ConvertMesh) set(CMAKE_CXX_STANDARD 17) if (NOT TARGET libzstd_static) - include(${CMAKE_CURRENT_SOURCE_DIR}/../../common/CompressStringify/BuildZstd.cmake) + include(${CMAKE_CURRENT_SOURCE_DIR}/../../common/compress-stringify/BuildZstd.cmake) endif() # This list should be ordered from approximately most commonly to least @@ -70,8 +70,8 @@ foreach(io_module ${WebAssemblyInterface_MeshIOModules} WebAssemblyInterface) endif() foreach(meshio ${meshios_${io_module}}) string(SUBSTRING "${meshio}" 3 -1 ioname) - set(read_binary "${ioname}ReadMesh") - set(write_binary "${ioname}WriteMesh") + set(read_binary "${ioname}-read-mesh") + set(write_binary "${ioname}-write-mesh") set(MeshIOIndex_ARRAY "${MeshIOIndex_ARRAY}'${ioname}', ") set(extra_srcs) if(${meshio} STREQUAL "itkWASMZstdMeshIO") @@ -79,10 +79,10 @@ foreach(io_module ${WebAssemblyInterface_MeshIOModules} WebAssemblyInterface) list(APPEND extra_srcs itkWASMZstdMeshIO.cxx) endif() - add_executable(${read_binary} ReadMesh.cxx ${extra_srcs}) + add_executable(${read_binary} read-mesh.cxx ${extra_srcs}) target_link_libraries(${read_binary} PUBLIC ${ITK_LIBRARIES}) target_compile_definitions(${read_binary} PUBLIC -DMESH_IO_CLASS=${meshio_id_${meshio}}) - add_executable(${write_binary} WriteMesh.cxx ${extra_srcs}) + add_executable(${write_binary} write-mesh.cxx ${extra_srcs}) target_link_libraries(${write_binary} PUBLIC ${ITK_LIBRARIES}) target_compile_definitions(${write_binary} PUBLIC -DMESH_IO_CLASS=${meshio_id_${meshio}}) if (EMSCRIPTEN AND DEFINED WebAssemblyInterface_BINARY_DIR) diff --git a/src/io/internal/pipelines/mesh/ConvertMesh/itkWASMZstdMeshIO.cxx b/src/io/internal/pipelines/mesh/convert-mesh/itkWASMZstdMeshIO.cxx similarity index 100% rename from src/io/internal/pipelines/mesh/ConvertMesh/itkWASMZstdMeshIO.cxx rename to src/io/internal/pipelines/mesh/convert-mesh/itkWASMZstdMeshIO.cxx diff --git a/src/io/internal/pipelines/mesh/ConvertMesh/itkWASMZstdMeshIO.h b/src/io/internal/pipelines/mesh/convert-mesh/itkWASMZstdMeshIO.h similarity index 100% rename from src/io/internal/pipelines/mesh/ConvertMesh/itkWASMZstdMeshIO.h rename to src/io/internal/pipelines/mesh/convert-mesh/itkWASMZstdMeshIO.h diff --git a/src/io/internal/pipelines/mesh/ConvertMesh/ReadMesh.cxx b/src/io/internal/pipelines/mesh/convert-mesh/read-mesh.cxx similarity index 91% rename from src/io/internal/pipelines/mesh/ConvertMesh/ReadMesh.cxx rename to src/io/internal/pipelines/mesh/convert-mesh/read-mesh.cxx index bfe8d28aa..770ba9a8a 100644 --- a/src/io/internal/pipelines/mesh/ConvertMesh/ReadMesh.cxx +++ b/src/io/internal/pipelines/mesh/convert-mesh/read-mesh.cxx @@ -78,13 +78,13 @@ int readMesh(const std::string & inputFileName, itk::wasm::OutputMeshIO & output int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("ReadMesh", "Read an mesh file format and convert it to the itk-wasm file format", argc, argv); + itk::wasm::Pipeline pipeline("read-mesh", "Read an mesh file format and convert it to the itk-wasm file format", argc, argv); std::string inputFileName; - pipeline.add_option("InputMesh", inputFileName, "Input mesh")->required()->check(CLI::ExistingFile); + pipeline.add_option("input-mesh", inputFileName, "Input mesh")->required()->check(CLI::ExistingFile); itk::wasm::OutputMeshIO outputMeshIO; - pipeline.add_option("OutputMesh", outputMeshIO, "Output mesh")->required(); + pipeline.add_option("output-mesh", outputMeshIO, "Output mesh")->required(); bool quiet = false; pipeline.add_flag("-q,--quiet", quiet, "Less verbose output"); diff --git a/src/io/internal/pipelines/mesh/ConvertMesh/WriteMesh.cxx b/src/io/internal/pipelines/mesh/convert-mesh/write-mesh.cxx similarity index 95% rename from src/io/internal/pipelines/mesh/ConvertMesh/WriteMesh.cxx rename to src/io/internal/pipelines/mesh/convert-mesh/write-mesh.cxx index 9b0bcbe81..09987b524 100644 --- a/src/io/internal/pipelines/mesh/ConvertMesh/WriteMesh.cxx +++ b/src/io/internal/pipelines/mesh/convert-mesh/write-mesh.cxx @@ -141,13 +141,13 @@ int writeMesh(itk::wasm::InputMeshIO & inputMeshIO, const std::string & outputFi int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("WriteMesh", "Write an mesh in the itk-wasm file format to another file format", argc, argv); + itk::wasm::Pipeline pipeline("write-mesh", "Write an mesh in the itk-wasm file format to another file format", argc, argv); itk::wasm::InputMeshIO inputMeshIO; - pipeline.add_option("InputMesh", inputMeshIO, "Input mesh")->required(); + pipeline.add_option("input-mesh", inputMeshIO, "Input mesh")->required(); std::string outputFileName; - pipeline.add_option("OutputMesh", outputFileName, "Output mesh")->required(); + pipeline.add_option("output-mesh", outputFileName, "Output mesh")->required(); bool quiet = false; pipeline.add_flag("-q,--quiet", quiet, "Less verbose output"); diff --git a/src/io/internal/pipelines/mesh/MeshToPolyData/CMakeLists.txt b/src/io/internal/pipelines/mesh/mesh-to-polydata/CMakeLists.txt similarity index 67% rename from src/io/internal/pipelines/mesh/MeshToPolyData/CMakeLists.txt rename to src/io/internal/pipelines/mesh/mesh-to-polydata/CMakeLists.txt index ef411fff0..5b345cf63 100644 --- a/src/io/internal/pipelines/mesh/MeshToPolyData/CMakeLists.txt +++ b/src/io/internal/pipelines/mesh/mesh-to-polydata/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(MeshToPolyData) +project(mesh-to-polydata) set(CMAKE_CXX_STANDARD 17) @@ -10,14 +10,14 @@ find_package(ITK REQUIRED ) include(${ITK_USE_FILE}) -add_executable(MeshToPolyData MeshToPolyData.cxx) -target_link_libraries(MeshToPolyData PUBLIC ${ITK_LIBRARIES}) +add_executable(mesh-to-polydata mesh-to-polydata.cxx) +target_link_libraries(mesh-to-polydata PUBLIC ${ITK_LIBRARIES}) -add_executable(PolyDataToMesh PolyDataToMesh.cxx) -target_link_libraries(PolyDataToMesh PUBLIC ${ITK_LIBRARIES}) +add_executable(polydata-to-mesh polydata-to-mesh.cxx) +target_link_libraries(polydata-to-mesh PUBLIC ${ITK_LIBRARIES}) if (EMSCRIPTEN AND DEFINED WebAssemblyInterface_BINARY_DIR) - foreach(target MeshToPolyData MeshToPolyData.umd PolyDataToMesh PolyDataToMesh.umd) + foreach(target mesh-to-polydata mesh-to-polydata.umd polydata-to-mesh polydata-to-mesh.umd) itk_module_target_label(${target}) itk_module_target_export(${target}) itk_module_target_install(${target}) @@ -28,7 +28,7 @@ if (EMSCRIPTEN AND DEFINED WebAssemblyInterface_BINARY_DIR) endforeach() endif() if (WASI AND DEFINED WebAssemblyInterface_BINARY_DIR) - foreach(target MeshToPolyData PolyDataToMesh) + foreach(target mesh-to-polydata polydata-to-mesh) itk_module_target_label(${target}) itk_module_target_export(${target}) itk_module_target_install(${target}) diff --git a/src/io/internal/pipelines/mesh/MeshToPolyData/MeshToPolyData.cxx b/src/io/internal/pipelines/mesh/mesh-to-polydata/mesh-to-polydata.cxx similarity index 84% rename from src/io/internal/pipelines/mesh/MeshToPolyData/MeshToPolyData.cxx rename to src/io/internal/pipelines/mesh/mesh-to-polydata/mesh-to-polydata.cxx index 722e8ed64..a8ecd4621 100644 --- a/src/io/internal/pipelines/mesh/MeshToPolyData/MeshToPolyData.cxx +++ b/src/io/internal/pipelines/mesh/mesh-to-polydata/mesh-to-polydata.cxx @@ -35,12 +35,12 @@ class PipelineFunctor using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "Input mesh")->required(); + pipeline.add_option("input-mesh", inputMesh, "Input mesh")->required()->type_name("INPUT_MESH"); using PolyDataType = itk::PolyData; using OutputPolyDataType = itk::wasm::OutputPolyData; OutputPolyDataType outputPolyData; - pipeline.add_option("OutputPolyData", outputPolyData, "Output polydata")->required(); + pipeline.add_option("output-polydata", outputPolyData, "Output polydata")->required()->type_name("OUTPUT_POLYDATA"); ITK_WASM_PARSE(pipeline); @@ -57,7 +57,7 @@ class PipelineFunctor int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("MeshToPolyData", "Convert an itk::Mesh to an itk::PolyData", argc, argv); + itk::wasm::Pipeline pipeline("mesh-to-polydata", "Convert an itk::Mesh to an itk::PolyData", argc, argv); itk::WASMMeshIOFactory::RegisterOneFactory(); @@ -69,5 +69,5 @@ int main (int argc, char * argv[]) itk::Vector, itk::Vector > - ::Dimensions<2U,3U>("InputMesh", pipeline); + ::Dimensions<2U,3U>("input-mesh", pipeline); } diff --git a/src/io/internal/pipelines/mesh/MeshToPolyData/PolyDataToMesh.cxx b/src/io/internal/pipelines/mesh/mesh-to-polydata/polydata-to-mesh.cxx similarity index 82% rename from src/io/internal/pipelines/mesh/MeshToPolyData/PolyDataToMesh.cxx rename to src/io/internal/pipelines/mesh/mesh-to-polydata/polydata-to-mesh.cxx index 913c1cbcd..bf6156550 100644 --- a/src/io/internal/pipelines/mesh/MeshToPolyData/PolyDataToMesh.cxx +++ b/src/io/internal/pipelines/mesh/mesh-to-polydata/polydata-to-mesh.cxx @@ -34,12 +34,12 @@ class PipelineFunctor using InputPolyDataType = itk::wasm::InputPolyData; InputPolyDataType inputPolyData; - pipeline.add_option("InputPolyData", inputPolyData, "Input polydata")->required(); + pipeline.add_option("input-polydata", inputPolyData, "Input polydata")->required()->type_name("INPUT_POLYDATA"); using MeshType = itk::Mesh; using OutputMeshType = itk::wasm::OutputMesh; OutputMeshType outputMesh; - pipeline.add_option("OutputMesh", outputMesh, "Output mesh")->required(); + pipeline.add_option("output-mesh", outputMesh, "Output mesh")->required()->type_name("OUTPUT_MESH"); ITK_WASM_PARSE(pipeline); @@ -56,10 +56,10 @@ class PipelineFunctor int main (int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("PolyDataToMesh", "Convert an itk::PolyData to an itk::Mesh", argc, argv); + itk::wasm::Pipeline pipeline("polydata-to-mesh", "Convert an itk::PolyData to an itk::Mesh", argc, argv); itk::WASMMeshIOFactory::RegisterOneFactory(); return itk::wasm::SupportInputPolyDataTypes - ::PixelTypes("InputPolyData", pipeline); + ::PixelTypes("input-polydata", pipeline); } diff --git a/src/io/meshToPolyData.ts b/src/io/meshToPolyData.ts index a844fd155..bf159d844 100644 --- a/src/io/meshToPolyData.ts +++ b/src/io/meshToPolyData.ts @@ -28,7 +28,7 @@ async function meshToPolyData (webWorker: Worker | null, mesh: Mesh): Promise<{ { operation: 'meshToPolyData', config: config, - pipelinePath: 'MeshToPolyData', // placeholder + pipelinePath: 'mesh-to-polydata', // placeholder args, outputs, inputs diff --git a/src/io/meshToPolyDataNode.ts b/src/io/meshToPolyDataNode.ts index fe813e7a5..abfdf8b6b 100644 --- a/src/io/meshToPolyDataNode.ts +++ b/src/io/meshToPolyDataNode.ts @@ -20,7 +20,7 @@ async function meshToPolyDataNode (mesh: Mesh): Promise { { type: InterfaceTypes.Mesh, data: mesh } ] as PipelineInput[] - const modulePath = path.join(meshIOsPath, 'MeshToPolyData.js') + const modulePath = path.join(meshIOsPath, 'mesh-to-polydata.js') const emModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const { outputs } = runPipelineEmscripten(emModule, args, desiredOutputs, inputs) return outputs[0].data as PolyData diff --git a/src/io/polyDataToMesh.ts b/src/io/polyDataToMesh.ts index ca3b9f427..8f155c05d 100644 --- a/src/io/polyDataToMesh.ts +++ b/src/io/polyDataToMesh.ts @@ -28,7 +28,7 @@ async function polyDataToMesh (webWorker: Worker | null, polyData: PolyData): Pr { operation: 'polyDataToMesh', config: config, - pipelinePath: 'PolyDataToMesh', // placeholder + pipelinePath: 'polydata-to-mesh', // placeholder args, outputs, inputs diff --git a/src/io/polyDataToMeshNode.ts b/src/io/polyDataToMeshNode.ts index f10dcccbd..98448d0e2 100644 --- a/src/io/polyDataToMeshNode.ts +++ b/src/io/polyDataToMeshNode.ts @@ -20,7 +20,7 @@ async function polyDataToMeshNode (polyData: PolyData): Promise { { type: InterfaceTypes.PolyData, data: polyData } ] as PipelineInput[] - const modulePath = path.join(meshIOsPath, 'PolyDataToMesh.js') + const modulePath = path.join(meshIOsPath, 'polydata-to-mesh.js') const emModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const { outputs } = runPipelineEmscripten(emModule, args, desiredOutputs, inputs) return outputs[0].data as Mesh diff --git a/src/io/readDICOMTagsArrayBuffer.ts b/src/io/readDICOMTagsArrayBuffer.ts index 8faf6a543..9c38b9696 100644 --- a/src/io/readDICOMTagsArrayBuffer.ts +++ b/src/io/readDICOMTagsArrayBuffer.ts @@ -40,7 +40,7 @@ async function readDICOMTagsArrayBuffer (webWorker: Worker | null, arrayBuffer: { operation: 'readDICOMTags', config: config, - pipelinePath: 'ReadDICOMTags', // placeholder + pipelinePath: 'read-dicom-tags', // placeholder args, outputs, inputs diff --git a/src/io/readDICOMTagsLocalFile.ts b/src/io/readDICOMTagsLocalFile.ts index 876074b54..e3af7eef6 100644 --- a/src/io/readDICOMTagsLocalFile.ts +++ b/src/io/readDICOMTagsLocalFile.ts @@ -16,7 +16,7 @@ import PipelineEmscriptenModule from '../pipeline/PipelineEmscriptenModule.js' */ async function readDICOMTagsLocalFile (fileName: string, tags: string[] | null = null): Promise> { const imageIOsPath = findLocalImageIOPath() - const tagReader = 'ReadDICOMTags' + const tagReader = 'read-dicom-tags' const tagReaderPath = path.join(imageIOsPath, tagReader + '.js') const tagReaderModule = await loadEmscriptenModule(tagReaderPath) as PipelineEmscriptenModule const mountedFilePath = tagReaderModule.mountContainingDir(fileName) diff --git a/src/io/readImageArrayBuffer.ts b/src/io/readImageArrayBuffer.ts index d23e023ee..ff6d326b5 100644 --- a/src/io/readImageArrayBuffer.ts +++ b/src/io/readImageArrayBuffer.ts @@ -33,7 +33,7 @@ async function readImageArrayBuffer (webWorker: Worker | null, arrayBuffer: Arra config: config, mimeType, fileName, - pipelinePath: 'ReadImage', // placeholder + pipelinePath: 'read-image', // placeholder args, outputs, inputs diff --git a/src/io/readImageLocalDICOMFileSeries.ts b/src/io/readImageLocalDICOMFileSeries.ts index 42f1fc7e4..276a7b105 100644 --- a/src/io/readImageLocalDICOMFileSeries.ts +++ b/src/io/readImageLocalDICOMFileSeries.ts @@ -21,7 +21,7 @@ async function readImageLocalDICOMFileSeries (fileNames: string[], singleSortedS throw new Error('No fileNames provided') } const imageIOsPath = findLocalImageIOPath() - const seriesReader = 'ReadImageDICOMFileSeries' + const seriesReader = 'read-image-dicom-file-series' const seriesReaderPath = path.join(imageIOsPath, seriesReader + '.js') const seriesReaderModule = await loadEmscriptenModule(seriesReaderPath) as PipelineEmscriptenModule const mountedFilePath = seriesReaderModule.mountContainingDir(fileNames[0]) diff --git a/src/io/readImageLocalFile.ts b/src/io/readImageLocalFile.ts index 76a47a8ce..458291476 100644 --- a/src/io/readImageLocalFile.ts +++ b/src/io/readImageLocalFile.ts @@ -39,7 +39,7 @@ async function readImageLocalFile (filePath: string): Promise { io = extensionToIO.get(extension) } else { for (let idx = 0; idx < ImageIOIndex.length; ++idx) { - const modulePath = path.join(imageIOsPath, ImageIOIndex[idx] + 'ReadImage.js') + const modulePath = path.join(imageIOsPath, ImageIOIndex[idx] + '-read-image.js') const readImageModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = readImageModule.mountContainingDir(absoluteFilePath) const { returnValue, outputs } = runPipelineEmscripten(readImageModule, args, desiredOutputs, inputs) @@ -53,7 +53,7 @@ async function readImageLocalFile (filePath: string): Promise { throw Error('Could not find IO for: ' + absoluteFilePath) } - const modulePath = path.join(imageIOsPath, io as string + 'ReadImage.js') + const modulePath = path.join(imageIOsPath, io as string + '-read-image.js') const readImageModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = readImageModule.mountContainingDir(absoluteFilePath) const { outputs } = runPipelineEmscripten(readImageModule, args, desiredOutputs, inputs) diff --git a/src/io/readMeshArrayBuffer.ts b/src/io/readMeshArrayBuffer.ts index 49dfedada..9e41fc798 100644 --- a/src/io/readMeshArrayBuffer.ts +++ b/src/io/readMeshArrayBuffer.ts @@ -34,7 +34,7 @@ async function readMeshArrayBuffer (webWorker: Worker | null, arrayBuffer: Array config: config, mimeType, fileName, - pipelinePath: 'ReadMesh', // placeholder + pipelinePath: 'read-mesh', // placeholder args, outputs, inputs diff --git a/src/io/readMeshLocalFile.ts b/src/io/readMeshLocalFile.ts index 10b5b10bb..820cbb290 100644 --- a/src/io/readMeshLocalFile.ts +++ b/src/io/readMeshLocalFile.ts @@ -39,7 +39,7 @@ async function readMeshLocalFile (filePath: string): Promise { io = extensionToIO.get(extension) } else { for (let idx = 0; idx < MeshIOIndex.length; ++idx) { - const modulePath = path.join(meshIOsPath, MeshIOIndex[idx] + 'ReadMesh.js') + const modulePath = path.join(meshIOsPath, MeshIOIndex[idx] + '-read-mesh.js') const readMeshModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = readMeshModule.mountContainingDir(absoluteFilePath) const { returnValue, outputs } = runPipelineEmscripten(readMeshModule, args, desiredOutputs, inputs) @@ -53,7 +53,7 @@ async function readMeshLocalFile (filePath: string): Promise { throw Error('Could not find IO for: ' + absoluteFilePath) } - const modulePath = path.join(meshIOsPath, io as string + 'ReadMesh.js') + const modulePath = path.join(meshIOsPath, io as string + '-read-mesh.js') const readMeshModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = readMeshModule.mountContainingDir(absoluteFilePath) const { outputs } = runPipelineEmscripten(readMeshModule, args, desiredOutputs, inputs) diff --git a/src/io/writeImageLocalFile.ts b/src/io/writeImageLocalFile.ts index 2cca9de05..997f87d02 100644 --- a/src/io/writeImageLocalFile.ts +++ b/src/io/writeImageLocalFile.ts @@ -52,7 +52,7 @@ async function writeImageLocalFile (image: Image, filePath: string, useCompressi io = extensionToIO.get(extension) } else { for (let idx = 0; idx < ImageIOIndex.length; ++idx) { - const modulePath = path.join(imageIOsPath, ImageIOIndex[idx] + 'WriteImage.js') + const modulePath = path.join(imageIOsPath, ImageIOIndex[idx] + '-write-image.js') const writeImageModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = writeImageModule.mountContainingDir(absoluteFilePath) const { returnValue } = runPipelineEmscripten(writeImageModule, args, desiredOutputs, inputs) @@ -66,7 +66,7 @@ async function writeImageLocalFile (image: Image, filePath: string, useCompressi throw Error('Could not find IO for: ' + absoluteFilePath) } - const modulePath = path.join(imageIOsPath, io as string + 'WriteImage.js') + const modulePath = path.join(imageIOsPath, io as string + '-write-image.js') const writeImageModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = writeImageModule.mountContainingDir(absoluteFilePath) runPipelineEmscripten(writeImageModule, args, desiredOutputs, inputs) diff --git a/src/io/writeMeshLocalFile.ts b/src/io/writeMeshLocalFile.ts index 87be0a610..9ef2c632a 100644 --- a/src/io/writeMeshLocalFile.ts +++ b/src/io/writeMeshLocalFile.ts @@ -57,7 +57,7 @@ async function writeMeshLocalFile (mesh: Mesh, filePath: string, options: WriteM io = extensionToIO.get(extension) } else { for (let idx = 0; idx < MeshIOIndex.length; ++idx) { - const modulePath = path.join(meshIOsPath, MeshIOIndex[idx] + 'WriteMesh.js') + const modulePath = path.join(meshIOsPath, MeshIOIndex[idx] + '-write-mesh.js') const writeMeshModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = writeMeshModule.mountContainingDir(absoluteFilePath) const { returnValue } = runPipelineEmscripten(writeMeshModule, args, desiredOutputs, inputs) @@ -71,7 +71,7 @@ async function writeMeshLocalFile (mesh: Mesh, filePath: string, options: WriteM throw Error('Could not find IO for: ' + absoluteFilePath) } - const modulePath = path.join(meshIOsPath, io as string + 'WriteMesh.js') + const modulePath = path.join(meshIOsPath, io as string + '-write-mesh.js') const writeMeshModule = await loadEmscriptenModule(modulePath) as PipelineEmscriptenModule const mountedFilePath = writeMeshModule.mountContainingDir(absoluteFilePath) runPipelineEmscripten(writeMeshModule, args, desiredOutputs, inputs) diff --git a/src/web-workers/loadImageIOPipelineModule.ts b/src/web-workers/loadImageIOPipelineModule.ts index 6ac0bb270..ed9ad2ddb 100644 --- a/src/web-workers/loadImageIOPipelineModule.ts +++ b/src/web-workers/loadImageIOPipelineModule.ts @@ -9,7 +9,7 @@ import runPipelineEmscripten from '../pipeline/internal/runPipelineEmscripten.js async function * availableIOModules (input: IOInput) { for (let idx = 0; idx < ImageIOIndex.length; idx++) { - const trialIO = ImageIOIndex[idx] + 'ReadImage' + const trialIO = ImageIOIndex[idx] + '-read-image' const ioModule = await loadPipelineModule(trialIO, input.config.imageIOUrl) as PipelineEmscriptenModule yield ioModule } diff --git a/src/web-workers/loadMeshIOPipelineModule.ts b/src/web-workers/loadMeshIOPipelineModule.ts index 7d4486437..f21219920 100644 --- a/src/web-workers/loadMeshIOPipelineModule.ts +++ b/src/web-workers/loadMeshIOPipelineModule.ts @@ -9,7 +9,7 @@ import runPipelineEmscripten from '../pipeline/internal/runPipelineEmscripten.js async function * availableIOModules (input: IOInput) { for (let idx = 0; idx < MeshIOIndex.length; idx++) { - const trialIO = MeshIOIndex[idx] + 'ReadMesh' + const trialIO = MeshIOIndex[idx] + '-read-mesh' const ioModule = await loadPipelineModule(trialIO, input.config.meshIOUrl) as PipelineEmscriptenModule yield ioModule } diff --git a/src/web-workers/pipeline.worker.ts b/src/web-workers/pipeline.worker.ts index 7438e4cec..f157b3198 100644 --- a/src/web-workers/pipeline.worker.ts +++ b/src/web-workers/pipeline.worker.ts @@ -12,21 +12,21 @@ registerWebworker(async function (input: RunPipelineInput | IOInput) { if (input.operation === 'runPipeline') { pipelineModule = await loadPipelineModule(input.pipelinePath, input.config.pipelinesUrl) } else if (input.operation === 'readImage') { - pipelineModule = await loadImageIOPipelineModule(input as IOInput, 'ReadImage') + pipelineModule = await loadImageIOPipelineModule(input as IOInput, '-read-image') } else if (input.operation === 'writeImage') { - pipelineModule = await loadImageIOPipelineModule(input as IOInput, 'WriteImage') + pipelineModule = await loadImageIOPipelineModule(input as IOInput, '-write-image') } else if (input.operation === 'readMesh') { - pipelineModule = await loadMeshIOPipelineModule(input as IOInput, 'ReadMesh') + pipelineModule = await loadMeshIOPipelineModule(input as IOInput, '-read-mesh') } else if (input.operation === 'writeMesh') { - pipelineModule = await loadMeshIOPipelineModule(input as IOInput, 'WriteMesh') + pipelineModule = await loadMeshIOPipelineModule(input as IOInput, '-write-mesh') } else if (input.operation === 'meshToPolyData') { - pipelineModule = await loadPipelineModule('MeshToPolyData', input.config.meshIOUrl) + pipelineModule = await loadPipelineModule('mesh-to-polydata', input.config.meshIOUrl) } else if (input.operation === 'polyDataToMesh') { - pipelineModule = await loadPipelineModule('PolyDataToMesh', input.config.meshIOUrl) + pipelineModule = await loadPipelineModule('polydata-to-mesh', input.config.meshIOUrl) } else if (input.operation === 'readDICOMImageSeries') { - pipelineModule = await loadPipelineModule('ReadImageDICOMFileSeries', input.config.imageIOUrl) + pipelineModule = await loadPipelineModule('read-image-dicom-file-series', input.config.imageIOUrl) } else if (input.operation === 'readDICOMTags') { - pipelineModule = await loadPipelineModule('ReadDICOMTags', input.config.imageIOUrl) + pipelineModule = await loadPipelineModule('read-dicom-tags', input.config.imageIOUrl) } else { throw new Error('Unknown worker operation') } diff --git a/test/browser/core/WebWorkerPoolTest.js b/test/browser/core/WebWorkerPoolTest.js index 788ff7e56..a87ac19a0 100644 --- a/test/browser/core/WebWorkerPoolTest.js +++ b/test/browser/core/WebWorkerPoolTest.js @@ -40,7 +40,7 @@ export default function () { const taskArgsArray = [] for (let index = 0; index < maxTotalSplits; index++) { - const pipelinePath = 'MedianFilterTest' + const pipelinePath = 'median-filter-test' const args = ['--memory-io', '0', '0', '--radius', '4', '-m', '' + maxTotalSplits, '-s', '' + index] const desiredOutputs = [ { type: InterfaceTypes.Image } diff --git a/test/browser/pipeline/runPipelineTest.js b/test/browser/pipeline/runPipelineTest.js index 08b529aeb..70185f005 100644 --- a/test/browser/pipeline/runPipelineTest.js +++ b/test/browser/pipeline/runPipelineTest.js @@ -8,7 +8,7 @@ export default function () { const args = [] const outputs = null const inputs = null - const stdoutStderrPath = 'StdoutStderrTest' + const stdoutStderrPath = 'stdout-stderr-test' return runPipeline(null, stdoutStderrPath, args, outputs, inputs) .then(function ({ returnValue, stdout, stderr, webWorker }) { webWorker.terminate() @@ -29,7 +29,7 @@ Click. Perfect success. const args = [] const outputs = null const inputs = null - const stdoutStderrPath = 'StdoutStderrTest' + const stdoutStderrPath = 'stdout-stderr-test' return runPipeline(null, stdoutStderrPath, args, outputs, inputs) .then(function ({ stdout, stderr, outputs, webWorker }) { return runPipeline(webWorker, stdoutStderrPath, args, outputs, inputs) @@ -53,7 +53,7 @@ Click. Perfect success. const args = [] const outputs = null const inputs = null - const absoluteURL = new URL('base/dist/pipeline/StdoutStderrTest', document.location) + const absoluteURL = new URL('base/dist/pipeline/stdout-stderr-test', document.location) return runPipeline(null, absoluteURL, args, outputs, inputs) .then(function ({ stdout, stderr, outputs, webWorker }) { webWorker.terminate() @@ -73,7 +73,7 @@ Click. Perfect success. const args = [] const outputs = null const inputs = null - const absoluteURL = new URL('base/dist/pipeline/StdoutStderrTest', document.location) + const absoluteURL = new URL('base/dist/pipeline/stdout-stderr-test', document.location) return runPipeline(false, absoluteURL, args, outputs, inputs) .then(function ({ stdout, stderr, outputs }) { t.is(stdout, `I’m writing my code, @@ -89,7 +89,7 @@ Click. Perfect success. }) test('runPipeline uses input and output files in the Emscripten filesystem', (t) => { - const pipelinePath = 'InputOutputFilesTest' + const pipelinePath = 'input-output-files-test' const args = ['--use-files', '--input-text-file', './input.txt', '--input-binary-file', './input.bin', @@ -127,7 +127,7 @@ Click. Perfect success. }) test('runPipelineNode uses input and output text and binary data via memory io', (t) => { - const pipelinePath = 'InputOutputFilesTest' + const pipelinePath = 'input-output-files-test' const args = ['--memory-io', '--input-text-stream', '0', '--input-binary-stream', '1', @@ -161,7 +161,7 @@ Click. Perfect success. }) test('runPipeline runs on the main thread when first argument is false', (t) => { - const pipelinePath = 'InputOutputFilesTest' + const pipelinePath = 'input-output-files-test' const args = ['--use-files', '--input-text-file', './input.txt', '--input-binary-file', './input.bin', @@ -223,7 +223,7 @@ Click. Perfect success. return readImageFile(null, jsFile) }).then(function ({ image, webWorker }) { webWorker.terminate() - const pipelinePath = 'MedianFilterTest' + const pipelinePath = 'median-filter-test' const args = [ '0', '0', @@ -260,7 +260,7 @@ Click. Perfect success. const jsFile = await new window.File([response.data], fileName) const { mesh, webWorker } = await readMeshFile(null, jsFile) webWorker.terminate() - const pipelinePath = 'MeshReadWriteTest' + const pipelinePath = 'mesh-read-write-test' const args = ['0', '0', '--memory-io'] const desiredOutputs = [ { type: InterfaceTypes.Mesh } diff --git a/test/itkPipelineMemoryIOTest.cxx b/test/itkPipelineMemoryIOTest.cxx index 3d60febb7..790e0341b 100644 --- a/test/itkPipelineMemoryIOTest.cxx +++ b/test/itkPipelineMemoryIOTest.cxx @@ -129,7 +129,7 @@ itkPipelineMemoryIOTest(int argc, char * argv[]) std::memcpy(readWASMPolyDataPointer, readPolyDataJSON.data(), readPolyDataJSON.size()); const char * mockArgv[] = {"itkPipelineMemoryIOTest", "--memory-io", "0", "0", "1", "1", "2", "2", "3", "3", "4", "4", NULL}; - itk::wasm::Pipeline pipeline("PipelineTest", "A test ITK WASM Pipeline", 12, const_cast< char ** >(mockArgv)); + itk::wasm::Pipeline pipeline("pipeline-test", "A test ITK WASM Pipeline", 12, const_cast< char ** >(mockArgv)); std::string example_string_option = "default"; pipeline.add_option("-s,--string", example_string_option, "A help string"); @@ -148,39 +148,39 @@ itkPipelineMemoryIOTest(int argc, char * argv[]) using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("inputImage", inputImage, "The inputImage")->required(); + pipeline.add_option("input-image", inputImage, "The inputImage")->required()->type_name("INPUT_IMAGE"); using OutputImageType = itk::wasm::OutputImage; OutputImageType outputImage; - pipeline.add_option("outputImage", outputImage, "The outputImage")->required(); + pipeline.add_option("output-image", outputImage, "The outputImage")->required()->type_name("OUTPUT_IMAGE"); itk::wasm::InputTextStream inputTextStream; - pipeline.add_option("InputText", inputTextStream, "The input text")->required(); + pipeline.add_option("input-text", inputTextStream, "The input text")->required()->type_name("INPUT_TEXT_STREAM"); itk::wasm::OutputTextStream outputTextStream; - pipeline.add_option("OutputText", outputTextStream, "The output text")->required(); + pipeline.add_option("output-text", outputTextStream, "The output text")->required()->type_name("OUTPUT_TEXT_STREAM"); itk::wasm::InputBinaryStream inputBinaryStream; - pipeline.add_option("InputBinary", inputBinaryStream, "The input text")->required(); + pipeline.add_option("input-binary", inputBinaryStream, "The input text")->required()->type_name("OUTPUT_BINARY_STREAM"); itk::wasm::OutputBinaryStream outputBinaryStream; - pipeline.add_option("OutputBinary", outputBinaryStream, "The output binary")->required(); + pipeline.add_option("output-binary", outputBinaryStream, "The output binary")->required()->type_name("OUTPUT_BINARY"); using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "The input mesh")->required(); + pipeline.add_option("input-mesh", inputMesh, "The input mesh")->required()->type_name("INPUT_MESH"); using OutputMeshType = itk::wasm::OutputMesh; OutputMeshType outputMesh; - pipeline.add_option("OutputMesh", outputMesh, "The output mesh")->required(); + pipeline.add_option("output-mesh", outputMesh, "The output mesh")->required()->type_name("OUTPUT_MESH"); using InputPolyDataType = itk::wasm::InputPolyData; InputPolyDataType inputPolyData; - pipeline.add_option("InputPolyData", inputPolyData, "The input polydata")->required(); + pipeline.add_option("input-polydata", inputPolyData, "The input polydata")->required()->type_name("INPUT_POLYDATA"); using OutputPolyDataType = itk::wasm::OutputPolyData; OutputPolyDataType outputPolyData; - pipeline.add_option("OutputPolyData", outputPolyData, "The output polydata")->required(); + pipeline.add_option("output-polydata", outputPolyData, "The output polydata")->required()->type_name("OUTPUT_POLYDATA"); ITK_WASM_PARSE(pipeline); diff --git a/test/itkPipelineTest.cxx b/test/itkPipelineTest.cxx index 2d1295739..618db6c31 100644 --- a/test/itkPipelineTest.cxx +++ b/test/itkPipelineTest.cxx @@ -34,7 +34,7 @@ int itkPipelineTest(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("PipelineTest", "A test ITK WASM Pipeline", argc, argv); + itk::wasm::Pipeline pipeline("pipeline-test", "A test ITK WASM Pipeline", argc, argv); std::string example_string_option = "default"; pipeline.add_option("-s,--string", example_string_option, "A help string"); @@ -59,40 +59,40 @@ itkPipelineTest(int argc, char * argv[]) using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image")->required()->type_name("INPUT_IMAGE"); + pipeline.add_option("input-image", inputImage, "The input image")->required()->type_name("INPUT_IMAGE"); using OutputImageType = itk::wasm::OutputImage; OutputImageType outputImage; - pipeline.add_option("OutputImage", outputImage, "The output image")->required()->type_name("OUTPUT_IMAGE"); + pipeline.add_option("output-image", outputImage, "The output image")->required()->type_name("OUTPUT_IMAGE"); itk::wasm::InputTextStream inputTextStream; - pipeline.add_option("InputText", inputTextStream, "The input text")->required()->type_name("INPUT_TEXT_STREAM"); + pipeline.add_option("input-text", inputTextStream, "The input text")->required()->type_name("INPUT_TEXT_STREAM"); itk::wasm::OutputTextStream outputTextStream; - pipeline.add_option("OutputText", outputTextStream, "The output text")->required()->type_name("OUTPUT_TEXT_STREAM"); + pipeline.add_option("output-text", outputTextStream, "The output text")->required()->type_name("OUTPUT_TEXT_STREAM"); itk::wasm::InputBinaryStream inputBinaryStream; - pipeline.add_option("InputBinary", inputBinaryStream, "The input text")->required()->type_name("INPUT_BINARY_STREAM"); + pipeline.add_option("input-binary", inputBinaryStream, "The input text")->required()->type_name("INPUT_BINARY_STREAM"); using InputImageType = itk::wasm::InputImage; itk::wasm::OutputBinaryStream outputBinaryStream; - pipeline.add_option("OutputBinary", outputBinaryStream, "The output binary")->required()->type_name("OUTPUT_BINARY_STREAM"); + pipeline.add_option("output-binary", outputBinaryStream, "The output binary")->required()->type_name("OUTPUT_BINARY_STREAM"); using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "The input mesh")->required()->type_name("INPUT_MESH"); + pipeline.add_option("input-mesh", inputMesh, "The input mesh")->required()->type_name("INPUT_MESH"); using OutputMeshType = itk::wasm::OutputMesh; OutputMeshType outputMesh; - pipeline.add_option("OutputMesh", outputMesh, "The output mesh")->required()->type_name("OUTPUT_MESH"); + pipeline.add_option("output-mesh", outputMesh, "The output mesh")->required()->type_name("OUTPUT_MESH"); using InputPolyDataType = itk::wasm::InputPolyData; InputPolyDataType inputPolyData; - pipeline.add_option("InputPolyData", inputPolyData, "The input polydata")->required()->type_name("INPUT_POLYDATA"); + pipeline.add_option("input-polydata", inputPolyData, "The input polydata")->required()->type_name("INPUT_POLYDATA"); using OutputPolyDataType = itk::wasm::OutputPolyData; OutputPolyDataType outputPolyData; - pipeline.add_option("OutputPolyData", outputPolyData, "The output polydata")->required()->type_name("OUTPUT_POLYDATA"); + pipeline.add_option("output-polydata", outputPolyData, "The output polydata")->required()->type_name("OUTPUT_POLYDATA"); ITK_WASM_PARSE(pipeline); diff --git a/test/itkSupportInputImageTypesMemoryIOTest.cxx b/test/itkSupportInputImageTypesMemoryIOTest.cxx index beab52c2f..fd1baa98c 100644 --- a/test/itkSupportInputImageTypesMemoryIOTest.cxx +++ b/test/itkSupportInputImageTypesMemoryIOTest.cxx @@ -31,11 +31,11 @@ class PipelineFunctor using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image")->required(); + pipeline.add_option("input-image", inputImage, "The input image")->required()->type_name("INPUT_IMAGE"); using OutputImageType = itk::wasm::OutputImage; OutputImageType outputImage; - pipeline.add_option("OutputImage", outputImage, "The output image")->required(); + pipeline.add_option("output-image", outputImage, "The output image")->required()->type_name("OUTPUT_IMAGE"); ITK_WASM_PARSE(pipeline); @@ -73,10 +73,10 @@ itkSupportInputImageTypesMemoryIOTest(int argc, char * argv[]) const char * mockArgv[] = {"itkSupportInputImageTypesMemoryIOTest", "--memory-io", "0", "0", NULL}; - itk::wasm::Pipeline pipeline("SupportInputImageTypesMemoryIOTest", "Test supporting multiple input image types in memory", 4, const_cast< char ** >(mockArgv)); + itk::wasm::Pipeline pipeline("support-input-image-type-memory-io-test", "Test supporting multiple input image types in memory", 4, const_cast< char ** >(mockArgv)); return itk::wasm::SupportInputImageTypes - ::Dimensions<2U,3U>("InputImage", pipeline); + ::Dimensions<2U,3U>("input-image", pipeline); } diff --git a/test/itkSupportInputImageTypesTest.cxx b/test/itkSupportInputImageTypesTest.cxx index f4f26be17..8649a43ba 100644 --- a/test/itkSupportInputImageTypesTest.cxx +++ b/test/itkSupportInputImageTypesTest.cxx @@ -31,11 +31,11 @@ class PipelineFunctor using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image")->required(); + pipeline.add_option("input-image", inputImage, "The input image")->required(); using OutputImageType = itk::wasm::OutputImage; OutputImageType outputImage; - pipeline.add_option("OutputImage", outputImage, "The output image")->required(); + pipeline.add_option("output-image", outputImage, "The output image")->required(); ITK_WASM_PARSE(pipeline); @@ -48,10 +48,10 @@ class PipelineFunctor int itkSupportInputImageTypesTest(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("SupportInputImageTypesTest", "Test supporting multiple input image types", argc, argv); + itk::wasm::Pipeline pipeline("support-input-image-types-test", "Test supporting multiple input image types", argc, argv); return itk::wasm::SupportInputImageTypes - ::Dimensions<2U,3U>("InputImage", pipeline); + ::Dimensions<2U,3U>("input-image", pipeline); } diff --git a/test/itkSupportInputMeshTypesMemoryIOTest.cxx b/test/itkSupportInputMeshTypesMemoryIOTest.cxx index cdf661f50..13ac5976f 100644 --- a/test/itkSupportInputMeshTypesMemoryIOTest.cxx +++ b/test/itkSupportInputMeshTypesMemoryIOTest.cxx @@ -32,11 +32,11 @@ class PipelineFunctor using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "The input mesh")->required(); + pipeline.add_option("input-mesh", inputMesh, "The input mesh")->required()->type_name("INPUT_MESH"); using OutputMeshType = itk::wasm::OutputMesh; OutputMeshType outputMesh; - pipeline.add_option("OutputMesh", outputMesh, "The output mesh")->required(); + pipeline.add_option("output-mesh", outputMesh, "The output mesh")->required()->type_name("OUTPUT_MESH"); ITK_WASM_PARSE(pipeline); @@ -74,10 +74,10 @@ itkSupportInputMeshTypesMemoryIOTest(int argc, char * argv[]) const char * mockArgv[] = {"itkSupportInputMeshTypesMemoryIOTest", "--memory-io", "0", "0", NULL}; - itk::wasm::Pipeline pipeline("SupportInputMeshTypesMemoryIOTest", "Test supporting multiple input mesh types in memory", 4, const_cast< char ** >(mockArgv)); + itk::wasm::Pipeline pipeline("support-input-mesh-types-memory-io-test", "Test supporting multiple input mesh types in memory", 4, const_cast< char ** >(mockArgv)); return itk::wasm::SupportInputMeshTypes - ::Dimensions<2U,3U>("InputMesh", pipeline); + ::Dimensions<2U,3U>("input-mesh", pipeline); } diff --git a/test/itkSupportInputMeshTypesTest.cxx b/test/itkSupportInputMeshTypesTest.cxx index 064d8996f..69a5840ef 100644 --- a/test/itkSupportInputMeshTypesTest.cxx +++ b/test/itkSupportInputMeshTypesTest.cxx @@ -32,11 +32,11 @@ class PipelineFunctor using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "The input mesh")->required(); + pipeline.add_option("input-mesh", inputMesh, "The input mesh")->required()->type_name("INPUT_MESH"); using OutputMeshType = itk::wasm::OutputMesh; OutputMeshType outputMesh; - pipeline.add_option("OutputMesh", outputMesh, "The output mesh")->required(); + pipeline.add_option("output-mesh", outputMesh, "The output mesh")->required()->type_name("OUTPUT_MESH"); ITK_WASM_PARSE(pipeline); @@ -49,12 +49,12 @@ class PipelineFunctor int itkSupportInputMeshTypesTest(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("SupportInputMeshTypesTest", "Test supporting multiple input mesh types", argc, argv); + itk::wasm::Pipeline pipeline("support-input-mesh-types-test", "Test supporting multiple input mesh types", argc, argv); itk::WASMMeshIOFactory::RegisterOneFactory(); return itk::wasm::SupportInputMeshTypes - ::Dimensions<2U,3U>("InputMesh", pipeline); + ::Dimensions<2U,3U>("input-mesh", pipeline); } diff --git a/test/itkSupportInputPolyDataTypesTest.cxx b/test/itkSupportInputPolyDataTypesTest.cxx index 9363cedf4..eb7bc41d5 100644 --- a/test/itkSupportInputPolyDataTypesTest.cxx +++ b/test/itkSupportInputPolyDataTypesTest.cxx @@ -32,11 +32,11 @@ class PipelineFunctor using InputPolyDataType = itk::wasm::InputPolyData; InputPolyDataType inputPolyData; - pipeline.add_option("InputPolyData", inputPolyData, "The input mesh")->required(); + pipeline.add_option("input-polydata", inputPolyData, "The input polydata")->required()->type_name("INPUT_POLYDATA"); using OutputPolyDataType = itk::wasm::OutputPolyData; OutputPolyDataType outputPolyData; - pipeline.add_option("OutputPolyData", outputPolyData, "The output mesh")->required(); + pipeline.add_option("output-polydata", outputPolyData, "The output polydata")->required()->type_name("OUTPUT_POLYDATA"); ITK_WASM_PARSE(pipeline); @@ -49,10 +49,10 @@ class PipelineFunctor int itkSupportInputPolyDataTypesTest(int argc, char * argv[]) { - itk::wasm::Pipeline pipeline("SupportInputPolyDataTypesTest", "Test supporting multiple input mesh types", argc, argv); + itk::wasm::Pipeline pipeline("support-input-polydata-types-test", "Test supporting multiple input mesh types", argc, argv); itk::WASMMeshIOFactory::RegisterOneFactory(); return itk::wasm::SupportInputPolyDataTypes - ::PixelTypes("InputPolyData", pipeline); + ::PixelTypes("input-polydata", pipeline); } diff --git a/test/node/core/loadEmscriptenModuleNodeTest.js b/test/node/core/loadEmscriptenModuleNodeTest.js index d65fbf147..eac2019ad 100644 --- a/test/node/core/loadEmscriptenModuleNodeTest.js +++ b/test/node/core/loadEmscriptenModuleNodeTest.js @@ -6,8 +6,8 @@ import loadModule from '../../../dist/core/internal/loadEmscriptenModuleNode.js' test('load a module', async t => { const imageIOsPath = path.resolve('dist', 'image-io') - const modulePath = path.join(imageIOsPath, 'PNGImageIOReadImage.js') - const wasmBinaryPath = path.join(imageIOsPath, 'PNGImageIOReadImage.wasm') + const modulePath = path.join(imageIOsPath, 'PNGImageIO-read-image.js') + const wasmBinaryPath = path.join(imageIOsPath, 'PNGImageIO-read-image.wasm') const wasmBinary = fs.readFileSync(wasmBinaryPath) const loaded = await loadModule(modulePath, wasmBinary) t.truthy(loaded) diff --git a/test/node/pipeline/runPipelineNodeTest.js b/test/node/pipeline/runPipelineNodeTest.js index 35e61771c..674717455 100644 --- a/test/node/pipeline/runPipelineNodeTest.js +++ b/test/node/pipeline/runPipelineNodeTest.js @@ -10,7 +10,7 @@ test('runPipelineNode captures stdout and stderr', (t) => { const args = [] const outputs = null const inputs = null - const stdoutStderrPath = path.resolve('test', 'pipelines', 'StdoutStderrPipeline', 'web-build', 'StdoutStderrTest') + const stdoutStderrPath = path.resolve('test', 'pipelines', 'stdout-stderr-pipeline', 'web-build', 'stdout-stderr-test') return runPipelineNode(stdoutStderrPath, args, outputs, inputs) .then(function ({ returnValue, stdout, stderr }) { t.is(returnValue, 0) @@ -26,7 +26,7 @@ Click. Perfect success. }) test('runPipelineNode uses input and output files in the Emscripten filesystem', (t) => { - const pipelinePath = path.resolve('test', 'pipelines', 'InputOutputFilesPipeline', 'web-build', 'InputOutputFilesTest') + const pipelinePath = path.resolve('test', 'pipelines', 'input-output-files-pipeline', 'web-build', 'input-output-files-test') const args = ['--use-files', '--input-text-file', './input.txt', '--input-binary-file', './input.bin', @@ -63,7 +63,7 @@ test('runPipelineNode uses input and output files in the Emscripten filesystem', }) test('runPipelineNode uses input and output text and binary data via memory io', (t) => { - const pipelinePath = path.resolve('test', 'pipelines', 'InputOutputFilesPipeline', 'web-build', 'InputOutputFilesTest') + const pipelinePath = path.resolve('test', 'pipelines', 'input-output-files-pipeline', 'web-build', 'input-output-files-test') const args = ['--memory-io', '--input-text-stream', '0', '--input-binary-stream', '1', @@ -111,7 +111,7 @@ test('runPipelineNode writes and reads an itk.Image via memory io', (t) => { return readImageLocalFile(testInputFilePath) .then(function (image) { - const pipelinePath = path.resolve('test', 'pipelines', 'MedianFilterPipeline', 'web-build', 'MedianFilterTest') + const pipelinePath = path.resolve('test', 'pipelines', 'median-filter-pipeline', 'web-build', 'median-filter-test') const args = ['--memory-io', '0', '0', @@ -141,7 +141,7 @@ test('runPipelineNode writes and reads an itk.Mesh in the Emscripten filesystem' return readMeshLocalFile(testMeshInputFilePath) .then(function (mesh) { - const pipelinePath = path.resolve('test', 'pipelines', 'MeshReadWritePipeline', 'web-build', 'MeshReadWriteTest') + const pipelinePath = path.resolve('test', 'pipelines', 'mesh-read-write-pipeline', 'web-build', 'mesh-read-write-test') const args = ['./cow.vtk.iwm', './cow.vtk.written.iwm'] const desiredOutputs = [ { path: args[1], type: IOTypes.Mesh } @@ -168,7 +168,7 @@ test('runPipelineNode writes and reads an itk.Mesh via memory io', (t) => { return readMeshLocalFile(testMeshInputFilePath) .then(function (mesh) { - const pipelinePath = path.resolve('test', 'pipelines', 'MeshReadWritePipeline', 'web-build', 'MeshReadWriteTest') + const pipelinePath = path.resolve('test', 'pipelines', 'mesh-read-write-pipeline', 'web-build', 'mesh-read-write-test') const args = ['0', '0', '--memory-io'] const desiredOutputs = [ { type: InterfaceTypes.Mesh } diff --git a/test/pipelines/StdoutStderrPipeline/CMakeLists.txt b/test/pipelines/StdoutStderrPipeline/CMakeLists.txt deleted file mode 100644 index 7f96bff39..000000000 --- a/test/pipelines/StdoutStderrPipeline/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(StdoutStderrTest) - -find_package(ITK REQUIRED - COMPONENTS WebAssemblyInterface) -add_executable(StdoutStderrTest StdoutStderrTest.cxx) -target_link_libraries(StdoutStderrTest PUBLIC WebAssemblyInterface) - -enable_testing() -add_test(NAME StdoutStderrTest - COMMAND StdoutStderrTest - ) diff --git a/test/pipelines/InputOutputFilesPipeline/CMakeLists.txt b/test/pipelines/input-output-files-pipeline/CMakeLists.txt similarity index 72% rename from test/pipelines/InputOutputFilesPipeline/CMakeLists.txt rename to test/pipelines/input-output-files-pipeline/CMakeLists.txt index de449d1f6..7ea1e37b5 100644 --- a/test/pipelines/InputOutputFilesPipeline/CMakeLists.txt +++ b/test/pipelines/input-output-files-pipeline/CMakeLists.txt @@ -1,25 +1,25 @@ cmake_minimum_required(VERSION 3.16) -project(InputOutputFilesTest) +project(input-output-files-test) set(CMAKE_CXX_STANDARD 17) find_package(ITK REQUIRED COMPONENTS WebAssemblyInterface) include(${ITK_USE_FILE}) -add_executable(InputOutputFilesTest InputOutputFilesTest.cxx) -target_link_libraries(InputOutputFilesTest PUBLIC WebAssemblyInterface) +add_executable(input-output-files-test input-output-files-test.cxx) +target_link_libraries(input-output-files-test PUBLIC WebAssemblyInterface) enable_testing() add_test(NAME InputOutputStreamsTest - COMMAND InputOutputFilesTest + COMMAND input-output-files-test --input-text-stream ${CMAKE_CURRENT_SOURCE_DIR}/input.txt --input-binary-stream ${CMAKE_CURRENT_SOURCE_DIR}/input.bin --output-text-stream ${CMAKE_CURRENT_BINARY_DIR}/output.txt --output-binary-stream ${CMAKE_CURRENT_BINARY_DIR}/output.bin ) -add_test(NAME InputOutputFilesTest - COMMAND InputOutputFilesTest +add_test(NAME input-output-files-test + COMMAND input-output-files-test --use-files --input-text-file ${CMAKE_CURRENT_SOURCE_DIR}/input.txt --input-binary-file ${CMAKE_CURRENT_SOURCE_DIR}/input.bin diff --git a/test/pipelines/InputOutputFilesPipeline/InputOutputFilesTest.cxx b/test/pipelines/input-output-files-pipeline/input-output-files-test.cxx similarity index 85% rename from test/pipelines/InputOutputFilesPipeline/InputOutputFilesTest.cxx rename to test/pipelines/input-output-files-pipeline/input-output-files-test.cxx index fe5e8f1c6..8be279f5e 100644 --- a/test/pipelines/InputOutputFilesPipeline/InputOutputFilesTest.cxx +++ b/test/pipelines/input-output-files-pipeline/input-output-files-test.cxx @@ -26,36 +26,36 @@ int main( int argc, char * argv[] ) { - itk::wasm::Pipeline pipeline("A pipeline to test general binary and text IO", argc, argv); + itk::wasm::Pipeline pipeline("input-output-files-test", "A pipeline to test general binary and text IO", argc, argv); bool useFiles = false; pipeline.add_flag("-f,--use-files", useFiles, "Use files -- otherwise use stream objects"); itk::wasm::InputTextStream inputTextStream; - pipeline.add_option("--input-text-stream", inputTextStream, "The input text stream")->group("Streams"); + pipeline.add_option("--input-text-stream", inputTextStream, "The input text stream")->group("Streams")->type_name("INPUT_TEXT_STREAM"); itk::wasm::OutputTextStream outputTextStream; - pipeline.add_option("--output-text-stream", outputTextStream, "The output text stream")->group("Streams"); + pipeline.add_option("--output-text-stream", outputTextStream, "The output text stream")->group("Streams")->type_name("OUTPUT_TEXT_STREAM"); itk::wasm::InputBinaryStream inputBinaryStream; - pipeline.add_option("--input-binary-stream", inputBinaryStream, "The input binary stream")->group("Streams"); + pipeline.add_option("--input-binary-stream", inputBinaryStream, "The input binary stream")->group("Streams")->type_name("INPUT_BINARY_STREAM"); itk::wasm::OutputBinaryStream outputBinaryStream; - pipeline.add_option("--output-binary-stream", outputBinaryStream, "The output binary stream")->group("Streams"); + pipeline.add_option("--output-binary-stream", outputBinaryStream, "The output binary stream")->group("Streams")->type_name("OUTPUT_BINARY_STREAM"); std::string inputTextFile; - pipeline.add_option("--input-text-file", inputTextFile, "The input text file")->group("Files"); + pipeline.add_option("--input-text-file", inputTextFile, "The input text file")->group("Files")->type_name("INPUT_TEXT_FILE"); std::string outputTextFile; - pipeline.add_option("--output-text-file", outputTextFile, "The output text file")->group("Files"); + pipeline.add_option("--output-text-file", outputTextFile, "The output text file")->group("Files")->type_name("OUTPUT_TEXT_FILE"); std::string inputBinaryFile; - pipeline.add_option("--input-binary-file", inputBinaryFile, "The input binary file")->group("Files"); + pipeline.add_option("--input-binary-file", inputBinaryFile, "The input binary file")->group("Files")->type_name("INPUT_BINARY_FILE"); std::string outputBinaryFile; - pipeline.add_option("--output-binary-file", outputBinaryFile, "The output binary file")->group("Files"); + pipeline.add_option("--output-binary-file", outputBinaryFile, "The output binary file")->group("Files")->type_name("OUTPUT_BINARY_FILE"); ITK_WASM_PARSE(pipeline); diff --git a/test/pipelines/InputOutputFilesPipeline/input.bin b/test/pipelines/input-output-files-pipeline/input.bin similarity index 100% rename from test/pipelines/InputOutputFilesPipeline/input.bin rename to test/pipelines/input-output-files-pipeline/input.bin diff --git a/test/pipelines/InputOutputFilesPipeline/input.txt b/test/pipelines/input-output-files-pipeline/input.txt similarity index 100% rename from test/pipelines/InputOutputFilesPipeline/input.txt rename to test/pipelines/input-output-files-pipeline/input.txt diff --git a/test/pipelines/MedianFilterPipeline/CMakeLists.txt b/test/pipelines/median-filter-pipeline/CMakeLists.txt similarity index 61% rename from test/pipelines/MedianFilterPipeline/CMakeLists.txt rename to test/pipelines/median-filter-pipeline/CMakeLists.txt index 7f70bac0b..caf72c20c 100644 --- a/test/pipelines/MedianFilterPipeline/CMakeLists.txt +++ b/test/pipelines/median-filter-pipeline/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(MedianFilterTest) +project(median-filter-test) set(CMAKE_CXX_STANDARD 17) @@ -17,12 +17,12 @@ find_package(ITK REQUIRED ) include(${ITK_USE_FILE}) -add_executable(MedianFilterTest MedianFilterTest.cxx) -target_link_libraries(MedianFilterTest PUBLIC ${ITK_LIBRARIES}) +add_executable(median-filter-test median-filter-test.cxx) +target_link_libraries(median-filter-test PUBLIC ${ITK_LIBRARIES}) enable_testing() -add_test(NAME MedianFilterTest - COMMAND MedianFilterTest ${CMAKE_CURRENT_SOURCE_DIR}/cthead1.iwi.cbor +add_test(NAME median-filter-test + COMMAND median-filter-test ${CMAKE_CURRENT_SOURCE_DIR}/cthead1.iwi.cbor ${CMAKE_CURRENT_BINARY_DIR}/cthead1.shrink.iwi --radius 4 ) diff --git a/test/pipelines/MedianFilterPipeline/cthead1.iwi.cbor b/test/pipelines/median-filter-pipeline/cthead1.iwi.cbor similarity index 100% rename from test/pipelines/MedianFilterPipeline/cthead1.iwi.cbor rename to test/pipelines/median-filter-pipeline/cthead1.iwi.cbor diff --git a/test/pipelines/MedianFilterPipeline/MedianFilterTest.cxx b/test/pipelines/median-filter-pipeline/median-filter-test.cxx similarity index 90% rename from test/pipelines/MedianFilterPipeline/MedianFilterTest.cxx rename to test/pipelines/median-filter-pipeline/median-filter-test.cxx index 0b52505ff..00d3098c9 100644 --- a/test/pipelines/MedianFilterPipeline/MedianFilterTest.cxx +++ b/test/pipelines/median-filter-pipeline/median-filter-test.cxx @@ -32,11 +32,11 @@ MedianFilter(itk::wasm::Pipeline & pipeline, const TImage * inputImage) { using ImageType = TImage; - pipeline.get_option("InputImage")->required()->type_name("INPUT_IMAGE"); + pipeline.get_option("input-image")->required()->type_name("INPUT_IMAGE"); using OutputImageType = itk::wasm::OutputImage; OutputImageType outputImage; - pipeline.add_option("OutputImage", outputImage, "The output image")->required()->type_name("OUTPUT_IMAGE"); + pipeline.add_option("output-image", outputImage, "The output image")->required()->type_name("OUTPUT_IMAGE"); unsigned int radius = 1; pipeline.add_option("-r,--radius", radius, "Kernel radius in pixels"); @@ -99,7 +99,7 @@ class PipelineFunctor using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image"); + pipeline.add_option("input-image", inputImage, "The input image"); ITK_WASM_PRE_PARSE(pipeline); @@ -119,7 +119,7 @@ class PipelineFunctor, VDimension>> using InputImageType = itk::wasm::InputImage; InputImageType inputImage; - pipeline.add_option("InputImage", inputImage, "The input image"); + pipeline.add_option("input-image", inputImage, "The input image"); ITK_WASM_PRE_PARSE(pipeline); @@ -136,11 +136,11 @@ class PipelineFunctor, VDimension>> int main( int argc, char * argv[] ) { - itk::wasm::Pipeline pipeline("MedianFilter", "Apply a median filter to an image", argc, argv); + itk::wasm::Pipeline pipeline("median-filter", "Apply a median filter to an image", argc, argv); return itk::wasm::SupportInputImageTypesNoVectorImage, float> - ::Dimensions<2U,3U>("InputImage", pipeline); + ::Dimensions<2U,3U>("input-image", pipeline); } diff --git a/test/pipelines/MeshReadWritePipeline/CMakeLists.txt b/test/pipelines/mesh-read-write-pipeline/CMakeLists.txt similarity index 55% rename from test/pipelines/MeshReadWritePipeline/CMakeLists.txt rename to test/pipelines/mesh-read-write-pipeline/CMakeLists.txt index 2aa572432..71b99d45b 100644 --- a/test/pipelines/MeshReadWritePipeline/CMakeLists.txt +++ b/test/pipelines/mesh-read-write-pipeline/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(MeshReadWriteTest) +project(mesh-read-write-test) set(CMAKE_CXX_STANDARD 17) @@ -14,26 +14,26 @@ find_package(ITK REQUIRED ) include(${ITK_USE_FILE}) -add_executable(MeshReadWriteTest MeshReadWriteTest.cxx) -target_link_libraries(MeshReadWriteTest PUBLIC ${ITK_LIBRARIES}) +add_executable(mesh-read-write-test mesh-read-write-test.cxx) +target_link_libraries(mesh-read-write-test PUBLIC ${ITK_LIBRARIES}) enable_testing() -add_test(NAME MeshReadWriteTest - COMMAND MeshReadWriteTest ${CMAKE_CURRENT_SOURCE_DIR}/cow.vtk +add_test(NAME mesh-read-write-test + COMMAND mesh-read-write-test ${CMAKE_CURRENT_SOURCE_DIR}/cow.vtk ${CMAKE_CURRENT_BINARY_DIR}/cow.written.vtk ) add_test(NAME MeshReadWriteWASMTest - COMMAND MeshReadWriteTest ${CMAKE_CURRENT_SOURCE_DIR}/cow.vtk + COMMAND mesh-read-write-test ${CMAKE_CURRENT_SOURCE_DIR}/cow.vtk ${CMAKE_CURRENT_BINARY_DIR}/cow.iwm ) add_test(NAME MeshReadWriteWASMCBORTest - COMMAND MeshReadWriteTest ${CMAKE_CURRENT_SOURCE_DIR}/cow.vtk + COMMAND mesh-read-write-test ${CMAKE_CURRENT_SOURCE_DIR}/cow.vtk ${CMAKE_CURRENT_BINARY_DIR}/cow.iwm.cbor ) add_test(NAME MeshReadWriteWASMInputTest - COMMAND MeshReadWriteTest ${CMAKE_CURRENT_BINARY_DIR}/cow.iwm + COMMAND mesh-read-write-test ${CMAKE_CURRENT_BINARY_DIR}/cow.iwm ${CMAKE_CURRENT_BINARY_DIR}/cow.out.iwm ) diff --git a/test/pipelines/MeshReadWritePipeline/cow.vtk b/test/pipelines/mesh-read-write-pipeline/cow.vtk similarity index 100% rename from test/pipelines/MeshReadWritePipeline/cow.vtk rename to test/pipelines/mesh-read-write-pipeline/cow.vtk diff --git a/test/pipelines/MeshReadWritePipeline/MeshReadWriteTest.cxx b/test/pipelines/mesh-read-write-pipeline/mesh-read-write-test.cxx similarity index 80% rename from test/pipelines/MeshReadWritePipeline/MeshReadWriteTest.cxx rename to test/pipelines/mesh-read-write-pipeline/mesh-read-write-test.cxx index 210c67a19..da252114b 100644 --- a/test/pipelines/MeshReadWritePipeline/MeshReadWriteTest.cxx +++ b/test/pipelines/mesh-read-write-pipeline/mesh-read-write-test.cxx @@ -22,7 +22,7 @@ int main( int argc, char * argv[] ) { - itk::wasm::Pipeline pipeline("MeshReadWriteTest", "A test for reading and writing meshes", argc, argv); + itk::wasm::Pipeline pipeline("mesh-read-write-test", "A test for reading and writing meshes", argc, argv); using PixelType = float; constexpr unsigned int Dimension = 3; @@ -30,11 +30,11 @@ int main( int argc, char * argv[] ) using InputMeshType = itk::wasm::InputMesh; InputMeshType inputMesh; - pipeline.add_option("InputMesh", inputMesh, "The input mesh")->required(); + pipeline.add_option("input-mesh", inputMesh, "The input mesh")->required()->type_name("INPUT_MESH"); using OutputMeshType = itk::wasm::OutputMesh; OutputMeshType outputMesh; - pipeline.add_option("OutputMesh", outputMesh, "The output mesh")->required(); + pipeline.add_option("output-mesh", outputMesh, "The output mesh")->required()->type_name("OUTPUT_MESH"); ITK_WASM_PARSE(pipeline); diff --git a/test/pipelines/ReadImage/CMakeLists.txt b/test/pipelines/read-image/CMakeLists.txt similarity index 53% rename from test/pipelines/ReadImage/CMakeLists.txt rename to test/pipelines/read-image/CMakeLists.txt index 2f9ead9c1..043336ab9 100644 --- a/test/pipelines/ReadImage/CMakeLists.txt +++ b/test/pipelines/read-image/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(ReadImage) +project(read-image) set(CMAKE_CXX_STANDARD 17) @@ -9,11 +9,11 @@ find_package(ITK REQUIRED ) include(${ITK_USE_FILE}) -add_executable(ReadImage ReadImage.cxx) -target_link_libraries(ReadImage PUBLIC ${ITK_LIBRARIES}) +add_executable(read-image read-image.cxx) +target_link_libraries(read-image PUBLIC ${ITK_LIBRARIES}) enable_testing() -add_test(NAME ReadImageTest - COMMAND ReadImage ${CMAKE_CURRENT_SOURCE_DIR}/cthead1.png +add_test(NAME read-imageTest + COMMAND read-image ${CMAKE_CURRENT_SOURCE_DIR}/cthead1.png ${CMAKE_CURRENT_BINARY_DIR}/cthead1.iwi.cbor ) diff --git a/test/pipelines/ReadImage/cthead1.png b/test/pipelines/read-image/cthead1.png similarity index 100% rename from test/pipelines/ReadImage/cthead1.png rename to test/pipelines/read-image/cthead1.png diff --git a/test/pipelines/ReadImage/ReadImage.cxx b/test/pipelines/read-image/read-image.cxx similarity index 100% rename from test/pipelines/ReadImage/ReadImage.cxx rename to test/pipelines/read-image/read-image.cxx diff --git a/test/pipelines/stdout-stderr-pipeline/CMakeLists.txt b/test/pipelines/stdout-stderr-pipeline/CMakeLists.txt new file mode 100644 index 000000000..a893183df --- /dev/null +++ b/test/pipelines/stdout-stderr-pipeline/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.10) +project(stdout-stderr-test) + +find_package(ITK REQUIRED + COMPONENTS WebAssemblyInterface) +add_executable(stdout-stderr-test stdout-stderr-test.cxx) +target_link_libraries(stdout-stderr-test PUBLIC WebAssemblyInterface) + +enable_testing() +add_test(NAME stdout-stderr-test + COMMAND stdout-stderr-test + ) diff --git a/test/pipelines/StdoutStderrPipeline/StdoutStderrTest.cxx b/test/pipelines/stdout-stderr-pipeline/stdout-stderr-test.cxx similarity index 100% rename from test/pipelines/StdoutStderrPipeline/StdoutStderrTest.cxx rename to test/pipelines/stdout-stderr-pipeline/stdout-stderr-test.cxx