/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        " S H U F F L I N G "   D ' U N E   I M A G E  :                                                                           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Definition :                                                                                                               */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*                    Cette commande "shufflise"                                                                                     */
/*                  l'image argument.                                                                                                */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xci/shuffling.01$K' :                                                                                          */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 1988??????????).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        I N T E R F A C E   ' listG '  :                                                                                           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Definition :                                                                                                               */
/*                                                                                                                                   */
/*        :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_ALEATOIRES_1_EXT

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A R A M E T R E S  :                                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   SHUFFLING_INVERSE                                                                                                             \
                    FAUX                                                                                                                \
                                        /* Choix entre le shuffling "direct" et le shuffling "inverse" (plus rapide...). On notera   */ \
                                        /* que le 20040106140824, ce parametre est passe de 'VRAI' a 'FAUX' car, en effet, la        */ \
                                        /* fonction 'Ishuffling_direct(...)' conserve le nombre de points de niveau donne et ce      */ \
                                        /* contrairement a 'Ishuffling_inverse(...)'. Il est donc preferable d'utiliser la methode   */ \
                                        /* directe a priori...                                                                       */

#define   GRAINE                                                                                                                        \
                    DEUX                                                                                                                \
                                        /* Graine initiale.                                                                          */

#define   FORCE_LE_LONG_DE_OX                                                                                                           \
                    INVE(FLOT(DOUB(DOUB(SEIZE))))
#define   FORCE_LE_LONG_DE_OY                                                                                                           \
                    INVE(FLOT(DOUB(DOUB(SEIZE))))
                                        /* Force initiale.                                                                           */

#define   FAIRE_LE_SHUFFLING_DIRECT_DU_NOIR                                                                                             \
                    VRAI                                                                                                                \
                                        /* Faut-il faire le shuffling "direct" du 'NOIR' ('VRAI') ou pas ('FAUX') ?                  */

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

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        " S H U F F L I N G "   D ' U N E   I M A G 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(shuffling_inverse,SHUFFLING_INVERSE));
                                        /* Choix entre le shuffling "direct" et le shuffling "inverse" (plus rapide...). On notera   */
                                        /* que le 20040106140824, ce parametre est passe de 'VRAI' a 'FAUX' car, en effet, la        */
                                        /* fonction 'Ishuffling_direct(...)' conserve le nombre de points de niveau donne et ce      */
                                        /* contrairement a 'Ishuffling_inverse(...)'. Il est donc preferable d'utiliser la methode   */
                                        /* directe a priori...                                                                       */
     DEFV(Int,INIT(graine,GRAINE));
                                        /* Graine du generateur aleatoire...                                                         */
     DEFV(Float,INIT(force_le_long_de_OX,FORCE_LE_LONG_DE_OX));
     DEFV(Float,INIT(force_le_long_de_OY,FORCE_LE_LONG_DE_OY));
                                        /* Force du shuffling...                                                                     */
     DEFV(Logical,INIT(faire_le_shuffling_direct_du_NOIR,FAIRE_LE_SHUFFLING_DIRECT_DU_NOIR));
                                        /* Faut-il faire le shuffling "direct" du 'NOIR' ('VRAI') ou pas ('FAUX') ?                  */
     DEFV(Logical,DTb1(niveaux_a_traiter,COULEURS));
                                        /* Definit les niveaux sur lesquels on doit faire le shuffling "direct"...                   */
     /*..............................................................................................................................*/
     GET_ARGUMENTSi(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_L("Ishuffling_direct_____compatibilite_20040106=""compatibilite_20040106_direct="
                                       ,Ishuffling_direct_____compatibilite_20040106
                                        );
                         GET_ARGUMENT_L("Ishuffling_inverse_____compatibilite_20040106=""compatibilite_20040106_inverse="
                                       ,Ishuffling_inverse_____compatibilite_20040106
                                        );

                         GET_ARGUMENT_C("imageA=""A=",nom_imageA);
                         GET_ARGUMENT_C("imageR=""R=",nom_imageR);
                         GET_ARGUMENT_L("inverse=",shuffling_inverse);
                         GET_ARGUMENT_N("directe=""direct=",shuffling_inverse);
                         GET_ARGUMENT_L("directe_directe=""direct_direct=""dd=",Ishuffling_direct_____faire_la_transformation_directe);
                         GET_ARGUMENT_N("directe_inverse=""di=",Ishuffling_direct_____faire_la_transformation_directe);
                                        /* Parametres introduits le 20081008110252...                                                */
                         GET_ARGUMENT_I("methode=",gen_ft_____methode_standard);
                         GET_ARGUMENT_I("graine=",graine);
                         GET_ARGUMENT_L("affiner_rdn=",rdnIFnD_____affiner_la_generation);
                         GET_ARGUMENT_L("iterer_rdn=",rdnIFnD_____iterer_la_generation);
                         GET_ARGUMENT_F("forceX=""fX=""fx=",force_le_long_de_OX);
                         GET_ARGUMENT_F("forceY=""fY=""fy=",force_le_long_de_OY);
                         GET_ARGUMENT_L("noir=""NOIR=",faire_le_shuffling_direct_du_NOIR);
                         )
                    );

     CALi(Inoir(ImageR));
                                        /* Initialisation de l'image Resultat.                                                       */

     BoIn(niveau,NOIR,BLANC,PAS_COULEURS)
          Bblock
          EGAL(ITb1(niveaux_a_traiter,INDX(niveau,NOIR)),VRAI);
                                        /* Initialisation telle que tous les niveaux puissent subir a priori le shuffling "direct".  */
          Eblock
     EBoI

     Test(IL_FAUT(faire_le_shuffling_direct_du_NOIR))
          Bblock
          Eblock
     ATes
          Bblock
          Test(IL_FAUT(shuffling_inverse))
               Bblock
               PRINT_ATTENTION("pour le shuffling inverse, tous les niveaux sont traites, y compris le 'NOIR'");
                                        /* "Shuffling" de l'image par la methode "inverse" (plus rapide...).                         */
               Eblock
          ATes
               Bblock
               EGAL(ITb1(niveaux_a_traiter,INDX(NOIR,NOIR)),FAUX);
                                        /* Ainsi, le 'NOIR' ne subira pas le shuffling "direct".                                     */
               Eblock
          ETes
          Eblock
     ETes

     Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA,nom_imageA))))
          Bblock
          Test(IL_FAUT(shuffling_inverse))
               Bblock
               CALS(Ishuffling_inverse(ImageR,ImageA,graine,force_le_long_de_OX,force_le_long_de_OY));
                                        /* "Shuffling" de l'image par la methode "inverse" (plus rapide...).                         */
               Eblock
          ATes
               Bblock
               CALS(Ishuffling_direct(ImageR,ImageA,graine,force_le_long_de_OX,force_le_long_de_OY,niveaux_a_traiter));
                                        /* "Shuffling" de l'image par la methode "direct".                                           */
               Eblock
          ETes

          CALi(Iupdate_image(nom_imageR,ImageR));
          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.