X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=bbtk%2Fsrc%2FbbcreaContoursSetViewerPosition.cxx;h=5f0f2337973a046b0379198f6aaebdb07ef2cd70;hb=refs%2Fheads%2Fvtk8itk4wx3-mingw64;hp=582f59b576361275e2599996acecddbbf7560adb;hpb=cc5335c400c0186080bde08a41071433c807b2bd;p=creaContours.git diff --git a/bbtk/src/bbcreaContoursSetViewerPosition.cxx b/bbtk/src/bbcreaContoursSetViewerPosition.cxx index 582f59b..5f0f233 100644 --- a/bbtk/src/bbcreaContoursSetViewerPosition.cxx +++ b/bbtk/src/bbcreaContoursSetViewerPosition.cxx @@ -29,48 +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) - { - slice = z; - slice = round( slice/bbGetInputJump() ) * bbGetInputJump() + bbGetInputShift(); - bbGetInputwxContourMainFrame()->setConceptValue( "Axe Depth", slice ); - bbGetInputwxContourMainFrame()->SetXY(x,y); - } // if Direction1 - - if (bbGetInputDirection()==1) + if (bbGetInputwxContourMainFrame()!=NULL) { - 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 + 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 - bbGetInputwxContourMainFrame()->showAxis(true); - bbGetInputwxContourMainFrame()->changeInstant(); - bbGetInputwxContourMainFrame()->RefreshInterface(); - } - } + 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 } //===== @@ -81,10 +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); - bbSetInputJump(1); - bbSetInputShift(0); - bbSetInputwxContourMainFrame(NULL); + bbSetInputDirection(0); + bbSetInputJump(1); + bbSetInputShift(0); + bbSetInputwxContourMainFrame(NULL); + + backX=-9999; + backY=-9999; + backZ=-9999; } //=====