]> Creatis software - creaContours.git/blobdiff - bbtk/src/bbcreaContoursSetViewerPosition.cxx
#3320creaContours Bug NewNormal - Segmentation PolyData Cells
[creaContours.git] / bbtk / src / bbcreaContoursSetViewerPosition.cxx
index 365c4a0973eda1ea94297c6cde112cb2b55e55c4..582f59b576361275e2599996acecddbbf7560adb 100644 (file)
@@ -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);
   
 }