Hello,
i want to multiply either a vector with a single scalar (s * {v_0,...,v_n} = {s * v_0,...,s * v_n}
) or a elementwise multiplication of two vectors ({w_0,...,w_n} * {v_0,...,v_n} = {w_0 * v_0,..., w_n * v_n}
).
This operation shall be apply to an image of vectors.
The obvious choice would be the MultiplyImageFilter but once template it over a VectorImage the constant has to be a vector.
This example does not work because factor
is not a vector:
auto multiply = itk::MultiplyImageFilter<VectorImageType>::New();
multiply->SetInput(vectorImage);
multiply->SetConstant(factor);
This does not work either:
auto multiply = itk::MultiplyImageFilter<VectorImageType>::New();
itk::Image<itk::CovariantVector<double, 3>, 3>::PixelType factor;
factor.Fill(1);
factor[2] = 100;
multiply->SetInput(vectorImage);
multiply->SetConstant(factor);
All the output values are multiplied as a vector multiplication.
Is there a filter I have not considered because its not obvious?
Is this type of operation done by an accessor or castimage filter?
Thanks,
Gordian