]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx
BUG view MPR
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / Contour / ContourExtractData.cxx
index acb9e7872538f517a1185bc503e7c64e48d54d6e..8f98a10d2de04ce53a557b174bcff35d3d15333f 100644 (file)
@@ -47,7 +47,7 @@ void ContourExtractData::GetMinMaxPoint(int *minPoint,
                                                                                  )
 {
        int i;
-       int     np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points
+       //int   np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points // JPRx
 
 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
        //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
@@ -87,13 +87,13 @@ void ContourExtractData::GetMinMaxPoint_Of_LstManConMod(    int *minPoint,
 //------------------------------------------------------------------------
 
 int ContourExtractData::AnalisisContourInside(int x, 
-                                                                                               int y, 
-                                                                                               manualContourModel *manualcontourmodel
-                                                                                               )
+                                           int y, 
+                                           manualContourModel *manualcontourmodel
+                                           )
 {
        int result      = 0;
        int i;
-       int     np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points
+       //int   np              = manualcontourmodel->GetSizeLstPoints( );  // number of control points // JPRx
 
 // JSTG 26-02-08 ---------------------------------------------------------------------------------------
        //int nps = manualviewbaseecontour->GetNumberOfPointsSpline(); // number of points in the spline
@@ -197,22 +197,62 @@ double ContourExtractData::GetDataValue(int x, int y, int z)
        void *p;
        p = imagedata->GetScalarPointer(x,y,z);
 
-       if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
-       {       unsigned char *pp = (unsigned char*)p;
+       if (imagedata->GetScalarType()==VTK_CHAR)
+       {
+               char *pp = (char*)p;
                result = (double)(*pp);
        }
-       if (imagedata->GetScalarType()==VTK_FLOAT)
-       {       float *pp = (float*)p;
+       else if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
+       {
+               signed char *pp = (signed char*)p;
                result = (double)(*pp);
        }
-       if (imagedata->GetScalarType()==VTK_SHORT)
-       {       short *pp = (short*)p;
+       else if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
+       {
+               unsigned char *pp = (unsigned char*)p;
                result = (double)(*pp);
        }
-       if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
-       {       unsigned short *pp = (unsigned short*)p;
+       else if (imagedata->GetScalarType()==VTK_SHORT)
+       {
+               short *pp = (short*)p;
+               result = (double)(*pp);
+       }
+       else if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
+       {
+               unsigned short *pp = (unsigned short*)p;
+               result = (double)(*pp);
+       }
+       else if (imagedata->GetScalarType()==VTK_INT)
+       {
+               int *pp = (int*)p;
+               result = (double)(*pp);
+       }
+       else if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
+       {
+               unsigned int *pp = (unsigned int*)p;
                result = (double)(*pp);
        }
+       else if (imagedata->GetScalarType()==VTK_LONG)
+       {
+               long *pp = (long*)p;
+               result = (double)(*pp);
+       }
+       else if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
+       {
+               unsigned long *pp = (unsigned long*)p;
+               result = (double)(*pp);
+       }
+       else if (imagedata->GetScalarType()==VTK_FLOAT)
+       {       
+               float *pp = (float*)p;
+               result = (double)(*pp);
+       }
+       else if (imagedata->GetScalarType()==VTK_DOUBLE)
+       {
+               double *pp = (double*)p;
+               result = (double)(*pp);
+       }
+
        return result;
 }