option "output" o "Output image filename" string yes
option "scalar" s "Scalar value" double no
-option "operation" t "Type of operation : \n With another image : 0=add, 1=multiply (dotproduct), 7=difference, 9=crossproduct\n; For 'scalar' : 0=add, 1=multiply, 5=absval (magnitude), 6=squared magnitude, 11=divide, 12=normalize" int default="0" no
+option "operation" t "Type of operation : \n With another image : 0=add, 1=multiply, 2=dotproduct, 7=difference, 9=crossproduct\n; For 'scalar' : 0=add, 1=multiply, 5=absval (magnitude), 6=squared magnitude, 11=divide, 12=normalize" int default="0" no
option "pixelValue" - "Default value for NaN/Inf" double default="0.0" no
option "setFloatOutput" f "Set output to float pixel type" flag off
if (mArgsInfo.input2_given) {
mIsOperationUseASecondImage = true;
this->AddInputFilename(mArgsInfo.input2_arg);
- if (mArgsInfo.operation_arg == 1)
+ if (mArgsInfo.operation_arg == 2)
mIsOutputScalar = true;
}
else if (mArgsInfo.operation_arg == 5 || mArgsInfo.operation_arg == 6)
mIsOutputScalar = true;
- if (mArgsInfo.output_given) this->SetOutputFilename(mArgsInfo.output_arg);
+ if (mArgsInfo.output_given) {
+ this->SetOutputFilename(mArgsInfo.output_arg);
+ mOverwriteInputImage = false;
+ }
// Check type of operation (with scalar or with other image)
if ((mArgsInfo.input2_given) && (mArgsInfo.scalar_given)) {
++ito;
}
break;
- /*
- case 1: // Multiply
+
+ case 1: // term to term Multiply
while (!ito.IsAtEnd()) {
- ito.Set(it1.Get() * it2.Get()) );
+ typename Iter1::PixelType outputPixel(ito.Get());
+ outputPixel.SetVnlVector(element_product(it1.Get().GetVnlVector(),it2.Get().GetVnlVector()));
+ ito.Set(outputPixel);
++it1;
++it2;
++ito;
}
break;
- */
+
/*
case 2: // Divide
while (!ito.IsAtEnd()) {
typedef typename Iter3::PixelType PixelType;
switch (mTypeOfOperation) {
- case 1: // Multiply
+ case 2: // Multiply
while (!ito.IsAtEnd()) {
ito.Set(it1.Get() * it2.Get());
++it1;