[Insight-users] AddObserver + JAVA

William A. Hoffman billlist at nycap.rr.com
Wed Jan 26 17:28:44 EST 2005


Folks, you can do observers with the Java wrapping.

There is a java class itkJavaCommand created by the wrapping.
If you sub-class from itkJavaCommand and implement an
Execute method
public class myMethodObject extends itkJavaCommand {
 public void Execute() {
// do some stuff
}
}

Then add myMethodObject as a the command.
The Key is the Execute should have no arguments.


-Bill


>> public class CommandIterationUpdate extends
>> itkJavaCommand{
>>  
>>           
>> public void Execute(final itkObject object, final itkEventObject 
>> event) {
>>                
>>         itkRegularStepGradientDescentOptimizer
>> optimizer;  
>>         optimizer=
>> (itkRegularStepGradientDescentOptimizer) object;
>>         
>>          itkIterationEvent it = new
>> itkIterationEvent();
>> 
>>           if( (event) ==  (it)  )
>>           {
>>               return;
>>           }
>>         
>>  System.out.print(optimizer.GetCurrentIteration());
>>             System.out.print(optimizer.GetValue());
>>            
>> System.out.print(optimizer.GetCurrentPosition());
>>          
>>     }
>>     
>> }
>> 



More information about the Insight-users mailing list