X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk_creaVtk_PKG%2Fsrc%2FbbcreaVtkImageCutByAxis.cxx;h=7884c293d4df70b1c5aadcd759bda8d030cadd17;hb=500bc2ff1c3fe51a9ce94324dee722fb2f7bfd36;hp=764464214a8062919c0a671c851340a76c4adc8d;hpb=dbe9fa3941c9e891ca5fbb5e0070ac08d53d4e7a;p=creaVtk.git diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx index 7644642..7884c29 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkImageCutByAxis.cxx @@ -42,27 +42,39 @@ void ImageCutByAxis::Process() bbGetInputIn()->GetExtent(ext); #endif - double dimX=ext[1]-ext[0]+1; - double dimY=ext[3]-ext[2]+1; - double dimZ=ext[5]-ext[4]+1; + 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 x = bbGetInputPoint()[0]; + int y = bbGetInputPoint()[1]; + int z = bbGetInputPoint()[2]; - int i,j; + int i,j,k; bool c1=false; bool c2=false; bool c3=false; bool c4=false; + bool c5=false; + bool c6=false; + bool c7=false; + bool c8=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 (bbGetInputTypeOrientation()==3) { c1=false; c2=true; c3=true; c4=true; } } + if ( bbGetInputType()=="x+y+z+" ) + { + if (bbGetInputTypeOrientation()==3) { c1=false; c2=false; c3=false; c4=false; c5=true; c6=false; c7=false; c8=false; } + } + + + if (bbGetInputInsideVol()==true) { c1=!c1; @@ -71,8 +83,13 @@ void ImageCutByAxis::Process() c4=!c4; } // IndideVol + printf("EED ImageCutByAxis::Process\n"); + if (c1==true) printf("EED ImageCutByAxis::Process flag 1\n"); + if (c2==true) printf("EED ImageCutByAxis::Process flag 2\n"); + if (c3==true) printf("EED ImageCutByAxis::Process flag 3\n"); + if (c4==true) printf("EED ImageCutByAxis::Process flag 4\n"); - int xmin,xmax,ymin,ymax; + int xmin,xmax,ymin,ymax,zmin,zmax; // void *imgPtr; // imgPtr=bbGetInputIn()->GetScalarPointer(x,y,z,0); @@ -80,19 +97,25 @@ void ImageCutByAxis::Process() 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 + if (bbGetInputTypeOrientation()==0) { xmin=0; xmax=x; ymin=0; ymax=y; zmin=0; zmax=1; } + if (bbGetInputTypeOrientation()==1) { xmin=0; xmax=x; ymin=dimY-z; ymax=dimY; zmin=0; zmax=1; } + if (bbGetInputTypeOrientation()==2) { xmin=0; xmax=y; ymin=dimY-z; ymax=dimY; zmin=0; zmax=1; } + if (bbGetInputTypeOrientation()==3) { xmin=0; xmax=x; ymin=0; ymax=y; zmin=0; zmax=z; } // xyz + printf("EED ImageCutByAxis::Process x=%d %d y= %d %d z=%d %d\n", xmin,xmax , ymin,ymax, zmin,zmax ); + + for (k=zmin;kSetScalarComponentFromDouble(i,j,k,0,0);} // for i + } // for j + } // for k } // 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; } + if (bbGetInputTypeOrientation()==3) { xmin=0; xmax=x; ymin=y; ymax=dimY; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j @@ -100,9 +123,10 @@ void ImageCutByAxis::Process() 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; } + 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; } + if (bbGetInputTypeOrientation()==3) { xmin=x; xmax=dimX; ymin=0; ymax=y; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j @@ -113,12 +137,33 @@ void ImageCutByAxis::Process() 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; } + if (bbGetInputTypeOrientation()==3) { xmin=x; xmax=dimX; ymin=y; ymax=dimY; } for (j=ymin;jSetScalarComponentFromDouble(i,j,0,0,0);} // for i } // for j } //c4 - + + + if (c5==true) + { + if (bbGetInputTypeOrientation()==0) { xmin=0; xmax=x; ymin=0; ymax=y; zmin=0; zmax=1; } + if (bbGetInputTypeOrientation()==1) { xmin=0; xmax=x; ymin=dimY-z; ymax=dimY; zmin=0; zmax=1; } + if (bbGetInputTypeOrientation()==2) { xmin=0; xmax=y; ymin=dimY-z; ymax=dimY; zmin=0; zmax=1; } + if (bbGetInputTypeOrientation()==3) { xmin=x; xmax=dimX; ymin=y; ymax=dimY; zmin=z; zmax=dimZ; } // xyz + printf("EED ImageCutByAxis::Process x=%d %d y= %d %d z=%d %d\n", xmin,xmax , ymin,ymax, zmin,zmax ); + + for (k=zmin;kSetScalarComponentFromDouble(i,j,k,0,0);} // for i + } // for j + } // for k + } // c1 + + + + + newData->Modified(); bbSetOutputOut( newData ); } @@ -131,7 +176,7 @@ 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+"); + bbSetInputType("x-y-z+"); bbSetInputInsideVol(true); std::vector point; point.push_back(0);