//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== #include "bbcreaVtkImageCutByAxis.h" #include "bbcreaVtkPackage.h" namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,ImageCutByAxis) BBTK_BLACK_BOX_IMPLEMENTATION(ImageCutByAxis,bbtk::AtomicBlackBox); //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ImageCutByAxis::Process() { // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <DeepCopy( bbGetInputIn() ); int ext[6]; bbGetInputIn()->GetWholeExtent(ext); double dimX=ext[1]-ext[0]+1; double dimY=ext[3]-ext[2]+1; double dimZ=ext[5]-ext[4]+1; int x=bbGetInputPoint()[0]; int y=bbGetInputPoint()[1]; int z=bbGetInputPoint()[2]; int i,j; bool c1=false; bool c2=false; bool c3=false; bool c4=false; if ( bbGetInputType()=="x-y-z+" ) { if (bbGetInputTypeOrientation()==0) { c1=false; c2=true; c3=true; c4=true; } if (bbGetInputTypeOrientation()==1) { c1=true; c2=false; c3=true; c4=true; } if (bbGetInputTypeOrientation()==2) { c1=true; c2=false; c3=true; c4=true; } } if (bbGetInputInsideVol()==true) { c1=!c1; c2=!c2; c3=!c3; c4=!c4; } // IndideVol int xmin,xmax,ymin,ymax; // void *imgPtr; // imgPtr=bbGetInputIn()->GetScalarPointer(x,y,z,0); // memset( bbGetInputIn()->GetScalarPointer() ); if (c1==true) { if (bbGetInputTypeOrientation()==0) { xmin=0; xmax=x; ymin=0; ymax=y; } if (bbGetInputTypeOrientation()==1) { xmin=0; xmax=x; ymin=dimY-z; ymax=dimY; } if (bbGetInputTypeOrientation()==2) { xmin=0; xmax=y; ymin=dimY-z; ymax=dimY; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j } // c1 if (c2==true) { if (bbGetInputTypeOrientation()==0) { xmin=0; xmax=x; ymin=y; ymax=dimY; } if (bbGetInputTypeOrientation()==1) { xmin=0; xmax=x; ymin=0; ymax=dimY-z; } if (bbGetInputTypeOrientation()==2) { xmin=0; xmax=y; ymin=0; ymax=dimY-z; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j } //c2 if (c3==true) { if (bbGetInputTypeOrientation()==0) { xmin=x; xmax=dimX; ymin=0; ymax=y; } if (bbGetInputTypeOrientation()==1) { xmin=x; xmax=dimX; ymin=dimY-z; ymax=dimY; } if (bbGetInputTypeOrientation()==2) { xmin=y; xmax=dimX; ymin=dimY-z; ymax=dimY; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j } //c3 if (c4==true) { if (bbGetInputTypeOrientation()==0) { xmin=x; xmax=dimX; ymin=y; ymax=dimY; } if (bbGetInputTypeOrientation()==1) { xmin=x; xmax=dimX; ymin=0; ymax=dimY-z; } if (bbGetInputTypeOrientation()==2) { xmin=y; xmax=dimX; ymin=0; ymax=dimY-z; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j } //c4 bbSetOutputOut( newData ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ImageCutByAxis::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputIn(NULL); bbSetInputType("x+y+z+"); bbSetInputInsideVol(true); std::vector point; point.push_back(0); point.push_back(0); point.push_back(0); bbSetInputPoint(point); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ImageCutByAxis::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void ImageCutByAxis::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk