]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/kernel/marParameters.cpp
#3138 creaMaracasVisu Feature New Normal - branch vtk7itk4wx3
[creaMaracasVisu.git] / lib / maracasVisuLib / src / kernel / marParameters.cpp
index 8bf5354adaea26027f8912e69ed129b5b416bb8e..d2d5ae212cd7265a0a6be5b80e3f5f978c3a7518 100644 (file)
@@ -1,10 +1,35 @@
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
 /*=========================================================================
 
  Program:   wxMaracas
  Module:    $RCSfile: marParameters.cpp,v $
  Language:  C++
- Date:      $Date: 2008/10/31 16:32:56 $
- Version:   $Revision: 1.1 $
+ Date:      $Date: 2012/11/15 14:16:12 $
+ Version:   $Revision: 1.4 $
  
   Copyright: (c) 2002, 2003
   License:
@@ -19,7 +44,7 @@
 #include <math.h>
 #include <wx/log.h>
 
-static char* BoolParamNames[] = {
+static const char* BoolParamNames[] = {
        // PS ->     "e_debug_window_visible"  ,
        // PS ->        "e_debug_console_visible"     ,
        // PS ->        "e_calculate_mip_default"    ,
@@ -31,7 +56,8 @@ static char* BoolParamNames[] = {
        // PS ->        "e_show_cell"                 ,
        // PS ->        "e_show_int_cell"
 };
-static char* DoubleParamNames[] = {
+
+static const char* DoubleParamNames[] = {
     "e_gravity_distance"              ,
        "e_axis_discret_step"             ,
        "e_distance_to_maximum_intensity" ,
@@ -58,7 +84,8 @@ static char* DoubleParamNames[] = {
     "e_RescaleIntercept"          ,
     "e_RescaleSlope"              ,
 };
-static char* IntParamNames[] = {
+
+static const char* IntParamNames[] = {
     "e_roi_dimension"                     ,
        "e_step"                                  ,
        "e_step_coeficient"                       ,
@@ -73,7 +100,8 @@ static char* IntParamNames[] = {
        "e_voxel_type"                            ,
        // PS ->        "e_coef_cell_max_int"
 };
-static char* StringParamNames[] = {
+
+static const char* StringParamNames[] = {
        "e_installation_directory" ,
        "e_dicom_images_directory"
 };
@@ -197,7 +225,7 @@ void marParameters::reset( )
     _doubleValues[ e_voxel_y_dimension ]             = 1.0;
     _doubleValues[ e_voxel_z_dimension ]             = 1.0;
     _doubleValues[ e_scale ]                         = 4.0;
-       // PS ->     _doubleValues[ e_sampling ]                      = 4.0;
+       // PS ->     _doubleValues[ e_sampling ]         = 4.0;
     _doubleValues[ e_threshold_isocontour ]          = 40.0;
     _doubleValues[ e_threshold_snake_isocontour ]    = 40.0;
     _doubleValues[ e_sigma ]                         = 0.1;
@@ -274,6 +302,7 @@ bool marParameters::load( std::ifstream& is )
        int i, s;
        try
        {
+               char tmp[500];
                is.read( ( char* )_boolValues, e_bool_cont * sizeof( bool ) );
                is.read( ( char* )_intValues, e_int_cont * sizeof( int ) );
                is.read( ( char* )_doubleValues, e_double_cont * sizeof( double ) );
@@ -281,7 +310,13 @@ bool marParameters::load( std::ifstream& is )
                {
                        is.read( ( char* )&s, sizeof( int ) );
                        _stringValues[ i ].resize( s );
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                        is.read( ( char* )_stringValues[ i ].c_str( ), s * sizeof( char ) );
+#else
+                       is.read( tmp , s * sizeof( char ) );
+                       _stringValues[ i ]=wxString(tmp);
+#endif
                } // rof
                return( true ); 
        }
@@ -300,8 +335,10 @@ bool marParameters::save( wxString& nw )
        
 //EEDxx2.4 DEBuG
 //     wxLogDebug("Saving parameters to file " + nw);
-       
-    if( os==NULL ) 
+
+//EED2016-12-22        
+//    if( os==NULL ) 
+    if( os.is_open()==false ) 
        {
                wxString errorMsg;
                errorMsg= _T("Error : Cannot open file ")+nw+_T(" to save parameters");
@@ -332,7 +369,10 @@ bool marParameters::load( wxString& nr )
        
 //EEDxx2.4 DEBuG
 //     wxLogDebug("Laoding parameters from file " + nr);
-    if( is==NULL ) 
+
+//EED 2016-12-22
+//    if( is==NULL ) 
+    if( is.is_open()==false ) 
        {
                wxString errorMsg;
                errorMsg= _T("Error : Cannot open file ")+nr+_T(" to load parameters");
@@ -389,7 +429,12 @@ wxArrayString marParameters::getRelationalArray( )
 
      for( i = 0; i < e_string_cont; i++, j += 2 ) {
                ret.Add( wxString( StringParamNames[ i ], wxConvUTF8)  );
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
                ret.Add( wxString( _stringValues[ i ].c_str( ), wxConvUTF8 ) );
+#else
+               ret.Add( wxString( _stringValues[ i ] ) );
+#endif
      } // rof