if (bbGetInputIn1() == NULL)
{
- printf( "EED Warning!!! (%s) BinaryOperations::Process Set In1 at least", bbGetFullName().c_str() );
+ printf( "EED Warning!!! (%s) BinaryOperations::Process Set In1 at least \n", bbGetFullName().c_str() );
bbSetOutputOut(NULL);
return;
}
- if (ope!=NULL)
- {
- ope->Delete();
- ope = NULL;
- } // if
- ope = vtkImageMathematics::New();
-
- //EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- ope->SetInput1((vtkDataObject*)bbGetInputIn1());
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- ope->SetInput1Data((vtkDataObject*)bbGetInputIn1());
-#endif
-
- if (bbGetInputIn2() != NULL)
- {
- //EED 2017-01-01 Migration VTK7
-#if (VTK_MAJOR_VERSION <= 5)
- ope->SetInput2((vtkDataObject*)bbGetInputIn2());
-#endif
-#if (VTK_MAJOR_VERSION >= 6)
- ope->SetInput2Data((vtkDataObject*)bbGetInputIn2());
-#endif
- } else {
- printf( "EED Warning!!! (%s) BinaryOperations::Process Set In2 at least", bbGetFullName().c_str() );
- bbSetOutputOut(NULL);
- return;
- }
if ( (bbGetInputOperation()>=0) && (bbGetInputOperation()<=5) )
{
+
+
+ if (ope!=NULL)
+ {
+ ope->Delete();
+ ope = NULL;
+ } // if
+ ope = vtkImageMathematics::New();
+
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ ope->SetInput1((vtkDataObject*)bbGetInputIn1());
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ ope->SetInput1Data((vtkDataObject*)bbGetInputIn1());
+ #endif
+
+
+ if (bbGetInputIn2() != NULL)
+ {
+ //EED 2017-01-01 Migration VTK7
+ #if (VTK_MAJOR_VERSION <= 5)
+ ope->SetInput2((vtkDataObject*)bbGetInputIn2());
+ #endif
+ #if (VTK_MAJOR_VERSION >= 6)
+ ope->SetInput2Data((vtkDataObject*)bbGetInputIn2());
+ #endif
+ } else {
+ printf( "EED Warning!!! (%s) BinaryOperations::Process Set In2 at least \n", bbGetFullName().c_str() );
+ bbSetOutputOut(NULL);
+ return;
+ }
+
switch ( bbGetInputOperation() )
{
case 0:
{
bbSetOutputOut( bbGetInputIn2() );
}
+ if ( bbGetInputOperation()==8 )
+ {
+ if (bbGetInputIn1()!=NULL)
+ {
+ if (bbGetInputIn2()==NULL)
+ {
+ int ext[6];
+ bbGetInputIn1()->GetExtent(ext);
+ int dimX = ext[1]-ext[0] + 1;
+ int dimY = ext[3]-ext[2] + 1;
+ int dimZ = ext[5]-ext[4] + 1;
+ int scalarSize = bbGetInputIn1()->GetScalarSize();
+ long int size = dimX * dimY * dimZ *scalarSize;
+ memset ( bbGetInputIn1()->GetScalarPointer(), 0 , size );
+ } else {
+ /*
+ int ext[6];
+ bbGetInputIn1()->GetExtent(ext);
+ int dimX1 = ext[1]-ext[0] + 1;
+ int dimY1 = ext[3]-ext[2] + 1;
+ int dimZ1 = ext[5]-ext[4] + 1;
+ int scalarSize1 = bbGetInputIn1()->GetScalarSize();
+ bbGetInputIn2()->GetExtent(ext);
+ int dimX2 = ext[1]-ext[0] + 1;
+ int dimY2 = ext[3]-ext[2] + 1;
+ int dimZ2 = ext[5]-ext[4] + 1;
+ int scalarSize2 = bbGetInputIn1()->GetScalarSize();
+ long int size = dimX1 * dimY1 * dimZ1 * scalarSize1;
+ if ((dimX1==dimX2) && (dimY1==dimY2) && (dimZ1==dimZ2) && (scalarSize1==scalarSize2))
+ {
+ memcpy( bbGetInputIn1()->GetScalarPointer(), bbGetInputIn2()->GetScalarPointer() , size );
+ } // if dim size
+ */
+ bbGetInputIn1()->DeepCopy( bbGetInputIn2() );
+ } // if In2
+ } // if In1
+ bbSetOutputOut( bbGetInputIn1() );
+ } // Operation 8
// bbSignalOutputModification();
}
BBTK_CATEGORY("filter");
BBTK_INPUT(BinaryOperations,In1,"first image to be operated",vtkImageData*,"NULL default");
BBTK_INPUT(BinaryOperations,In2,"second image to be operated",vtkImageData*,"NULL default");
- BBTK_INPUT(BinaryOperations,Operation,"0:Add (default) , 1:subtract, 2:multiply, 3:divide, 4=Max, 5=Min, 6=Replace with In1, 7=Replace with In2",int,"");
+ BBTK_INPUT(BinaryOperations,Operation,"0:Add (default) , 1:subtract, 2:multiply, 3:divide, 4=Max, 5=Min, 6=Replace with In1, 7=Replace with In2, 8=DeepCopy de In2 to In1 (output In1)",int,"");
BBTK_OUTPUT(BinaryOperations,Out,"",vtkImageData*,"");
BBTK_END_DESCRIBE_BLACK_BOX(BinaryOperations);
}