Iterator

 

The Iterator is a mechanism used to go through database.  Iterators must first be initialized with the "Iterator_Init" function, and once you no longer need it, closed with the "Iterator_End" function.  Iterators can be used to go through the different windows, or through the class database.Each iterator is assigned a specific ID, if you have nested iterators, they each need different ID.  Since some of sliceOmatic's basic functions are done inside iterators, a set of ID's have been set aside for TomoVision's usage.

 

The IDs that you can use are:

ITERATOR_USER_1

ITERATOR_USER_2

 

 

 

Iterator_Init

Initialize an iterator

 

 

Iterator_End

 

Close an iterator

 

Iterator_Window

 

Iterate among the windows

 

Iterator_Class

 

Iterate among the classes

 

 

For example, if you want to perform an operation on all the selected frames of the current window you would use:

 

// --- I need a pointer to the current window ---

SliceO_window *Cur_WIndow = (SliceO_Window *) Fct_Variable_Value( "$WINDOW_CUR" ) ;

if ( ! Cur_WIndow ) {

          // --- we have a problem here... get out! ---

          ...

}

 

// --- start an iterator ---

if ( Iterator_Init( ITERATOR_USER_1, "Name of this function" ) ) {

 

          // --- now go through all the selected frames ---

          while( SliceO_Frame *frame = (SliceO_Frame *) Iterator_Class( ITERATOR_UESR_1, CLASS_TYPE_FRAME, Cur_Window, ITER_FLAG_SELECT ) ) {

 

                    // --- frame is now a pointer to one of the selected frames ---

                    ...

          }

 

           Iterator_End( ITERATOR_USER_1 ) ;

}