18#ifndef itkSupportInputMeshTypes_h
19#define itkSupportInputMeshTypes_h
30#include "WebAssemblyInterfaceExport.h"
37WebAssemblyInterface_EXPORT
bool
90template <
template <
typename TMesh>
class TPipelineFunctor,
typename... TPixels>
94 template <
unsigned int... VDimensions>
100 const auto iwpArgc = pipeline.
get_argc();
101 const auto iwpArgv = pipeline.
get_argv();
102 bool passThrough =
false;
103 for (
int ii = 0; ii < iwpArgc; ++ii)
105 const std::string arg(iwpArgv[ii]);
106 if (arg ==
"-h" || arg ==
"--help" || arg ==
"--interface-json" || arg ==
"--version")
116 auto tempOption = pipeline.add_option(inputMeshOptionName, meshType,
"Read mesh type.");
120 pipeline.remove_option(tempOption);
126 template <
unsigned int VDimension,
typename TPixel,
typename... TPixelsRest>
130 constexpr unsigned int Dimension = VDimension;
131 using PixelType = TPixel;
134 const auto components =
137 if (passThrough || components == 0 ||
151 else if (passThrough || components == ConvertPixelTraits::GetNumberOfComponents() || components == 0)
155 using PipelineType = TPipelineFunctor<MeshType>;
156 return PipelineType()(pipeline);
160 if constexpr (
sizeof...(TPixelsRest) > 0)
165 std::ostringstream ostrm;
166 std::string meshTypeString = glz::write_json(meshType).value_or(
"error");
167 ostrm <<
"Unsupported mesh type: " << meshTypeString << std::endl;
168 CLI::Error err(
"Runtime error", ostrm.str(), 1);
169 return pipeline.
exit(err);
172 template <
unsigned int VDimension,
unsigned int... VDimensions>
176 if (passThrough || VDimension == meshType.
dimension)
181 if constexpr (
sizeof...(VDimensions) > 0)
186 std::ostringstream ostrm;
187 ostrm <<
"Unsupported mesh dimension: " << meshType.
dimension;
188 CLI::Error err(
"Runtime error", ostrm.str(), 1);
189 return pipeline.
exit(err);
Traits class used to by ConvertPixels to convert blocks of pixels.
Implements the N-dimensional mesh structure.
auto exit(const CLI::Error &e) -> int
#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)
Mesh type JSON representation data structure.
JSONPixelTypesEnum pointPixelType
JSONComponentTypesEnum pointPixelComponentType
unsigned int cellPixelComponents
unsigned int pointPixelComponents
static constexpr JSONComponentTypesEnum JSONComponentEnum
static constexpr JSONPixelTypesEnum JSONPixelEnum