|
| 1 | +/*========================================================================= |
| 2 | + * |
| 3 | + * Copyright Insight Software Consortium |
| 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 | + * http://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 | + |
| 19 | +#include <emscripten.h> |
| 20 | +#include <emscripten/bind.h> |
| 21 | + |
| 22 | +#include "itkMGHImageIO.h" |
| 23 | + |
| 24 | +#include "itkImageIOBaseJSBinding.h" |
| 25 | + |
| 26 | +typedef itk::ImageIOBaseJSBinding< itk::MGHImageIO > MGHImageIOJSBindingType; |
| 27 | + |
| 28 | +EMSCRIPTEN_BINDINGS(itk_mgh_image_io_js_binding) { |
| 29 | + emscripten::register_vector<double>("AxisDirectionType"); |
| 30 | + emscripten::enum_<MGHImageIOJSBindingType::IOPixelType>("IOPixelType") |
| 31 | + .value("UNKNOWNPIXELTYPE", itk::ImageIOBase::UNKNOWNPIXELTYPE) |
| 32 | + .value("SCALAR", itk::ImageIOBase::SCALAR) |
| 33 | + .value("RGB", itk::ImageIOBase::RGB) |
| 34 | + .value("RGBA", itk::ImageIOBase::RGBA) |
| 35 | + .value("OFFSET", itk::ImageIOBase::OFFSET) |
| 36 | + .value("VECTOR", itk::ImageIOBase::VECTOR) |
| 37 | + .value("POINT", itk::ImageIOBase::POINT) |
| 38 | + .value("COVARIANTVECTOR", itk::ImageIOBase::COVARIANTVECTOR) |
| 39 | + .value("SYMMETRICSECONDRANKTENSOR", itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR) |
| 40 | + .value("POINT", itk::ImageIOBase::POINT) |
| 41 | + .value("COVARIANTVECTOR", itk::ImageIOBase::COVARIANTVECTOR) |
| 42 | + .value("SYMMETRICSECONDRANKTENSOR", itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR) |
| 43 | + .value("DIFFUSIONTENSOR3D", itk::ImageIOBase::DIFFUSIONTENSOR3D) |
| 44 | + .value("COMPLEX", itk::ImageIOBase::COMPLEX) |
| 45 | + .value("FIXEDARRAY", itk::ImageIOBase::FIXEDARRAY) |
| 46 | + .value("MATRIX", itk::ImageIOBase::MATRIX) |
| 47 | + ; |
| 48 | + emscripten::enum_<MGHImageIOJSBindingType::IOComponentType>("IOComponentType") |
| 49 | + .value("UNKNOWNCOMPONENTTYPE", itk::ImageIOBase::UNKNOWNCOMPONENTTYPE) |
| 50 | + .value("UCHAR", itk::ImageIOBase::UCHAR) |
| 51 | + .value("CHAR", itk::ImageIOBase::CHAR) |
| 52 | + .value("USHORT", itk::ImageIOBase::USHORT) |
| 53 | + .value("SHORT", itk::ImageIOBase::SHORT) |
| 54 | + .value("UINT", itk::ImageIOBase::UINT) |
| 55 | + .value("INT", itk::ImageIOBase::INT) |
| 56 | + .value("ULONG", itk::ImageIOBase::ULONG) |
| 57 | + .value("LONG", itk::ImageIOBase::LONG) |
| 58 | + .value("FLOAT", itk::ImageIOBase::FLOAT) |
| 59 | + .value("DOUBLE", itk::ImageIOBase::DOUBLE) |
| 60 | + ; |
| 61 | + emscripten::class_<MGHImageIOJSBindingType>("ITKImageIO") |
| 62 | + .constructor<>() |
| 63 | + .function("SetNumberOfDimensions", &MGHImageIOJSBindingType::SetNumberOfDimensions) |
| 64 | + .function("GetNumberOfDimensions", &MGHImageIOJSBindingType::GetNumberOfDimensions) |
| 65 | + .function("SetFileName", &MGHImageIOJSBindingType::SetFileName) |
| 66 | + .function("GetFileName", &MGHImageIOJSBindingType::GetFileName) |
| 67 | + .function("CanReadFile", &MGHImageIOJSBindingType::CanReadFile) |
| 68 | + .function("ReadImageInformation", &MGHImageIOJSBindingType::ReadImageInformation) |
| 69 | + .function("SetDimensions", &MGHImageIOJSBindingType::SetDimensions) |
| 70 | + .function("GetDimensions", &MGHImageIOJSBindingType::GetDimensions) |
| 71 | + .function("SetOrigin", &MGHImageIOJSBindingType::SetOrigin) |
| 72 | + .function("GetOrigin", &MGHImageIOJSBindingType::GetOrigin) |
| 73 | + .function("SetSpacing", &MGHImageIOJSBindingType::SetSpacing) |
| 74 | + .function("GetSpacing", &MGHImageIOJSBindingType::GetSpacing) |
| 75 | + .function("SetDirection", &MGHImageIOJSBindingType::SetDirection) |
| 76 | + .function("GetDirection", &MGHImageIOJSBindingType::GetDirection) |
| 77 | + .function("GetDefaultDirection", &MGHImageIOJSBindingType::GetDefaultDirection) |
| 78 | + .function("SetPixelType", &MGHImageIOJSBindingType::SetPixelType) |
| 79 | + .function("GetPixelType", &MGHImageIOJSBindingType::GetPixelType) |
| 80 | + .function("SetComponentType", &MGHImageIOJSBindingType::SetComponentType) |
| 81 | + .function("GetComponentType", &MGHImageIOJSBindingType::GetComponentType) |
| 82 | + .class_function("GetPixelTypeAsString", &MGHImageIOJSBindingType::GetPixelTypeAsString) |
| 83 | + .class_function("GetComponentTypeAsString", &MGHImageIOJSBindingType::GetComponentTypeAsString) |
| 84 | + .function("GetImageSizeInPixels", &MGHImageIOJSBindingType::GetImageSizeInPixels) |
| 85 | + .function("GetImageSizeInBytes", &MGHImageIOJSBindingType::GetImageSizeInBytes) |
| 86 | + .function("GetImageSizeInComponents", &MGHImageIOJSBindingType::GetImageSizeInComponents) |
| 87 | + .function("SetNumberOfComponents", &MGHImageIOJSBindingType::SetNumberOfComponents) |
| 88 | + .function("GetNumberOfComponents", &MGHImageIOJSBindingType::GetNumberOfComponents) |
| 89 | + .function("Read", &MGHImageIOJSBindingType::Read) |
| 90 | + ; |
| 91 | +} |
0 commit comments