[Insight-users] AddObserver + JAVA
Oliveira Marcelo
marceloitk at yahoo.com.br
Wed Jan 26 13:50:11 EST 2005
Hi Li and users!!!
Taxs a lot for your replay, this help me a lot!!!
I´d been learn a lot about JNI. But i think that a
need examples how can i use JNI with ITK. Do you or
anyone could show me an example of ITK JAVA and JNI.
tanx a lot
best regards
--- "Li, George (NIH/NCI)" <ligeorge at mail.nih.gov>
escreveu:
> Oliveira:
>
> You can always use JNI to communicate your JAVA code
> with ITK C++ code. It might be a good option for you
> to by-pass the hurdle for the translation, which may
> be endless to keep up with their endless releases!!!
>
> Regard.
>
> George
>
>
> -----Original Message-----
> From: Oliveira Marcelo
> [mailto:marceloitk at yahoo.com.br]
> Sent: Tuesday, January 25, 2005 1:57 PM
> To: insight-users at itk.org
> Subject: [Insight-users] AddObserver + JAVA
>
>
> Hi Users !!!
>
> Im try to write the MultiResImageRegistration1.cxx
> in
> JAVA, but i dont know how can work with AddObserver.
>
> Please, is possible in the new itk version put more
> itk-java examples ? ill apreciated !!!
>
> tanx a lot for your help and time !!!
> best regards
>
> a piece of my code:
>
> //***** MAIN CODE ************************
>
> optimizer.AddObserver( new itkIterationEvent(), new
> CommandIterationUpdate() );
>
> registration.AddObserver(new itkIterationEvent(),
> new
> RegistrationInterfaceCommand());
>
>
> registration.SetNumberOfLevels( 3 );
>
> try
> {
>
> registration.StartRegistration();
>
> }
> catch(Exception e)
> {
> System.out.println("Error");
> }
>
>
//***************************************************
> //**** CommandIterationUpdate Class
> //**************************************************
>
> 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());
>
> }
>
> }
>
>
//***************************************************
> //**** RegistrationInterfaceCommand Class
> //**************************************************
> public class RegistrationInterfaceCommand extends
> itkJavaCommand{
>
> private itkMultiResolutionImageRegistrationMethod
> registration;
>
> public void Execute(itkObject object,final
> itkEventObject event)
> {
>
> itkIterationEvent it = new
> itkIterationEvent();
>
>
> if( (event) == (it) )
> {
> return;
> }
>
>
> itkRegularStepGradientDescentOptimizer
> optimizer;
> itkMultiResolutionImageRegistrationMethodF3F3
> reg;
>
>
> reg =
> (itkMultiResolutionImageRegistrationMethodF3F3)
> object;
>
>
> optimizer =
> (itkRegularStepGradientDescentOptimizer)
> reg.GetOptimizer();
>
> if( reg.GetCurrentLevel() == 0 )
> {
>
> optimizer.SetMaximumStepLength( 16.00
> );
>
> optimizer.SetMinimumStepLength( 2.5 );
> }
> else
> {
> optimizer.SetMinimumStepLength(
> optimizer.GetCurrentStepLength() );
> optimizer.SetMinimumStepLength(
> optimizer.GetMinimumStepLength()/10.00 );
>
>
> }
>
>
> }
>
> }
>
>
>
>
>
>
>
_______________________________________________________
>
> Yahoo! Acesso Grátis - Instale o discador do Yahoo!
> agora.
> http://br.acesso.yahoo.com/ - Internet rápida e
> grátis
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/
More information about the Insight-users
mailing list