ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkWasmExports.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkWasmExports_h
19#define itkWasmExports_h
20
21#ifndef ITK_WASM_NO_MEMORY_IO
22// WebAssembly exports for memory io
23
24# include "itkWasmDataObject.h"
25
26# if defined(__EMSCRIPTEN__)
27# include "emscripten/em_macros.h"
28# else
29# define EMSCRIPTEN_KEEPALIVE
30# endif
31
32# include "WebAssemblyInterfaceExport.h"
33
34namespace itk
35{
36namespace wasm
37{
38
39// dataset index, array index
40using InputArrayStoreKeyType = std::pair<uint32_t, uint32_t>;
41using InputArrayStoreValueType = std::vector<uint8_t>;
42using InputArrayStoreType = std::map<InputArrayStoreKeyType, InputArrayStoreValueType>;
43
44// Function for the Pipeline Input's and Output's to set / get from the memory store
45
46const WebAssemblyInterface_EXPORT std::string &
47 getMemoryStoreInputJSON(uint32_t memoryIndex, uint32_t index);
48
49const WebAssemblyInterface_EXPORT InputArrayStoreType &
51
52WebAssemblyInterface_EXPORT void
53setMemoryStoreOutputDataObject(uint32_t memoryIndex, uint32_t index, const WasmDataObject * dataObject);
54
55WebAssemblyInterface_EXPORT void
56setMemoryStoreOutputArray(uint32_t memoryIndex, uint32_t index, uint32_t subIndex, size_t address, size_t size);
57
58
59} // end namespace wasm
60} // end namespace itk
61
62extern "C"
63{
64
65 WebAssemblyInterface_EXPORT size_t EMSCRIPTEN_KEEPALIVE
66 itk_wasm_input_array_alloc(uint32_t memoryIndex, uint32_t index, uint32_t subIndex, size_t size);
67 WebAssemblyInterface_EXPORT size_t EMSCRIPTEN_KEEPALIVE
68 itk_wasm_input_json_alloc(uint32_t memoryIndex, uint32_t index, size_t size);
69
70 WebAssemblyInterface_EXPORT size_t EMSCRIPTEN_KEEPALIVE
71 itk_wasm_output_json_address(uint32_t memoryIndex, uint32_t index);
72 WebAssemblyInterface_EXPORT size_t EMSCRIPTEN_KEEPALIVE
73 itk_wasm_output_json_size(uint32_t memoryIndex, uint32_t index);
74 WebAssemblyInterface_EXPORT size_t EMSCRIPTEN_KEEPALIVE
75 itk_wasm_output_array_address(uint32_t memoryIndex, uint32_t index, uint32_t subIndex);
76 WebAssemblyInterface_EXPORT size_t EMSCRIPTEN_KEEPALIVE
77 itk_wasm_output_array_size(uint32_t memoryIndex, uint32_t index, uint32_t subIndex);
78
79 WebAssemblyInterface_EXPORT void EMSCRIPTEN_KEEPALIVE
81
82} // end extern "C"
83
84#endif // ITK_WASM_NO_MEMORY_IO
85
86#endif
JSON representation for an itk::DataObject.
WebAssemblyInterface_EXPORT vcl_size_t EMSCRIPTEN_KEEPALIVE itk_wasm_output_array_address(uint32_t memoryIndex, uint32_t index, uint32_t subIndex)
WebAssemblyInterface_EXPORT vcl_size_t EMSCRIPTEN_KEEPALIVE itk_wasm_output_array_size(uint32_t memoryIndex, uint32_t index, uint32_t subIndex)
WebAssemblyInterface_EXPORT vcl_size_t EMSCRIPTEN_KEEPALIVE itk_wasm_input_json_alloc(uint32_t memoryIndex, uint32_t index, vcl_size_t size)
WebAssemblyInterface_EXPORT vcl_size_t EMSCRIPTEN_KEEPALIVE itk_wasm_input_array_alloc(uint32_t memoryIndex, uint32_t index, uint32_t subIndex, vcl_size_t size)
WebAssemblyInterface_EXPORT vcl_size_t EMSCRIPTEN_KEEPALIVE itk_wasm_output_json_size(uint32_t memoryIndex, uint32_t index)
#define EMSCRIPTEN_KEEPALIVE
WebAssemblyInterface_EXPORT void EMSCRIPTEN_KEEPALIVE itk_wasm_free_all()
WebAssemblyInterface_EXPORT vcl_size_t EMSCRIPTEN_KEEPALIVE itk_wasm_output_json_address(uint32_t memoryIndex, uint32_t index)
std::pair< uint32_t, uint32_t > InputArrayStoreKeyType
std::vector< uint8_t > InputArrayStoreValueType
WebAssemblyInterface_EXPORT void setMemoryStoreOutputDataObject(uint32_t memoryIndex, uint32_t index, const WasmDataObject *dataObject)
const WebAssemblyInterface_EXPORT std::string & getMemoryStoreInputJSON(uint32_t memoryIndex, uint32_t index)
std::map< InputArrayStoreKeyType, InputArrayStoreValueType > InputArrayStoreType
const WebAssemblyInterface_EXPORT InputArrayStoreType & getMemoryInputArrayStore()
WebAssemblyInterface_EXPORT void setMemoryStoreOutputArray(uint32_t memoryIndex, uint32_t index, uint32_t subIndex, vcl_size_t address, vcl_size_t size)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....