X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbcreaContoursSetViewerPosition.cxx;h=582f59b576361275e2599996acecddbbf7560adb;hb=00bfeafb3fccce1256ae503a345ebfcaacc6a960;hp=365c4a0973eda1ea94297c6cde112cb2b55e55c4;hpb=d8ae77db08ab2e951c0e984c20fc47b615744abb;p=creaContours.git diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx index 365c4a0..582f59b 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.cxx +++ b/bbtk/src/bbcreaContoursSetViewerPosition.cxx @@ -33,30 +33,35 @@ void SetViewerPosition::Process() { if (bbGetInputPosition().size()==3 ) { - int x = bbGetInputPosition()[0]; - int y = bbGetInputPosition()[1]; - int z = bbGetInputPosition()[2]; - - vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData(); - int ext[6]; + double slice; + int x = bbGetInputPosition()[0]; + int y = bbGetInputPosition()[1]; + int z = bbGetInputPosition()[2]; + vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData(); + int ext[6]; img->GetExtent(ext); int dimY=ext[3]-ext[2]+1; - if (bbGetInputDirection()==0) { - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", z ); + slice = z; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); bbGetInputwxContourMainFrame()->SetXY(x,y); } // if Direction1 if (bbGetInputDirection()==1) { - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", y ); + slice = y; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1); } // if Direction1 if (bbGetInputDirection()==2) { - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", x ); + slice = x; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y); } // if Direction1 @@ -77,6 +82,8 @@ void SetViewerPosition::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputDirection(0); + bbSetInputJump(1); + bbSetInputShift(0); bbSetInputwxContourMainFrame(NULL); }