/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        N O R M A L I S A T I O N   D ' U N E   I M A G E   F L O T T A N T E  :                                                   */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xci/normalise.01$K' :                                                                                          */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 1994??????????).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        I N T E R F A C E   ' listG '  :                                                                                           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        :Debut_listG:                                                                                                              */
/*        :Fin_listG:                                                                                                                */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        D I R E C T I V E S   S P E C I F I Q U E S   D E   C O M P I L A T I O N  :                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        F I C H I E R S   D ' I N C L U D E S  :                                                                                   */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#include  INCLUDES_BASE
#include  image_image_IMAGESF_EXT

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A R A M E T R E S  :                                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   NORMALISER                                                                                                                    \
                    VRAI                                                                                                                \
                                        /* Faut-il normaliser dans [0,1] ('VRAI') ou seulement translater par rapport au minumum     */ \
                                        /* ('FAUX') ?                                                                                */

#define   EXTRAIRE_LES_EXTREMA                                                                                                          \
                    VRAI                                                                                                                \
                                        /* Faut-il extraire les extrema ('VRAI') ou bien prendre les arguments d'appel ('FAUX') ?    */

#define   VALEUR_MINIMALE                                                                                                               \
                    COORDONNEE_BARYCENTRIQUE_MINIMALE
#define   VALEUR_MAXIMALE                                                                                                               \
                    COORDONNEE_BARYCENTRIQUE_MAXIMALE
                                        /* Extrema a priori...                                                                       */

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M A C R O S   U T I L E S  :                                                                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        N O R M A L I S A T I O N   D ' U N E   I M A G E   F L O T T A N T E  :                                                   */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
     Bblock
     DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
     DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_PIPE));
     DEFV(Logical,INIT(normaliser,NORMALISER));
                                        /* Faut-il normaliser dans [0,1] ('VRAI') ou seulement translater par rapport au minumum     */
                                        /* ('FAUX') ?                                                                                */
     DEFV(Logical,INIT(extraire_les_extrema,EXTRAIRE_LES_EXTREMA));
                                        /* Faut-il extraire les extrema ('VRAI') ou bien prendre les arguments d'appel ('FAUX') ?    */
     DEFV(genere_Float,INIT(nivo_minimum,VALEUR_MINIMALE));
     DEFV(genere_Float,INIT(nivo_maximum,VALEUR_MAXIMALE));
                                        /* Niveau de NOIR de l'image Resultat.                                                       */
     /*..............................................................................................................................*/
     GET_ARGUMENTSi(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_L("IFnormalisation_____compatibilite_20120705=""compatibilite_20120705="
                                       ,IFnormalisation_____compatibilite_20120705
                                        );
                                        /* Parametre introduit le 20120705120347...                                                  */

                         GET_ARGUMENT_C("imageA=""A=",nom_imageA);
                         GET_ARGUMENT_C("imageR=""R=",nom_imageR);
                         GET_ARGUMENT_L("normaliser=",normaliser);
                         GET_ARGUMENT_L("extraire_extrema=""calculer_extrema=""extrema=",extraire_les_extrema);
                         GET_ARGUMENT_F("amplitude_nullite=""nullite="
                                       ,IFnormalisation_____amplitude_des_extrema_en_deca_de_laquelle_il_y_a_nullite
                                        );
                                        /* Parametre introduit le 20081228102843...                                                  */
                         GET_ARGUMENT_F("minimum=""min=",nivo_minimum);
                         GET_ARGUMENT_F("maximum=""max=",nivo_maximum);
                         GET_ARGUMENT_F("origine=""o=",IFnormalisation_____niveau_origine___de_normalisation);
                         GET_ARGUMENT_F("extremite=""e=",IFnormalisation_____niveau_extremite_de_normalisation);
                         GET_ARGUMENT_L("zero=",IFnormalisation_____conserver_le_zero);
                                        /* Parametre introduit le 20050905120022...                                                  */
                         GET_ARGUMENT_L("partie_entiere=""entiers=""pe=",IFnormalisation_____prendre_la_partie_entiere);
                                        /* Cet argument a ete introduit le 20150305213550...                                         */
                         GET_ARGUMENT_L("equilibrer_partie_entiere=""equilibrer=""epe="
                                       ,IFnormalisation_____equilibrer_la_partie_entiere
                                        );
                                        /* Cet argument a ete introduit le 20150307083435...                                         */

                         GET_ARGUMENT_L("utiliser_moyenne_uniforme=""umu="
                                       ,IFnormalisation_____utiliser_la_moyenne_en_cas_d_uniformite
                                        );
                         GET_ARGUMENT_F("valeur_moyenne_forcee=""vmf=",IFnormalisation_____niveau_a_forcer_en_cas_d_uniformite);
                                        /* Parametres introduits le 20130626083108...                                                */
                         )
                    );

     CALi(IFinitialisation(IFmageR,FZERO));
                                        /* Initialisation de l'image Resultat.                                                       */

     Test(PAS_D_ERREUR(CODE_ERROR(IloadF_image(IFmageA,nom_imageA))))
          Bblock
          Test(IL_FAUT(normaliser))
               Bblock
               Test(IL_FAUT(extraire_les_extrema))
                    Bblock
                    CALS(IFnivo_extrema(IFmageA,ADRESSE(nivo_minimum),ADRESSE(nivo_maximum)));
                                        /* Extraction des extrema reels qui vont etre utilises...                                    */
                    Eblock
               ATes
                    Bblock
                                        /* Dans ce cas, ce sont les extrema arguments qui vont etre utilises...                      */
                    Eblock
               ETes

               CALS(IFnormalisation(IFmageR,IFmageA,nivo_minimum,nivo_maximum));
                                        /* Et renormalisation...                                                                     */
                                        /*                                                                                           */
                                        /* On notera le 20101110093219 que si 'IFmageA' est deja normalisee, alors 'IFmageR' est     */
                                        /* strictement identique a 'IFmageA'. Cela implique que si l'on normalise ainsi par erreur   */
                                        /* une image que l'on a deja normalisee anterieurement, cette nouvelle normalisation est     */
                                        /* tout a fait sans consequences. Cela a ete verifie pour {minimum=0,maximum=1} et semble    */
                                        /* aussi vrai pour des extrema differents (cela est evident mathematiquement, mais peut ne   */
                                        /* pas l'etre exactement a cause des erreurs d'arrondi ; au passage je l'ai verifie a cette  */
                                        /* date avec {-5,+3} sur un champ aleatoire genere par '$xci/random.01$X inf=-7 sup=+13').   */
               Eblock
          ATes
               Bblock
               CALS(IFtranslation_par_rapport_au_minimum(IFmageR,IFmageA));
                                        /* Et translation par rapport au minimum...                                                  */
               Eblock
          ETes

          CALi(IupdateF_image(nom_imageR,IFmageR));
          Eblock
     ATes
          Bblock
          Test__CODE_ERREUR__ERREUR07;
          Eblock
     ETes

     RETU_Commande;
     Eblock
ECommande



Copyright © Jean-François COLONNA, 2019-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2019-2024.