//std::cout << "-------- entree ds Flip::bbUserSetDefaultValues()\n" << std::endl;
bbSetInputIn(NULL);
+ bbSetInputAxis("Y");
mImageOut = NULL;
bbSetOutputOut(NULL);
}
char *lineOut;
char *debPlanIn;
char *debPlanOut;
- int j,k;
- for(k=0; k<inputdims[2]; k++) // iterate on planes
+ int i,j,k;
+
+ if ( (bbGetInputAxis()=="X") || (bbGetInputAxis()=="x") )
{
- debPlanIn = pixelsIn+k*planeSize;
- debPlanOut = pixelsOut+k*planeSize;
- for(j=0; j<inputdims[1]; j++) // iterates on rows
- {
- lineIn = debPlanIn+j*lineSize;
- lineOut = debPlanOut+(inputdims[1]-1-j)*lineSize;
- memcpy(lineOut, lineIn, lineSize);
- } // for j
- } // for k
-
+
+ for(k=0; k<inputdims[2]; k++) // iterate planes
+ {
+ for(j=0; j<inputdims[1]; j++) // iterates rows
+ {
+ for(i=0; i<inputdims[0]; i++) // iterates columns
+ {
+ pixelsIn = (char *)bbGetInputIn()->GetScalarPointer(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; k<inputdims[2]; k++) // iterate planes
+ {
+ for(j=0; j<inputdims[1]; j++) // iterates rows
+ {
+ for(i=0; i<inputdims[0]; i++) // iterates columns
+ {
+ pixelsIn = (char *)bbGetInputIn()->GetScalarPointer(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; k<inputdims[2]; k++) // iterate planes
+ {
+ debPlanIn = pixelsIn+k*planeSize;
+ debPlanOut = pixelsOut+k*planeSize;
+ for(j=0; j<inputdims[1]; j++) // iterates rows
+ {
+ lineIn = debPlanIn+j*lineSize;
+ lineOut = debPlanOut+(inputdims[1]-1-j)*lineSize;
+ memcpy(lineOut, lineIn, lineSize);
+ } // for j
+ } // for k
+
+ } //if
+ mImageOut->Modified();
bbSetOutputOut( mImageOut );
} // bbGetInputIn
{
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();
BBTK_DESCRIPTION("flips a <vtkImageData*>");
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);
//=================================================================