From a4754355b384ce0c7c311c198b6325bfd243aa7d Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Wed, 5 Jun 2013 16:51:31 +0200 Subject: [PATCH] 2024 Feature FLIP X Y Z --- packages/vtk/src/bbvtkFlip.cxx | 61 +++++++++++++++++++++++++++------- packages/vtk/src/bbvtkFlip.h | 4 ++- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/packages/vtk/src/bbvtkFlip.cxx b/packages/vtk/src/bbvtkFlip.cxx index 1a65c9d..d37aa6f 100644 --- a/packages/vtk/src/bbvtkFlip.cxx +++ b/packages/vtk/src/bbvtkFlip.cxx @@ -54,6 +54,7 @@ namespace bbvtk //std::cout << "-------- entree ds Flip::bbUserSetDefaultValues()\n" << std::endl; bbSetInputIn(NULL); + bbSetInputAxis("Y"); mImageOut = NULL; bbSetOutputOut(NULL); } @@ -120,19 +121,55 @@ void Flip::Process() char *lineOut; char *debPlanIn; char *debPlanOut; - int j,k; - for(k=0; kGetScalarPointer(i,j,k); + pixelsOut = (char *)mImageOut->GetScalarPointer(inputdims[0]-1-i,j,k); + memcpy(pixelsOut, pixelsIn, scalarSize ); + } // for i + } // for j + } // for k + + } else if ( (bbGetInputAxis()=="Z") || (bbGetInputAxis()=="z") ) { + + for(k=0; kGetScalarPointer(i,j,k); + pixelsOut = (char *)mImageOut->GetScalarPointer(i,j,inputdims[2]-1-k); + memcpy(pixelsOut, pixelsIn, scalarSize ); + } // for i + } // for j + } // for k + + } else { + + for(k=0; kModified(); bbSetOutputOut( mImageOut ); } // bbGetInputIn diff --git a/packages/vtk/src/bbvtkFlip.h b/packages/vtk/src/bbvtkFlip.h index 09a9165..3cf6956 100644 --- a/packages/vtk/src/bbvtkFlip.h +++ b/packages/vtk/src/bbvtkFlip.h @@ -64,7 +64,8 @@ namespace bbvtk { public: BBTK_BLACK_BOX_INTERFACE(Flip, bbtk::AtomicBlackBox); - BBTK_DECLARE_INPUT (In,vtkImageData *); + BBTK_DECLARE_INPUT(In,vtkImageData *); + BBTK_DECLARE_INPUT(Axis,std::string); BBTK_DECLARE_OUTPUT(Out, vtkImageData*); BBTK_PROCESS(Process); void Process(); @@ -85,6 +86,7 @@ namespace bbvtk BBTK_DESCRIPTION("flips a "); BBTK_CATEGORY("application, image"); BBTK_INPUT(Flip, In, "image", vtkImageData *, ""); + BBTK_INPUT(Flip, Axis, "Axe (default Y) X Y Z", std::string, ""); BBTK_OUTPUT(Flip, Out, "fliped image", vtkImageData *, ""); BBTK_END_DESCRIBE_BLACK_BOX(Flip); //================================================================= -- 2.47.1