]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/kernel/volume.cxx
The text can't be empty or with spaces... Now, "000"
[creaMaracasVisu.git] / lib / maracasVisuLib / src / kernel / volume.cxx
index ee35a73f46be30fc79056dd5748e2b322e3bbdd8..8155ec3bc402e81826580337a012bb99d4cc4438 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: volume.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/11/21 18:13:38 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/03/15 14:12:30 $
+  Version:   $Revision: 1.6 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -99,15 +99,15 @@ template< class TYPE >
 
 // -------------------------------------------------------------------------
 kVolume::kVolume( )
-    : _type( UCHAR ), _creator( SELF ),
-#ifdef KGFO_USE_VTK
-      _vtk( NULL ),
-#endif // KGFO_USE_VTK
-//#ifdef KGFO_USE_IDO
-//      _privateIdo( NULL ),
-//#endif // KGFO_USE_IDO
-      _raw( NULL ), _columns( NULL ),
+    : _type( UCHAR ), 
+      _creator( SELF ),
+      _raw( NULL ), 
+      _columns( NULL ),
       _images( NULL )
+#ifdef KGFO_USE_VTK
+                  ,
+      _vtk( NULL )      
+#endif // KGFO_USE_VTK      
 {
     _dims[ CX ] = 1; _dims[ CY ] = 1; _dims[ CZ ] = 1;
     _sizes[ CX ] = 1; _sizes[ CY ] = 1; _sizes[ CZ ] = 1;
@@ -120,15 +120,15 @@ kVolume::kVolume( Type type,
                  uint xdim, uint ydim, uint zdim,
                  double xsize, double ysize, double zsize,
                  void* data )
-    : _type( type ), _creator( SELF ),
-#ifdef KGFO_USE_VTK
-      _vtk( NULL ),
-#endif // KGFO_USE_VTK
-//#ifdef KGFO_USE_IDO
-//      _privateIdo( NULL ),
-//#endif // KGFO_USE_IDO
-      _raw( NULL ), _columns( NULL ),
+    : _type( type ), 
+      _creator( SELF ),
+      _raw( NULL ), 
+      _columns( NULL ),
       _images( NULL )
+#ifdef KGFO_USE_VTK
+                    ,
+      _vtk( NULL )
+#endif // KGFO_USE_VTK      
 {
     _dims[ CX ] = xdim; _dims[ CY ] = ydim; _dims[ CZ ] = zdim;
     _sizes[ CX ] = xsize; _sizes[ CY ] = ysize; _sizes[ CZ ] = zsize;
@@ -148,15 +148,15 @@ kVolume::kVolume( Type type,
                  const uint *dims,
                  const double *sizes,
                  void* data )
-    : _type( type ), _creator( SELF ),
-#ifdef KGFO_USE_VTK
-      _vtk( NULL ),
-#endif // KGFO_USE_VTK
-//#ifdef KGFO_USE_IDO
-//      _privateIdo( NULL ),
-//#endif // KGFO_USE_IDO
+    : _type( type ), 
+      _creator( SELF ),
       _raw( NULL ), _columns( NULL ),
       _images( NULL )
+#ifdef KGFO_USE_VTK
+                   ,
+      _vtk( NULL )
+#endif // KGFO_USE_VTK      
+      
 {
     memcpy( _dims, dims, 3 * sizeof( uint ) );
     memcpy( _sizes, sizes, 3 * sizeof( double ) );
@@ -173,15 +173,16 @@ kVolume::kVolume( Type type,
 
 // -------------------------------------------------------------------------
 kVolume::kVolume( const kVolume& org )
-    : _type( UCHAR ), _creator( SELF ),
-#ifdef KGFO_USE_VTK
-      _vtk( NULL ),
-#endif // KGFO_USE_VTK
-//#ifdef KGFO_USE_IDO
-//      _privateIdo( NULL ),
-//#endif // KGFO_USE_IDO
-      _raw( NULL ), _columns( NULL ),
+    : _type( UCHAR ), 
+      _creator( SELF ),
+      _raw( NULL ), 
+      _columns( NULL ),
       _images( NULL )
+#ifdef KGFO_USE_VTK
+                   ,
+      _vtk( NULL )
+#endif // KGFO_USE_VTK      
+  
 {
     copyFrom( org );
 }
@@ -284,6 +285,7 @@ void kVolume::convertCast( Type type )
            case FLOAT:  convertCastT( ( char* )_raw, ( float* )buffer, size ); break;
            case DOUBLE: convertCastT( ( char* )_raw, ( double* )buffer, size ); break;
            case UCHAR:  convertCastT( ( char* )_raw, ( uchar* )buffer, size ); break;
+           default : break;
 
            } // fswitch
            break;
@@ -298,7 +300,7 @@ void kVolume::convertCast( Type type )
            case FLOAT:  convertCastT( ( short* )_raw, ( float* )buffer, size ); break;
            case DOUBLE: convertCastT( ( short* )_raw, ( double* )buffer, size ); break;
            case UCHAR:  convertCastT( ( short* )_raw, ( uchar* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
 
@@ -312,7 +314,7 @@ void kVolume::convertCast( Type type )
            case FLOAT:  convertCastT( ( int* )_raw, ( float* )buffer, size ); break;
            case DOUBLE: convertCastT( ( int* )_raw, ( double* )buffer, size ); break;
            case UCHAR:  convertCastT( ( int* )_raw, ( uchar* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
 
@@ -326,7 +328,7 @@ void kVolume::convertCast( Type type )
            case FLOAT:  convertCastT( ( ushort* )_raw, ( float* )buffer, size ); break;
            case DOUBLE: convertCastT( ( ushort* )_raw, ( double* )buffer, size ); break;
            case UCHAR:  convertCastT( ( ushort* )_raw, ( uchar* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
 
@@ -340,7 +342,7 @@ void kVolume::convertCast( Type type )
            case FLOAT:  convertCastT( ( uint* )_raw, ( float* )buffer, size ); break;
            case DOUBLE: convertCastT( ( uint* )_raw, ( double* )buffer, size ); break;
            case UCHAR:  convertCastT( ( uint* )_raw, ( uchar* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
 
@@ -354,7 +356,7 @@ void kVolume::convertCast( Type type )
            case UINT:   convertCastT( ( float* )_raw, ( uint* )buffer, size ); break;
            case DOUBLE: convertCastT( ( float* )_raw, ( double* )buffer, size ); break;
            case UCHAR:  convertCastT( ( float* )_raw, ( uchar* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
 
@@ -368,7 +370,7 @@ void kVolume::convertCast( Type type )
            case UINT:   convertCastT( ( double* )_raw, ( uint* )buffer, size ); break;
            case FLOAT:  convertCastT( ( double* )_raw, ( float* )buffer, size ); break;
            case UCHAR:  convertCastT( ( double* )_raw, ( uchar* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
 
@@ -382,7 +384,7 @@ void kVolume::convertCast( Type type )
            case UINT:   convertCastT( ( uchar* )_raw, ( uint* )buffer, size ); break;
            case FLOAT:  convertCastT( ( uchar* )_raw, ( float* )buffer, size ); break;
            case DOUBLE: convertCastT( ( uchar* )_raw, ( double* )buffer, size ); break;
-
+           default : break;
            } // fswitch
            break;
      
@@ -808,49 +810,32 @@ void kVolume::buildIndex( )
 void kVolume::deallocate( )
 {
 #ifdef KGFO_USE_VTK
-
     if( _vtk ) _vtk->Delete();
     _vtk = NULL;
-
 #endif // KGFO_USE_VTK
-
-//#ifdef KGFO_USE_IDO
-
-//    if( _creator == SELF || _creator == VTK ) {
-
-//     delete[] _privateIdo;
-//     _privateIdo = NULL;
-       
-//    } // fi
-
-//#else
-
     delete[] ( uchar* )_images;
-
-//#endif // KGFO_USE_IDO
-
     if( _raw && _creator == SELF )
 
 //EED purify 12/sept/2006
 //     delete[] ( uchar* )_raw;
 
-       free ( _raw );
+    free ( _raw );
 
-    _creator   = SELF;
-    _raw               = NULL;
-    _columns   = NULL;
-    _images            = NULL;
+    _creator = SELF;
+    _raw     = NULL;
+    _columns = NULL;
+    _images  = NULL;
 }
 
 #ifdef KGFO_USE_VTK
 
 // -------------------------------------------------------------------------
 kVolume::kVolume( vtkImageData* org )
-    : _raw( 0 ), _columns( 0 ), _images( 0 ),
+    :
       _creator( VTK ),
-//#ifdef KGFO_USE_IDO
-//      _privateIdo( NULL ),
-//#endif // KGFO_USE_IDO
+      _raw( 0 ), 
+      _columns( 0 ), 
+      _images( 0 ),
       _vtk( 0 )
 {
     //int i, j, k, y;
@@ -912,11 +897,11 @@ void kVolume::copyFrom( vtkImageData* org )
 
 //#endif // KGFO_USE_IDO
 
-    _vtk               = NULL;
-    _raw               = NULL;
-    _columns   = NULL;
-    _images            = NULL;
-    _creator   = SELF;
+    _vtk     = NULL;
+    _raw     = NULL;
+    _columns = NULL;
+    _images  = NULL;
+    _creator = SELF;
 
     switch( org->GetScalarType( ) ) {