@@ -216,8 +216,28 @@ itkPipelineMemoryIOTest(int argc, char * argv[])
216
216
void * readWasmPointSetPointer = reinterpret_cast < void * >( itk_wasm_input_json_alloc (0 , 7 , readPointSetJSON.size ()));
217
217
std::memcpy (readWasmPointSetPointer, readPointSetJSON.data (), readPointSetJSON.size ());
218
218
219
- const char * mockArgv[] = {" itkPipelineMemoryIOTest" , " --memory-io" , " 0" , " 0" , " 1" , " 1" , " 2" , " 2" , " 3" , " 3" , " 4" , " 4" , " 5" , " 5" , " 6" , " 6" , " 7" , " 7" , NULL };
220
- itk::wasm::Pipeline pipeline (" pipeline-test" , " A test ITK Wasm Pipeline" , 18 , const_cast < char ** >(mockArgv));
219
+ using VectorImageType = itk::VectorImage<PixelType, Dimension>;
220
+ // VectorImage test
221
+ const char * inputVectorImageFile = argv[18 ];
222
+ auto readVectorInputImage = itk::ReadImage<VectorImageType>(inputVectorImageFile);
223
+ using VectorImageToWasmImageFilterType = itk::ImageToWasmImageFilter<VectorImageType>;
224
+ auto vectorImageToWasmImageFilter = VectorImageToWasmImageFilterType::New ();
225
+ vectorImageToWasmImageFilter->SetInput (readVectorInputImage);
226
+ vectorImageToWasmImageFilter->Update ();
227
+ auto readWasmVectorImage = vectorImageToWasmImageFilter->GetOutput ();
228
+
229
+ auto readWasmVectorImageData = reinterpret_cast < const void * >(readWasmVectorImage->GetImage ()->GetBufferPointer ());
230
+ const auto readWasmVectorImageDataSize = readWasmVectorImage->GetImage ()->GetPixelContainer ()->Size ();
231
+ const size_t readWasmVectorImageDataPointerAddress = itk_wasm_input_array_alloc (0 , 8 , 0 , readWasmVectorImageDataSize);
232
+ auto readWasmVectorImageDataPointer = reinterpret_cast < void * >(readWasmVectorImageDataPointerAddress);
233
+ std::memcpy (readWasmVectorImageDataPointer, readWasmVectorImageData, readWasmVectorImageDataSize);
234
+
235
+ auto readVectorImageJSON = readWasmVectorImage->GetJSON ();
236
+ void * readWasmVectorImagePointer = reinterpret_cast < void * >( itk_wasm_input_json_alloc (0 , 8 , readVectorImageJSON.size ()));
237
+ std::memcpy (readWasmVectorImagePointer, readVectorImageJSON.data (), readVectorImageJSON.size ());
238
+
239
+ const char * mockArgv[] = {" itkPipelineMemoryIOTest" , " --memory-io" , " 0" , " 0" , " 1" , " 1" , " 2" , " 2" , " 3" , " 3" , " 4" , " 4" , " 5" , " 5" , " 6" , " 6" , " 7" , " 7" , " 8" , " 8" , NULL };
240
+ itk::wasm::Pipeline pipeline (" pipeline-test" , " A test ITK Wasm Pipeline" , 20 , const_cast < char ** >(mockArgv));
221
241
222
242
std::string example_string_option = " default" ;
223
243
pipeline.add_option (" -s,--string" , example_string_option, " A help string" );
@@ -294,6 +314,14 @@ itkPipelineMemoryIOTest(int argc, char * argv[])
294
314
OutputPointSetType outputPointSet;
295
315
pipeline.add_option (" output-point-set" , outputPointSet, " The output point set" )->required ()->type_name (" OUTPUT_POINTSET" );
296
316
317
+ using InputVectorImageType = itk::wasm::InputImage<VectorImageType>;
318
+ InputVectorImageType inputVectorImage;
319
+ pipeline.add_option (" input-vector-image" , inputVectorImage, " The inputImage" )->required ()->type_name (" INPUT_IMAGE" );
320
+
321
+ using OutputVectorImageType = itk::wasm::OutputImage<VectorImageType>;
322
+ OutputVectorImageType outputVectorImage;
323
+ pipeline.add_option (" output-vector-image" , outputVectorImage, " The outputVectorImage" )->required ()->type_name (" OUTPUT_IMAGE" );
324
+
297
325
ITK_WASM_PARSE (pipeline);
298
326
299
327
outputImage.Set (inputImage.Get ());
@@ -318,5 +346,7 @@ itkPipelineMemoryIOTest(int argc, char * argv[])
318
346
outputTransform.Set (inputTransform.Get ());
319
347
outputCompositeTransform.Set (inputCompositeTransform.Get ());
320
348
349
+ outputVectorImage.Set (inputVectorImage.Get ());
350
+
321
351
return EXIT_SUCCESS;
322
352
}
0 commit comments