Thanks for your help. For number 3, image.GetSpacing() is a VTK call, however it returns a java double[], so I thought that it was OK. All these memory restrictions in Java make it very difficult to use, is there any plans to improve the usage of VTK in Java?<div>
<br></div><div>Thanks again!<br><br><div class="gmail_quote">On Tue, Mar 29, 2011 at 5:26 AM, Sebastien Jourdain <span dir="ltr"><<a href="mailto:sebastien.jourdain@kitware.com">sebastien.jourdain@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Jonathan,<br>
<br>
I directly reply on the context of your mail,<br>
<div class="im"><br>
<br>
On Tue, Mar 29, 2011 at 2:33 AM, Jonathan Morra <<a href="mailto:jonmorra@gmail.com">jonmorra@gmail.com</a>> wrote:<br>
> Since I'm using vtkJavaGarbageCollector I'm already using<br>
> vtkGlobalJavaHash.GC();. The main questions that I currently still need<br>
> answered are here<br>
</div>> 1. should I have to call System.gc(); and System.runFinalization();<br>
<div class="im">> frequently with VTK+Java? It appears the memory is managed better when<br>
> calling these lines every time vtkGlobalJavaHash.GC() is called, but I don't<br>
> know if this is necessary.<br>
<br>
</div>System.gc(); is the only one that you should really care about. But<br>
Java does not offer any guarantee if this method will do something or<br>
not. Moreover, the GC will stop all the thread to do its job. So it<br>
is basically up to you.<br>
<div class="im"><br>
> 2. Is it ok to reuse Java variables? Such as<br>
> vtkImageData image = filter.GetOuput();<br>
> // Do Stuff<br>
> image = filter2.GetOuput();<br>
<br>
</div>yes<br>
<div class="im"><br>
> 3. Is it OK to move around java objects without an intermediate reference?<br>
> Such as<br>
> image1.SetOutputSpacing(image2.GetSpacing());<br>
<br>
</div>what do you mean by Java object ? for me as the Set/Get do have a<br>
capital letter, I would say they come from the VTK world and if they<br>
return a vtkObject, you should use an intermediate variable otherwise<br>
if it's an array of primary type, that is just fine.<br>
<div class="im"><br>
> Sorry, forgot one more. Should I be calling vtkGlobalJavaHash.GC() from the event dispatch thread?<br>
> I saw that as an option in vtkJavaGarbageCollector, and I'm not sure why that's the case.<br>
<br>
</div>This totally depend on your VTK code, if you insure that all the call<br>
you are doing on the VTK layer is done through the EDT, then you<br>
should, otherwise you shouldn't. (This is a requirement if the data is<br>
shown in a renderer.)<br>
<br>
Seb<br>
</blockquote></div><br></div>