forked from InsightSoftwareConsortium/itk-wasm
/
meshJSPixelTypeToIOPixelType.js
75 lines (74 loc) · 1.89 KB
/
meshJSPixelTypeToIOPixelType.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const PixelTypes = require('./PixelTypes.js')
const meshJSPixelTypeToIOPixelType = (module, pixelType) => {
let ioPixelType = null
switch (pixelType) {
case PixelTypes.Unknown: {
ioPixelType = module.IOPixelType.UNKNOWNPIXELTYPE
break
}
case PixelTypes.Scalar: {
ioPixelType = module.IOPixelType.SCALAR
break
}
case PixelTypes.RGB: {
ioPixelType = module.IOPixelType.RGB
break
}
case PixelTypes.RGBA: {
ioPixelType = module.IOPixelType.RGBA
break
}
case PixelTypes.Offset: {
ioPixelType = module.IOPixelType.OFFSET
break
}
case PixelTypes.Vector: {
ioPixelType = module.IOPixelType.VECTOR
break
}
case PixelTypes.Point: {
ioPixelType = module.IOPixelType.POINT
break
}
case PixelTypes.CovariantVector: {
ioPixelType = module.IOPixelType.COVARIANTVECTOR
break
}
case PixelTypes.SymmetricSecondRankTensor: {
ioPixelType = module.IOPixelType.SYMMETRICSECONDRANKTENSOR
break
}
case PixelTypes.DiffusionTensor3D: {
ioPixelType = module.IOPixelType.DIFFUSIONTENSOR3D
break
}
case PixelTypes.Complex: {
ioPixelType = module.IOPixelType.COMPLEX
break
}
case PixelTypes.FixedArray: {
ioPixelType = module.IOPixelType.FIXEDARRAY
break
}
case PixelTypes.Array: {
ioPixelType = module.IOPixelType.ARRAY
break
}
case PixelTypes.Matrix: {
ioPixelType = module.IOPixelType.MATRIX
break
}
case PixelTypes.VariableLengthVector: {
ioPixelType = module.IOPixelType.VARIABLELENGTHVECTOR
break
}
case PixelTypes.VariableSizeMatrix: {
ioPixelType = module.IOPixelType.VARIABLESIZEMATRIX
break
}
default:
throw new Error('Unknown IO pixel type')
}
return ioPixelType
}
module.exports = meshJSPixelTypeToIOPixelType