Skip to content
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

Dose it support 4d interpolation? #120

Closed
realyyz opened this issue Apr 16, 2024 · 4 comments
Closed

Dose it support 4d interpolation? #120

realyyz opened this issue Apr 16, 2024 · 4 comments

Comments

@realyyz
Copy link

realyyz commented Apr 16, 2024

I have a series of the ground truth of the segmentation of 3d images on different time step, I would like to make the interpolation. But I didn't succeed. This is what I got:


ExitTrap Traceback (most recent call last)
Cell In[43], line 2
1 WASMTIME_BACKTRACE_DETAILS=1
----> 2 filled = morphological_contour_interpolation(itkwasm_image)

File \lib\site-packages\itkwasm_morphological_contour_interpolation_wasi\morphological_contour_interpolation.py:130, in morphological_contour_interpolation(input_image, label, axis, no_heuristic_alignment, no_use_distance_transform, use_custom_slice_positions, no_use_extrapolation, use_ball_structuring_element, labeled_slice_indices_axis, labeled_slice_indices_label, labeled_slice_indices)
126 for value in labeled_slice_indices:
127 args.append(str(value))
--> 130 outputs = _pipeline.run(args, pipeline_outputs, pipeline_inputs)
132 result = outputs[0].data
133 return result

File \lib\site-packages\itkwasm\pipeline.py:465, in Pipeline.run(self, args, outputs, inputs)
461 raise ValueError(f'Unexpected/not yet supported output.type {output.type}')
463 populated_outputs.append(output_data)
--> 465 ri.delayed_exit(return_code)
467 # Should we be returning the return_code?
468 return tuple(populated_outputs)

File \lib\site-packages\itkwasm\pipeline.py:131, in RunInstance.delayed_exit(self, return_code)
129 def delayed_exit(self, return_code):
130 func = self._instance.exports(self._store)["itk_wasm_delayed_exit"]
--> 131 func(self._store, return_code)

File \lib\site-packages\wasmtime_func.py:101, in Func.call(self, store, *params)
92 error = ffi.wasmtime_func_call(
93 store._context(),
94 byref(self._func),
(...)
98 len(result_tys),
99 trap)
100 if error:
--> 101 raise WasmtimeError._from_ptr(error)
103 results = []
104 for i in range(0, len(result_tys)):

ExitTrap: error while executing at wasm backtrace:
0: 0x4ba6a - !<wasm function 964>
1: 0x204937 - !<wasm function 3517>
note: using the WASMTIME_BACKTRACE_DETAILS=1 environment variable may show more debugging information

Caused by:
Exited with i32 exit status 1

==========================================================

I sincerely appreciate your help!

@dzenanz
Copy link
Member

dzenanz commented Apr 16, 2024

ValueError(f'Unexpected/not yet supported output.type {output.type}') seems to be related to WASM wrapping. It is possible 4D images are not wrapped. @thewtex might provide more insight or advice.

@realyyz
Copy link
Author

realyyz commented Apr 16, 2024

Thank you for your reply. This is the code that I use to test during 4d:


image_4d = np.zeros((3, 100, 100, 100), dtype=np.int16)
image = itk.GetImageFromArray(image_4d)
image_dict = itk.dict_from_image(image)
from itkwasm import Image
itkwasm_image = Image(**image_dict)
filled = morphological_contour_interpolation(itkwasm_image)

I have tried the similar code in 3d, it preforms very well, but when it comes to 4d, there are errors.

@thewtex
Copy link
Collaborator

thewtex commented Apr 16, 2024

I added 4D support to wasm in #121, built and pushed as 1.1.0. Please give it a try and let us know how it goes.

@realyyz
Copy link
Author

realyyz commented Apr 17, 2024

@dzenanz @thewtex Thank you for your help, I have successfully make the interpolation in 3d!

@thewtex thewtex closed this as completed Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants