-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1166 from jadh4v/fix-WebAssemblyInterface-vector-…
…images fix(WebAssemblyInterface): support vector/multi-component images
- Loading branch information
Showing
9 changed files
with
80 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+210 Bytes
(100%)
...pare-images-wasi/itkwasm_compare_images_wasi/wasm_modules/compare-double-images.wasi.wasm
Binary file not shown.
Binary file modified
BIN
+175 Bytes
(100%)
...m-compare-images-wasi/itkwasm_compare_images_wasi/wasm_modules/vector-magnitude.wasi.wasm
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
const defaultImageTag = '20240605-0b83f08b' | ||
const defaultImageTag = '20240624-b89bcb6c' | ||
export default defaultImageTag |
Binary file modified
BIN
+67 Bytes
(100%)
...sm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/apply-presentation-state-to-image.wasi.wasm
Binary file not shown.
Binary file modified
BIN
-96.7 KB
(99%)
...itkwasm-dicom-wasi/itkwasm_dicom_wasi/wasm_modules/read-image-dicom-file-series.wasi.wasm
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*========================================================================= | ||
* | ||
* Copyright NumFOCUS | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*=========================================================================*/ | ||
#include "itkImageToWasmImageFilter.h" | ||
#include "itkWasmImageToImageFilter.h" | ||
|
||
#include "itkImageFileReader.h" | ||
#include "itkImageFileWriter.h" | ||
#include "itkTestingMacros.h" | ||
|
||
int | ||
itkWasmVectorImageInterfaceTest(int argc, char * argv[]) | ||
{ | ||
if (argc < 3) | ||
{ | ||
std::cerr << "Missing parameters" << std::endl; | ||
std::cerr << "Usage: " << itkNameOfTestExecutableMacro(argv) << " InputImage OutputImage" << std::endl; | ||
return EXIT_FAILURE; | ||
} | ||
const char * inputImageFile = argv[1]; | ||
const char * outputImageFile = argv[2]; | ||
|
||
constexpr unsigned int Dimension = 2; | ||
using PixelType = unsigned char; | ||
using ImageType = itk::VectorImage<PixelType, Dimension>; | ||
using ImagePointer = ImageType::Pointer; | ||
|
||
ImagePointer inputImage = nullptr; | ||
ITK_TRY_EXPECT_NO_EXCEPTION(inputImage = itk::ReadImage<ImageType>(inputImageFile)); | ||
std::cout << "inputImage: " << inputImage << std::endl; | ||
|
||
using ImageToWasmImageFilterType = itk::ImageToWasmImageFilter<ImageType>; | ||
auto imageToJSON = ImageToWasmImageFilterType::New(); | ||
imageToJSON->SetInput(inputImage); | ||
imageToJSON->Update(); | ||
auto imageJSON = imageToJSON->GetOutput(); | ||
std::cout << "Image JSON: " << imageJSON->GetJSON() << std::endl; | ||
|
||
using WasmImageToImageFilterType = itk::WasmImageToImageFilter<ImageType>; | ||
auto jsonToImage = WasmImageToImageFilterType::New(); | ||
jsonToImage->SetInput(imageToJSON->GetOutput()); | ||
jsonToImage->Update(); | ||
ImageType::Pointer convertedImage = jsonToImage->GetOutput(); | ||
|
||
std::cout << "convertedImage: " << convertedImage << std::endl; | ||
|
||
ITK_TRY_EXPECT_NO_EXCEPTION(itk::WriteImage(convertedImage, outputImageFile)); | ||
|
||
return EXIT_SUCCESS; | ||
} |