Fct_Match_Template_xxx

 

Fct_Match_Template_File

Fct_Match_Template_Frame

Fct_Match_Template_Geom

Fct_Match_Template_Id

Fct_Match_Template_Light

Fct_Match_Template_Point

Fct_Match_Template_TAG

Fct_Match_Template_Window

 

These function will match a template (using UNIX syntax) with the actual names of elements in the database.  It will then place pointers to all the matching elements in a vector.  This function is used to implement template matching in the scripts.

 

 

Syntax

 

int  Fct_Match_Template_File(

          char *t_name,

          int max_match,

          SliceO_File *List[]

) ;

 

int  Fct_Match_Template_Frame(

          char *t_name,

          int max_match,

          SliceO_Frame *List[]

) ;

 

int  Fct_Match_Template_Geom(

          char *t_name,

          int max_match,

          SliceO_Geom *List[]

) ;

 

int  Fct_Match_Template_Id(

          char *t_name,

          int max_match,

          unsigned short *List[]

) ;

 

int  Fct_Match_Template_Light(

          char *t_name,

          int max_match,

          unsigned short *List[]

) ;

 

int  Fct_Match_Template_Point(

          char *t_name,

          int max_match,

          SliceO_Point *List[]

) ;

 

int  Fct_Match_Template_TAG(

          char *t_name,

          int max_match,

          unsigned short *List[]

) ;

 

int  Fct_Match_Template_Window(

          char *t_name,

          int max_match,

          SliceO_Window *List[]

) ;

 

 

Parameters

 

t_name

Template string.

 

max_match

Maximum number of accepted matches

 

list

Vector of pointers to receive the matches.

 

 

Return value

 

This function return the actual number of item matched.

 

 

Remarks

 

The matching syntax used in sliceOmatic is inspired by the UNIX matching syntax.

 

?

replaces one character

ex:  toto_?   Will match toto_1, toto_a but not toto or toto_12

 

 

*

replaces 0 to many characters

ex:  toto_*   Will match toto_1, toto_a,  toto_12 but not toto

 

 

[abc]

replaces one character by a, b or c

ex:  toto_[12]   Will match toto_1, toto_2 but not toto_a or toto_12

 

 

[!abc]

replaces one character by any character but a, b or c

ex:  toto_[!12]   Will match toto_1 but not toto_1 or toto_2

 

 

[a-c]

replaces one character by a character from a to c

ex:  toto_[0-9]   Will match toto_1 and toto_2 but not toto_a or toto_12

 

 

So if, for example, you to delete all the Tags between 20 and 59 on the presently selected images, you could replace the "t_tag" in the following command:

          Tag: t_tag del

with the string "[2-5]?"

          Tag: [2-5]? del

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

Library:

          sliceO_Structures.lib

 

 

Example

 

          ...

 

          int list_nb ;

          unsigned short list_pt[MAX_TAG] ;

          

          char *t_tag = pt_arg[0] ;

          cmd = pt_arg[1] ;

 

          // ====================================================================

          // === Tag color

          // ====================================================================

          if ( ! _strnicmp( cmd, "color", 3 ) ) {

 

                    if ( ! Script_Arg_Check( "Tag: t_tag color R G B", nb_arg, 5 ) )

                              return( 1 ) ;

 

                    // --- Get the list of matching tags ---

                    list_nb = Fct_Match_Template_TAG( t_tag, MAX_TAG, list_pt ) ;

 

                    // --- Apply the changes to all matching tags ---

                    for ( int i=0; i < list_nb; i++ ) {

                              TAG_Red[list_pt[i]] = atoi( pt_arg[2] ) << 8 ;

                              TAG_Grn[list_pt[i]] = atoi( pt_arg[3] ) << 8 ;

                              TAG_Blu[list_pt[i]] = atoi( pt_arg[4] ) << 8 ;

                    }

 

                    // --- let the world know about this ---

                    Fct_Update( UPDATE_COLOR_TAG ) ;

 

                    return( 1 ) ;

          }

 

          ...

 

 

See also