94 vtkInformationVector **inputVector,
95 vtkInformationVector *outputVector) {
97 vtkDataSet *input = vtkDataSet::GetData(inputVector[0]);
98 vtkDataSet *output = vtkDataSet::GetData(outputVector);
100 output->ShallowCopy(input);
102 const auto inputScalarField = this->GetInputArrayToProcess(0, input);
103 if(inputScalarField ==
nullptr) {
104 this->
printErr(
"No such input scalar field");
107 auto InputType = inputScalarField->GetDataType();
109 bool const oldUseNormalization{UseNormalization};
110 if(OutputType == SupportedType::Float or OutputType == SupportedType::Double)
111 UseNormalization =
false;
113 if(InputType == VTK_CHAR) {
114 if(OutputType == SupportedType::Double)
115 convert<char, double, vtkDoubleArray>(inputScalarField, output);
116 else if(OutputType == SupportedType::Float)
117 convert<char, float, vtkFloatArray>(inputScalarField, output);
118 else if(OutputType == SupportedType::IdType)
119 convert<char, vtkIdType, vtkIdTypeArray>(inputScalarField, output);
120 else if(OutputType == SupportedType::Int)
121 convert<char, int, vtkIntArray>(inputScalarField, output);
122 else if(OutputType == SupportedType::Short)
123 convert<char, short, vtkShortArray>(inputScalarField, output);
124 else if(OutputType == SupportedType::UnsignedShort)
125 convert<char, unsigned short, vtkUnsignedShortArray>(
126 inputScalarField, output);
127 else if(OutputType == SupportedType::UnsignedChar)
128 convert<char, unsigned char, vtkUnsignedCharArray>(
129 inputScalarField, output);
130 }
else if(InputType == VTK_DOUBLE) {
131 if(OutputType == SupportedType::Char)
132 convert<double, char, vtkCharArray>(inputScalarField, output);
133 else if(OutputType == SupportedType::Float)
134 convert<double, float, vtkFloatArray>(inputScalarField, output);
135 else if(OutputType == SupportedType::IdType)
136 convert<double, vtkIdType, vtkIdTypeArray>(inputScalarField, output);
137 else if(OutputType == SupportedType::Int)
138 convert<double, int, vtkIntArray>(inputScalarField, output);
139 else if(OutputType == SupportedType::Short)
140 convert<double, short, vtkShortArray>(inputScalarField, output);
141 else if(OutputType == SupportedType::UnsignedShort)
142 convert<double, unsigned short, vtkUnsignedShortArray>(
143 inputScalarField, output);
144 else if(OutputType == SupportedType::UnsignedChar)
145 convert<double, unsigned char, vtkUnsignedCharArray>(
146 inputScalarField, output);
147 }
else if(InputType == VTK_FLOAT) {
148 if(OutputType == SupportedType::Char)
149 convert<float, char, vtkCharArray>(inputScalarField, output);
150 else if(OutputType == SupportedType::Double)
151 convert<float, double, vtkDoubleArray>(inputScalarField, output);
152 else if(OutputType == SupportedType::IdType)
153 convert<float, vtkIdType, vtkIdTypeArray>(inputScalarField, output);
154 else if(OutputType == SupportedType::Int)
155 convert<float, int, vtkIntArray>(inputScalarField, output);
156 else if(OutputType == SupportedType::Short)
157 convert<float, short, vtkShortArray>(inputScalarField, output);
158 else if(OutputType == SupportedType::UnsignedShort)
159 convert<float, unsigned short, vtkUnsignedShortArray>(
160 inputScalarField, output);
161 else if(OutputType == SupportedType::UnsignedChar)
162 convert<float, unsigned char, vtkUnsignedCharArray>(
163 inputScalarField, output);
164 }
else if(InputType == VTK_INT) {
165 if(OutputType == SupportedType::Char)
166 convert<int, char, vtkCharArray>(inputScalarField, output);
167 else if(OutputType == SupportedType::Double)
168 convert<int, double, vtkDoubleArray>(inputScalarField, output);
169 else if(OutputType == SupportedType::Float)
170 convert<int, float, vtkFloatArray>(inputScalarField, output);
171 else if(OutputType == SupportedType::IdType)
172 convert<int, vtkIdType, vtkIdTypeArray>(inputScalarField, output);
173 else if(OutputType == SupportedType::Short)
174 convert<int, short, vtkShortArray>(inputScalarField, output);
175 else if(OutputType == SupportedType::UnsignedShort)
176 convert<int, unsigned short, vtkUnsignedShortArray>(
177 inputScalarField, output);
178 else if(OutputType == SupportedType::UnsignedChar)
179 convert<int, unsigned char, vtkUnsignedCharArray>(
180 inputScalarField, output);
181 }
else if(InputType == VTK_ID_TYPE) {
182 if(OutputType == SupportedType::Char)
183 convert<vtkIdType, char, vtkCharArray>(inputScalarField, output);
184 else if(OutputType == SupportedType::Double)
185 convert<vtkIdType, double, vtkDoubleArray>(inputScalarField, output);
186 else if(OutputType == SupportedType::Float)
187 convert<vtkIdType, float, vtkFloatArray>(inputScalarField, output);
188 else if(OutputType == SupportedType::Short)
189 convert<vtkIdType, short, vtkShortArray>(inputScalarField, output);
190 else if(OutputType == SupportedType::UnsignedShort)
191 convert<vtkIdType, unsigned short, vtkUnsignedShortArray>(
192 inputScalarField, output);
193 else if(OutputType == SupportedType::UnsignedChar)
194 convert<vtkIdType, unsigned char, vtkUnsignedCharArray>(
195 inputScalarField, output);
196 }
else if(InputType == VTK_LONG) {
197 if(OutputType == SupportedType::Char)
198 convert<long long int, char, vtkCharArray>(inputScalarField, output);
199 else if(OutputType == SupportedType::Double)
200 convert<long long int, double, vtkDoubleArray>(inputScalarField, output);
201 else if(OutputType == SupportedType::Float)
202 convert<long long int, float, vtkFloatArray>(inputScalarField, output);
203 else if(OutputType == SupportedType::IdType)
204 convert<long long int, vtkIdType, vtkIdTypeArray>(
205 inputScalarField, output);
206 else if(OutputType == SupportedType::Int)
207 convert<long long int, int, vtkIntArray>(inputScalarField, output);
208 else if(OutputType == SupportedType::Short)
209 convert<long long int, short, vtkShortArray>(inputScalarField, output);
210 else if(OutputType == SupportedType::UnsignedShort)
211 convert<long long int, unsigned short, vtkUnsignedShortArray>(
212 inputScalarField, output);
213 else if(OutputType == SupportedType::UnsignedChar)
214 convert<long long int, unsigned char, vtkUnsignedCharArray>(
215 inputScalarField, output);
216 }
else if(InputType == VTK_SHORT) {
217 if(OutputType == SupportedType::Char)
218 convert<short, char, vtkCharArray>(inputScalarField, output);
219 else if(OutputType == SupportedType::Double)
220 convert<short, double, vtkDoubleArray>(inputScalarField, output);
221 else if(OutputType == SupportedType::Float)
222 convert<short, float, vtkFloatArray>(inputScalarField, output);
223 else if(OutputType == SupportedType::IdType)
224 convert<short, vtkIdType, vtkIdTypeArray>(inputScalarField, output);
225 else if(OutputType == SupportedType::Int)
226 convert<short, int, vtkIntArray>(inputScalarField, output);
227 else if(OutputType == SupportedType::UnsignedShort)
228 convert<short, unsigned short, vtkUnsignedShortArray>(
229 inputScalarField, output);
230 else if(OutputType == SupportedType::UnsignedChar)
231 convert<short, unsigned char, vtkUnsignedCharArray>(
232 inputScalarField, output);
233 }
else if(InputType == VTK_UNSIGNED_SHORT) {
234 if(OutputType == SupportedType::Char)
235 convert<unsigned short, char, vtkCharArray>(inputScalarField, output);
236 else if(OutputType == SupportedType::Double)
237 convert<unsigned short, double, vtkDoubleArray>(inputScalarField, output);
238 else if(OutputType == SupportedType::Float)
239 convert<unsigned short, float, vtkFloatArray>(inputScalarField, output);
240 else if(OutputType == SupportedType::IdType)
241 convert<unsigned short, vtkIdType, vtkIdTypeArray>(
242 inputScalarField, output);
243 else if(OutputType == SupportedType::Int)
244 convert<unsigned short, int, vtkIntArray>(inputScalarField, output);
245 else if(OutputType == SupportedType::Short)
246 convert<unsigned short, short, vtkShortArray>(inputScalarField, output);
247 else if(OutputType == SupportedType::UnsignedChar)
248 convert<unsigned short, unsigned char, vtkUnsignedCharArray>(
249 inputScalarField, output);
250 }
else if(InputType == VTK_UNSIGNED_CHAR) {
251 if(OutputType == SupportedType::Char)
252 convert<unsigned char, char, vtkCharArray>(inputScalarField, output);
253 else if(OutputType == SupportedType::Double)
254 convert<unsigned char, double, vtkDoubleArray>(inputScalarField, output);
255 else if(OutputType == SupportedType::Float)
256 convert<unsigned char, float, vtkFloatArray>(inputScalarField, output);
257 else if(OutputType == SupportedType::IdType)
258 convert<unsigned char, vtkIdType, vtkIdTypeArray>(
259 inputScalarField, output);
260 else if(OutputType == SupportedType::Int)
261 convert<unsigned char, int, vtkIntArray>(inputScalarField, output);
262 else if(OutputType == SupportedType::Short)
263 convert<unsigned char, short, vtkShortArray>(inputScalarField, output);
264 else if(OutputType == SupportedType::UnsignedShort)
265 convert<unsigned char, unsigned short, vtkUnsignedShortArray>(
266 inputScalarField, output);
268 this->
printErr(
"Unsupported data type");
271 UseNormalization = oldUseNormalization;