Skip to content

Commit 46b13cc

Browse files
bourdaisjfinetjul
authored andcommitted
fix(calculator): make it work with vtkImageData input
do not call getPoints on the input dataset if it not necessary fix #2257
1 parent 4723a64 commit 46b13cc

File tree

1 file changed

+9
-6
lines changed
  • Sources/Filters/General/Calculator

1 file changed

+9
-6
lines changed

Sources/Filters/General/Calculator/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ function vtkCalculator(publicAPI, model) {
4545
singleValueFormula,
4646
options = {}
4747
) => ({
48-
getArrays: () => ({
49-
input: publicAPI.augmentInputArrays(
50-
locn,
51-
arrNames.map((x) => ({ location: locn, name: x }))
52-
),
48+
getArrays: (inData) => ({
49+
// don't augment input data array in case of structured input dataset
50+
input: inData[0].isA('vtkImageData')
51+
? arrNames.map((x) => ({ location: locn, name: x }))
52+
: publicAPI.augmentInputArrays(
53+
locn,
54+
arrNames.map((x) => ({ location: locn, name: x }))
55+
),
5356
output: [
5457
{
5558
location: locn,
@@ -191,7 +194,7 @@ function vtkCalculator(publicAPI, model) {
191194
[
192195
FieldDataTypes.POINT,
193196
(x) => x.getPointData(),
194-
(x) => x.getPoints().getNumberOfPoints(),
197+
(x) => x.getNumberOfPoints(),
195198
],
196199
[
197200
FieldDataTypes.CELL,

0 commit comments

Comments
 (0)