]> Creatis software - bbtk.git/commitdiff
TemporalPicker
authorEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Thu, 3 Jan 2019 15:57:53 +0000 (16:57 +0100)
committerEduardo DAVILA <davila@ei-ed-606.creatis.insa-lyon.fr>
Thu, 3 Jan 2019 15:57:53 +0000 (16:57 +0100)
packages/vtk/src/bbvtkTemporalPicker.cxx

index de512515dfbc60118cdce2a615695cc02dab4e0b..0afbc5d7fe318878f5302c457afabe9d8b357043 100644 (file)
@@ -30,6 +30,9 @@
 //===== 
 #include "bbvtkTemporalPicker.h"
 #include "bbvtkPackage.h"
+
+#include "creaVtk_MACROS.h"
+
 namespace bbvtk
 {
 
@@ -71,37 +74,59 @@ void TemporalPicker::Process()
                sizeY=ext[3]-ext[2]+1;
                sizeZ=ext[5]-ext[4]+1;
                
+
                if (bbGetInputPoint().size()>=2)
                {
                        int px=bbGetInputPoint()[0];
                        int py=bbGetInputPoint()[1];
-                       int pz=bbGetInputPoint()[2];
+//EED Eraseme                  int pz=bbGetInputPoint()[2];
+
+                       int minX,maxX,minY,maxY;
+                       minX = px-bbGetInputSizeRegion()-1;
+                       maxX = px+bbGetInputSizeRegion()-1;
+                       minY = py-bbGetInputSizeRegion()-1;
+                       maxY = py+bbGetInputSizeRegion()-1;
                        
-                       if ((px>=0) && (px<sizeX)  && (py>=0) && (py<sizeY) )
+                       if ( (minX>=0)     && 
+                 (maxX<sizeX)  && 
+                                (minY>=0)     && 
+                 (maxY<sizeY) )
                        {
                                int i,j,k;
-                               int minX,maxX,minY,maxY;
-                               int acum,numElem;
-                               minX=px-bbGetInputSizeRegion()-1;
-                               maxX=px+bbGetInputSizeRegion()-1;
-                               minY=py-bbGetInputSizeRegion()-1;
-                               maxY=py+bbGetInputSizeRegion()-1;
+                               int numElem;
+                               double acum;
+
+
+                               long int index          = px+py*sizeX;
+                               long int stepIndex      = sizeX*sizeY;
+                               DEF_POINTER_IMAGE_VTK_CREA(vIn,ssIn,pIn,stIn,bbGetInputIn() )
+
                                for (k=0;k<sizeZ;k++)
                                {
-                                       acum=0;
-                                       numElem=0;
+                                       acum    = 0;
+                                       numElem = 0;
+
+                                       GETVALUE2_VTK_CREA(vIn,pIn,stIn,index)
+                                       numElem++;
+                                       acum    = acum  + vIn;
+                                       index   = index + stepIndex;
+/*
                                        for(i=minX;i<=maxX;i++)
                                        { 
                                                for(j=minY;j<=maxY;j++)
                                                { 
-                                                       if ((i>=0) && (i<sizeX)  && (j>=0) && (j<sizeY) )
-                                                       { 
+//                                                     if ((i>=0) && (i<sizeX)  && (j>=0) && (j<sizeY) )
+//                                                     { 
                                                                acum = acum + bbGetInputIn()->GetScalarComponentAsDouble(i, j, k, 0);
                                                                numElem++;
-                                                       }// i j
+//                                                     }// if i j
                                                }// for j
                                        } // for i
                                        
+*/
+
+
+
                                        if (numElem>0) 
                                        {
                                                result.push_back( acum/numElem );