-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(WebAssemblyInterface): support vector/multi-component images #1166
fix(WebAssemblyInterface): support vector/multi-component images #1166
Conversation
@@ -84,7 +84,7 @@ class ITK_TEMPLATE_EXPORT OutputImage | |||
|
|||
const auto dataAddress = reinterpret_cast< size_t >( wasmImage->GetImage()->GetBufferPointer() ); | |||
using ConvertPixelTraits = DefaultConvertPixelTraits<typename ImageType::PixelType>; | |||
const auto dataSize = wasmImage->GetImage()->GetPixelContainer()->Size() * sizeof(typename ConvertPixelTraits::ComponentType) * ConvertPixelTraits::GetNumberOfComponents(); | |||
const auto dataSize = wasmImage->GetImage()->GetPixelContainer()->Size() * sizeof(typename ConvertPixelTraits::ComponentType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetPixelContainer()->Size()
already includes number of components.
@thewtex I'm guessing we don't have any multi-component image already in |
@jadh4v thanks for the patch! Yes, could you please add a test, similar to: that uses test/Input/apple.jpg as an input and, |
7d7fb2b
to
68f2174
Compare
My test still fails on image comparison. I think this maybe because of jpeg format?? Trying itk::WriteImage(convertedImage, outputImageFile)
<DartMeasurement name="ImageError apple.jpg" type="numeric/double">1934</DartMeasurement>
<DartMeasurement name="ImageError" type="numeric/double">1934</DartMeasurement>
<DartMeasurement name="ImageError Minimum" type="numeric/double">3</DartMeasurement>
<DartMeasurement name="ImageError Maximum" type="numeric/double">8</DartMeasurement>
<DartMeasurement name="ImageError Mean" type="numeric/double">3.42037</DartMeasurement>
<DartMeasurementFile name="DifferenceImage" type="image/png">/home/jadhav/code/native-itkwasm/ITK-Wasm-build/Testing/Temporary/WebAssemblyInterface/itkWasmVectorImageInterfaceTest.jpg.diff.png</DartMeasurementFile>
<DartMeasurementFile name="BaselineImage" type="image/png">/home/jadhav/code/native-itkwasm/ITK-Wasm-build/Testing/Temporary/WebAssemblyInterface/itkWasmVectorImageInterfaceTest.jpg.base.png</DartMeasurementFile>
<DartMeasurementFile name="TestImage" type="image/png">/home/jadhav/code/native-itkwasm/ITK-Wasm-build/Testing/Temporary/WebAssemblyInterface/itkWasmVectorImageInterfaceTest.jpg.test.png</DartMeasurementFile>
<DartMeasurement name="BaselineImageName" type="text/string">apple.jpg</DartMeasurement> |
@jadh4v thanks!
Yes, we can use .mha -- I will create a patch, add it to the branch. I will build / push the docker images and update the branch accordingly. |
68f2174
to
b89bcb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
Fix buffer size calculations and number of components for handling vector images.