/*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N E N T R E D E U X I M A G E S S U I V A N T U N P O N D E R A T E U R */ /* S U I V A N T L E V O I S I N N A G E D E C H A Q U E P O I N T : */ /* */ /* */ /* Definition : */ /* */ /* Cette commande genere une image */ /* dont le nom est le premier argument */ /* d'appel ; elle est le resultat de */ /* l'interpolation entre les deux images */ /* Arguments suivant un Ponderateur et */ /* son complement et en prenant en compte */ /* les informations de voisinnage */ /* ('v $xiii/pent_image$FON 20120422090922' */ /* pour le principe). */ /* */ /* On notera bien que : */ /* */ /* interpolation(A1,A2) # interpolation(A2,A1) */ /* */ /* ce qui signifie que cela ne "commute" pas */ /* ('v $xiirc/MANE.Z3.2' pour illustrer cela */ /* ou encore 'v $xiav/INTERPOLE_12.11$R16'). */ /* */ /* */ /* Author of '$xci/interpole.12$K' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 20101011154739). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* 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 #include image_image_PENT_IMAGE_EXT /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P A R A M E T R E S : */ /* */ /*************************************************************************************************************************************/ #define COMPATIBILITE_20120423 \ FAUX \ /* Permet d'assurer la compatibilite anterieure au 20120423110114 si besoin est et alors */ \ /* de ne pas initialiser le FOND... */ #define INVERSER_LE_PONDERATEUR \ FAUX \ /* Faut-il inverser le ponderateur ('VRAI') ou le conserver tel quel ('FAUX') ? */ #define NOMBRE_DE_POINTS \ PARE(1024) \ /* Nombre de points maximal a traiter sur une spirale. */ #define FAIRE_DE_PLUS_L_INTERPOLATION_COMPLEMENTAIRE \ FAUX \ /* Faut-il en plus de l'interpolation "directe", faire l'interpolation "complementaire" */ \ /* ('VRAI') ? */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A C R O S U T I L E S : */ /* */ /*************************************************************************************************************************************/ #define imageFOND \ ImageA5 #define FimageFOND \ IFmageA5 /* Definition du Fond (introduit le 20120423103706). */ #define imageA1 \ ImageA1 #define FimageA1 \ IFmageA1 #define imageA2 \ ImageA3 #define FimageA2 \ IFmageA3 /* Definition des deux images Argument a interpoler. */ #define ponderD \ ImageA2 #define FponderD \ IFmageA2 #define ponderC \ ImageA4 #define FponderC \ IFmageA4 /* Definition du ponderateur Direct et de son Complement. */ #define imageR \ ImageR #define FimageR \ IFmageR /* Definition de l'image Resultat. */ #define INVERSION_EVENTUELLE_DU_PONDERATEUR(ponderateur1,ponderateur2) \ COND(IL_NE_FAUT_PAS(inverser_le_ponderateur),ponderateur1,ponderateur2) \ /* Inversion eventuelle du ponderateur introduite le 20081021090238... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* I N T E R P O L A T I O N E N T R E D E U X I M A G E S S U I V A N T U N P O N D E R A T E U R */ /* S U I V A N T L E V O I S I N N A G E D E C H A Q U E P O I N T : */ /* */ /*************************************************************************************************************************************/ BCommande(nombre_d_arguments,arguments) /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE)); DEFV(CHAR,INIC(POINTERc(nom_imageA1),NOM_PIPE)); DEFV(CHAR,INIC(POINTERc(nom_imageA2),NOM_PIPE)); DEFV(CHAR,INIC(POINTERc(nom_imageP),NOM_PIPE)); DEFV(CHAR,INIC(POINTERc(nom_imageFOND),NOM_PIPE)); /* Le Fond ('nom_imageFOND') a ete introduit le 20120422075927... */ DEFV(Logical,INIT(compatibilite_20120423,COMPATIBILITE_20120423)); /* Permet d'assurer la compatibilite anterieure au 20120423110114 si besoin est et alors */ /* de ne pas initialiser le FOND... */ DEFV(Logical,INIT(inverser_le_ponderateur,INVERSER_LE_PONDERATEUR)); /* Faut-il inverser le ponderateur ('VRAI') ou le conserver tel quel ('FAUX') ? */ DEFV(Positive,INIT(nombre_de_points,NOMBRE_DE_POINTS)); /* Nombre maximal de points a traiter sur une spirale. */ DEFV(Logical,INIT(faire_de_plus_l_interpolation_complementaire,FAIRE_DE_PLUS_L_INTERPOLATION_COMPLEMENTAIRE)); /* Faut-il en plus de l'interpolation "directe", faire l'interpolation "complementaire" */ /* ('VRAI') ? */ /*..............................................................................................................................*/ BSaveModifyVariable(Float,Fcombinaison_universelle_valeurs_____ponderation_de_ADD2,FZERO); BSaveModifyVariable(Float,Fcombinaison_universelle_valeurs_____ponderation_de_MAX2,FU); /* Introduit le 20101111110630 afin de fixer par defaut les valeurs les plus utiles... */ GET_ARGUMENTSv(nombre_d_arguments ,BLOC(GET_ARGUMENT_L("Iassociation_de_voisinage_____compatibilite_20101012=""compatibilite_20101012=" ,Iassociation_de_voisinage_____compatibilite_20101012 ); /* Argument complete le 20120911135007... */ GET_ARGUMENT_L("Iassociation_de_voisinage_____compatibilite_20120421=""compatibilite_20120421=" ,Iassociation_de_voisinage_____compatibilite_20120421 ); /* Argument introduit le 20120421082828 et complete le 20120911135007... */ GET_ARGUMENT_L("compatibilite_20120423=",compatibilite_20120423); /* Argument introduit le 20120423110114... */ GET_ARGUMENT_C("imageA1=""A1=",nom_imageA1); GET_ARGUMENT_C("imageA2=""A2=",nom_imageA2); GET_ARGUMENT_C("imageP=""P=",nom_imageP); GET_ARGUMENT_C("imageR=""R=",nom_imageR); GET_ARGUMENT_C("imageF=""F=""FOND=",nom_imageFOND); /* Argument introduit le 20120422075927... */ GET_ARGUMENT_L("standard=",les_images_sont_standards); GET_ARGUMENT_L("message_attention_extrema=""mae=" ,Ifloat_std_____editer_le_message_d_attention_relatif_aux_extrema ); /* Arguments introduits le 20101109160703 pour 'v $xiirf/.FRA3.S2.2.$U erreur_extrema'... */ GET_ARGUMENT_L("valider_compatibilite_images=""valider=""val=" ,Iassociation_de_voisinage_____valider_la_compatibilite_des_images ); /* Arguments introduits le 20101013103410... */ GET_ARGUMENT_L("inverser_ponderateur=""inverser=""inv=",inverser_le_ponderateur); GET_ARGUMENT_L("accelerer_association=""accelerer=""acc=" ,Iassociation_de_voisinage_____accelerer_l_association ); /* Arguments introduits le 20120424165330... */ GET_ARGUMENT_I("pas_accelerateur=""paccelerateur=""pacc=" ,Iassociation_de_voisinage_____pas_de_parcours_de_l_accelerateur ); /* Arguments introduits le 20120427094010... */ GET_ARGUMENT_I("points=""n=",nombre_de_points); GET_ARGUMENT_L("arret_premier_point_hors_image=""arret_hors_image=""ahi=" ,Iassociation_de_voisinage_____s_arreter_sur_le_premier_point_hors_image ); GET_ARGUMENT_N("explorer_hors_image=""hors_image=""ehi=" ,Iassociation_de_voisinage_____s_arreter_sur_le_premier_point_hors_image ); /* Arguments introduits le 20101012230740... */ GET_ARGUMENT_I("seuil_discrimination_niveaux=""seuil=" ,Iassociation_de_voisinage_____seuil_de_discrimination_des_niveaux ); /* Argument introduit le 20101013103410... */ GET_ARGUMENT_L("complement_a_1=""forcer_extrema=",IFcomplementation_____forcer_les_extrema); GET_ARGUMENT_F("minimum=""min=",IFcomplementation_____niveau_minimum); GET_ARGUMENT_F("maximum=""max=",IFcomplementation_____niveau_maximum); /* La modification du 20101012170137 semble rendre ces arguments inutiles, mais je les */ /* conserve malgre tout... */ GET_ARGUMENT_L("interpolation_complementaire=""complementaire=""deux_interpolations=""deux=" ,faire_de_plus_l_interpolation_complementaire ); GET_ARGUMENT_N("interpolation_seule=""une_interpolation=""une=" ,faire_de_plus_l_interpolation_complementaire ); /* Arguments introduits le 20101111094954... */ GET_ARGUMENT_F("pADD2=" ,Fcombinaison_universelle_valeurs_____ponderation_de_ADD2 ); GET_ARGUMENT_F("pSOUS=" ,Fcombinaison_universelle_valeurs_____ponderation_de_SOUS ); GET_ARGUMENT_F("pMUL2=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MUL2 ); GET_ARGUMENT_F("pDIVZ=" ,Fcombinaison_universelle_valeurs_____ponderation_de_DIVZ ); GET_ARGUMENT_F("pMIN2=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MIN2 ); GET_ARGUMENT_F("pMAX2=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MAX2 ); GET_ARGUMENT_F("pMINMAX=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MINMAX ); GET_ARGUMENT_F("pMAXMIN=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MAXMIN ); GET_ARGUMENT_F("pMOYE=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MOYE ); GET_ARGUMENT_F("pMOYZ=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MOYZ ); GET_ARGUMENT_F("pMOYZSI=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MOYZSI ); GET_ARGUMENT_F("pMOYQ=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MOYQ ); GET_ARGUMENT_F("pMOYQSI=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MOYQSI ); GET_ARGUMENT_F("pMOYH=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MOYH ); GET_ARGUMENT_F("pSPUIX=" ,Fcombinaison_universelle_valeurs_____ponderation_de_SPUIX ); GET_ARGUMENT_F("pATAN=" ,Fcombinaison_universelle_valeurs_____ponderation_de_ATAN ); GET_ARGUMENT_F("pMULH24=" ,Fcombinaison_universelle_valeurs_____ponderation_de_MULH24 ); /* Arguments introduits le 20101111094954... Il furent completes le 20180823102111 avec */ /* les ponderations de 'MOYH(...)', 'SE12(...)' et 'SE22(...)', puis le 20181009171833 */ /* avec 'ATAN(...)', puis le 20181203163210 avec 'MULH24(...)'... */ ) ); /* Le passage de 'GET_ARGUMENTSi(...)' a 'GET_ARGUMENTSv(...)' a eu lieu le 20101011165628 */ /* a cause de 'v $xig/fonct$vv$DEF 20101011165744'. On notera que cela n'est pas utile dans */ /* la commande 'v $xci/craque$K GET_ARGUMENTSi' tout simplement parce que les deux images */ /* 'Iassociation_de_voisinage_____X' et 'Iassociation_de_voisinage_____Y' y sont referencees */ /* explicitement (au passage 'v $xci/interpole.12$K' est inspire de 'v $xci/craque$K'...). */ CALi(gIload_image_si_present(les_images_sont_standards ,imageFOND,FimageFOND ,nom_imageFOND ,NOM_PIPE ,Iinitialisation_____valeur_pour_gInettoyage,IFinitialisation_____valeur_pour_gInettoyage ) ); /* Initialisation de l'image Resultat. Le 20120422080407 : */ /* */ /* CALi(gInettoyage(les_images_sont_standards,imageR,FimageR)); */ /* */ /* a ete remplace par 'gIload_image_si_present(...)' afin de pouvoir reperer facilement */ /* (a l'aide d'un "Fond") les points qui ne sont pas atteints. En particulier en utilisant */ /* deux Fonds differents, puis en faisant une difference entre les deux images Resultat, */ /* ils apparaitront nettement... */ Test(PAS_D_ERREUR(CODE_ERROR(gIload_image(les_images_sont_standards,imageA1,FimageA1,nom_imageA1)))) Bblock /* Chargement de la premiere image Argument. */ Test(PAS_D_ERREUR(CODE_ERROR(gIload_image(les_images_sont_standards,imageA2,FimageA2,nom_imageA2)))) Bblock /* Chargement de la deuxieme image Argument. */ Test(PAS_D_ERREUR(CODE_ERROR(gIload_image(les_images_sont_standards,ponderD,FponderD,nom_imageP)))) Bblock /* Chargement de l'image de definition de la Ponderation, ou */ /* premier ponderateur, */ BSaveModifyVariable(Logical,IFcomplementation_____forcer_les_extrema,VRAI); /* Introduit le 20101012170137 afin d'etre sur d'avoir le complement a 1... */ Test(EST_VRAI(les_images_sont_standards)) Bblock /* Cas d'une image 'image' : */ BDEFV(imageF,imageFOND_non_standard); BDEFV(imageF,imageA1_non_standard); BDEFV(imageF,ponderD_non_standard); BDEFV(imageF,imageA2_non_standard); BDEFV(imageF,ponderC_non_standard); BDEFV(imageF,imageR_non_standard); CALS(Istd_float_avec_normalisation(imageFOND_non_standard,imageFOND)); CALS(Istd_float_avec_normalisation(imageA1_non_standard,imageA1)); CALS(Istd_float_avec_normalisation(ponderD_non_standard,ponderD)); CALS(Istd_float_avec_normalisation(imageA2_non_standard,imageA2)); CALS(IFcomplementation(ponderC_non_standard,ponderD_non_standard)); /* Puis generation du second ponderateur (complementaire du premier). */ CALS(Iassociation_de_voisinage(imageA1,imageA2,nombre_de_points)); /* Calcul de {Iassociation_de_voisinage_____X,Iassociation_de_voisinage_____Y} */ /* par la methode d'association de voisinage... */ Test(IL_NE_FAUT_PAS(compatibilite_20120423)) /* Test intrododuit le 20120423110114... */ Bblock CALS(IFmove(imageR_non_standard,imageFOND_non_standard)); /* Initialisation introduite le 20120423103706... */ Eblock ATes Bblock Eblock ETes CALS(IFinterpolation_locale_de_voisinage(imageR_non_standard ,INVERSION_EVENTUELLE_DU_PONDERATEUR(ponderD_non_standard ,ponderC_non_standard ) ,imageA1_non_standard ,INVERSION_EVENTUELLE_DU_PONDERATEUR(ponderC_non_standard ,ponderD_non_standard ) ,imageA2_non_standard ) ); /* Et interpolation a l'aide des deux ponderateurs 'ponderD' et 'ponderC' */ /* entre les deux images arguments 'imageA1' et 'imageA2'. */ Test(IL_FAUT(faire_de_plus_l_interpolation_complementaire)) Bblock BDEFV(imageF,imageR_non_standard_complementaire); CALS(Iassociation_de_voisinage(imageA2,imageA1,nombre_de_points)); /* Calcul de {Iassociation_de_voisinage_____X,Iassociation_de_voisinage_____Y} */ /* par la methode d'association de voisinage... */ Test(IL_NE_FAUT_PAS(compatibilite_20120423)) /* Test intrododuit le 20120423110114... */ Bblock CALS(IFmove(imageR_non_standard_complementaire,imageFOND_non_standard)); /* Initialisation introduite le 20120423103706... */ Eblock ATes Bblock Eblock ETes CALS(IFinterpolation_locale_de_voisinage(imageR_non_standard_complementaire ,INVERSION_EVENTUELLE_DU_PONDERATEUR(ponderC_non_standard ,ponderD_non_standard ) ,imageA2_non_standard ,INVERSION_EVENTUELLE_DU_PONDERATEUR(ponderD_non_standard ,ponderC_non_standard ) ,imageA1_non_standard ) ); /* Et interpolation "complementaire" (introduite le 20101111094954...). */ CALS(IFcombinaison_universelle(imageR_non_standard ,imageR_non_standard ,imageR_non_standard_complementaire ) ); /* Et enfin, combinaison des deux interpolations... */ EDEFV(imageF,imageR_non_standard_complementaire); Eblock ATes Bblock Eblock ETes CALS(Ifloat_std_avec_renormalisation(imageR,imageR_non_standard)); EDEFV(imageF,imageR_non_standard); EDEFV(imageF,ponderC_non_standard); EDEFV(imageF,imageA2_non_standard); EDEFV(imageF,ponderD_non_standard); EDEFV(imageF,imageA1_non_standard); EDEFV(imageF,imageFOND_non_standard); Eblock ATes Bblock /* Cas d'une image 'imageF' : */ BDEFV(image,FimageA1_standard); BDEFV(image,FimageA2_standard); CALS(Ifloat_std_avec_renormalisation(FimageA1_standard,FimageA1)); CALS(Ifloat_std_avec_renormalisation(FimageA2_standard,FimageA2)); CALS(IFcomplementation(FponderC,FponderD)); /* Puis generation du second ponderateur (complementaire du premier). */ CALS(Iassociation_de_voisinage(FimageA1_standard,FimageA2_standard,nombre_de_points)); /* Calcul de {Iassociation_de_voisinage_____X,Iassociation_de_voisinage_____Y} */ /* par la methode d'association de voisinage... */ Test(IL_NE_FAUT_PAS(compatibilite_20120423)) /* Test intrododuit le 20120423110114... */ Bblock CALS(IFmove(FimageR,FimageFOND)); /* Initialisation introduite le 20120423103706... */ Eblock ATes Bblock Eblock ETes CALS(IFinterpolation_locale_de_voisinage(FimageR ,INVERSION_EVENTUELLE_DU_PONDERATEUR(FponderD,FponderC) ,FimageA1 ,INVERSION_EVENTUELLE_DU_PONDERATEUR(FponderC,FponderD) ,FimageA2 ) ); /* Et interpolation a l'aide des deux ponderateurs 'FponderD' et 'FponderC' */ /* entre les deux images arguments 'FimageA1' et 'FimageA2'. */ Test(IL_FAUT(faire_de_plus_l_interpolation_complementaire)) Bblock BDEFV(imageF,FimageR_complementaire); CALS(Iassociation_de_voisinage(FimageA2_standard,FimageA1_standard,nombre_de_points)); /* Calcul de {Iassociation_de_voisinage_____X,Iassociation_de_voisinage_____Y} */ /* par la methode d'association de voisinage... */ Test(IL_NE_FAUT_PAS(compatibilite_20120423)) /* Test intrododuit le 20120423110114... */ Bblock CALS(IFmove(FimageR_complementaire,FimageFOND)); /* Initialisation introduite le 20120423103706... */ Eblock ATes Bblock Eblock ETes CALS(IFinterpolation_locale_de_voisinage(FimageR_complementaire ,INVERSION_EVENTUELLE_DU_PONDERATEUR(FponderC,FponderD) ,FimageA2 ,INVERSION_EVENTUELLE_DU_PONDERATEUR(FponderD,FponderC) ,FimageA1 ) ); /* Et interpolation "complementaire" (introduite le 20101111094954...). */ CALS(IFcombinaison_universelle(FimageR ,FimageR ,FimageR_complementaire ) ); /* Et enfin, combinaison des deux interpolations... */ EDEFV(imageF,FimageR_complementaire); Eblock ATes Bblock Eblock ETes EDEFV(image,FimageA2_standard); EDEFV(image,FimageA1_standard); Eblock ETes ESaveModifyVariable(Logical,IFcomplementation_____forcer_les_extrema); CALi(gIupdate_image(les_images_sont_standards,nom_imageR,imageR,FimageR)); Eblock ATes Bblock Test__CODE_ERREUR__ERREUR07; Eblock ETes Eblock ATes Bblock Test__CODE_ERREUR__ERREUR07; Eblock ETes Eblock ATes Bblock Test__CODE_ERREUR__ERREUR07; Eblock ETes ESaveModifyVariable(Float,Fcombinaison_universelle_valeurs_____ponderation_de_MAX2); ESaveModifyVariable(Float,Fcombinaison_universelle_valeurs_____ponderation_de_ADD2); /* Introduit le 20101111110630... */ RETU_Commande; Eblock ECommande