18#ifndef itkSupportInputImageTypes_h
19#define itkSupportInputImageTypes_h
32#include "WebAssemblyInterfaceExport.h"
39WebAssemblyInterface_EXPORT
bool
88template <
template <
typename TImage>
class TPipelineFunctor,
typename... TPixels>
92 template <
unsigned int... VDimensions>
98 const auto iwpArgc = pipeline.
get_argc();
99 const auto iwpArgv = pipeline.
get_argv();
100 for (
int ii = 0; ii < iwpArgc; ++ii)
102 const std::string arg(iwpArgv[ii]);
103 if (arg ==
"-h" || arg ==
"--help" || arg ==
"--interface-json" || arg ==
"--version")
109 auto tempOption = pipeline.add_option(inputImageOptionName, imageType,
"Read image type.");
113 pipeline.remove_option(tempOption);
119 template <
unsigned int VDimension,
typename TPixel,
typename... TPixelsRest>
123 constexpr unsigned int Dimension = VDimension;
124 using PixelType = TPixel;
132 imageType.
components == ConvertPixelTraits::GetNumberOfComponents())))
137 if constexpr (
sizeof...(TPixelsRest) > 0)
142 std::ostringstream ostrm;
143 std::string imageTypeString = glz::write_json(imageType).value_or(
"error");
144 ostrm <<
"Unsupported image type: " << imageTypeString << std::endl;
145 CLI::Error err(
"Runtime error", ostrm.str(), 1);
146 return pipeline.
exit(err);
149 template <
unsigned int VDimension,
unsigned int... VDimensions>
153 if (passThrough || VDimension == imageType.
dimension)
155 return IteratePixelTypes<VDimension, TPixels...>(pipeline, imageType, passThrough);
158 if constexpr (
sizeof...(VDimensions) > 0)
163 std::ostringstream ostrm;
164 ostrm <<
"Unsupported image dimension: " << imageType.
dimension;
165 CLI::Error err(
"Runtime error", ostrm.str(), 1);
166 return pipeline.
exit(err);
Traits class used to by ConvertPixels to convert blocks of pixels.
auto exit(const CLI::Error &e) -> int
Internal class to dispatch for pipeline execution on itk::Image or itk::VectorImage.
#define ITK_WASM_PRE_PARSE(pipeline)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
WebAssemblyInterface_EXPORT bool lexical_cast(const std::string &input, ImageTypeJSON &imageType)
Image type JSON representation data structure.
JSONPixelTypesEnum pixelType
JSONComponentTypesEnum componentType
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONPixelTypesEnum JSONPixelEnum