X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=bbtk%2Fsrc%2FbbcreaContoursSetViewerPosition.cxx;h=5f0f2337973a046b0379198f6aaebdb07ef2cd70;hb=6b1e60b233628dde72721c9fac669f2fcf7eb49b;hp=365c4a0973eda1ea94297c6cde112cb2b55e55c4;hpb=d8ae77db08ab2e951c0e984c20fc47b615744abb;p=creaContours.git diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx index 365c4a0..5f0f233 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.cxx +++ b/bbtk/src/bbcreaContoursSetViewerPosition.cxx @@ -29,43 +29,53 @@ void SetViewerPosition::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <getImageData(); - int ext[6]; - img->GetExtent(ext); - int dimY=ext[3]-ext[2]+1; - - if (bbGetInputDirection()==0) - { - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", z ); - bbGetInputwxContourMainFrame()->SetXY(x,y); - } // if Direction1 - - if (bbGetInputDirection()==1) + if (bbGetInputwxContourMainFrame()!=NULL) { - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", y ); - bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1); - } // if Direction1 - - if (bbGetInputDirection()==2) - { - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", x ); - bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y); - } // if Direction1 - - - bbGetInputwxContourMainFrame()->showAxis(true); - bbGetInputwxContourMainFrame()->changeInstant(); - bbGetInputwxContourMainFrame()->RefreshInterface(); - } - } + double slice; + vtkImageData *img = bbGetInputwxContourMainFrame()->getImageData(); + int ext[6]; + img->GetExtent(ext); + int dimY=ext[3]-ext[2]+1; + if (bbGetInputDirection()==0) + { + slice = z; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); + bbGetInputwxContourMainFrame()->SetXY(x,y); + } // if Direction1 + + if (bbGetInputDirection()==1) + { + slice = y; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); + bbGetInputwxContourMainFrame()->SetXY(x,dimY-z-1); + } // if Direction1 + + if (bbGetInputDirection()==2) + { + slice = x; + slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); + bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); + bbGetInputwxContourMainFrame()->SetXY(dimY-z-1,y); + } // if Direction1 + bbGetInputwxContourMainFrame()->showAxis(true); + bbGetInputwxContourMainFrame()->changeInstant(); + bbGetInputwxContourMainFrame()->RefreshInterface(); + backX=x; + backY=y; + backZ=z; + } // if bbGetInputPosition + } // if bbGetInputwxContourMainFrame + } // if backX backY backZ } //===== @@ -76,8 +86,14 @@ void SetViewerPosition::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 - bbSetInputDirection(0); - bbSetInputwxContourMainFrame(NULL); + bbSetInputDirection(0); + bbSetInputJump(1); + bbSetInputShift(0); + bbSetInputwxContourMainFrame(NULL); + + backX=-9999; + backY=-9999; + backZ=-9999; } //=====