Ghosts and Extents (was [vtkusers] vtkImageImport in java?)

Steve M. Robbins steven.robbins at videotron.ca
Thu Feb 9 18:08:23 EST 2006


On Thu, Feb 09, 2006 at 10:35:49AM -0800, Stewart, Terry wrote:
> 
> Steve,
> 
>   I'm using Java and ran into a similar situation while trying to get my
> internally-generated RGB image into vtkImageData.  I'd tried the
> vtkImageImport path too only to run into the same roadblock with the
> missing [Copy|Set]ImportVoidPointer() methods for Java.  I've gotten my
> logic to a functional state via:
> 
>    vtkImageData imageData = new vtkImageData();
>          :
>    for (x = 0; ...)
>       for (y = 0; ... )
>          imageData.SetScalarComponentFromDouble(x, y, 0, rComp, (double)
> buffer[byteIndex++]);
>          imageData.SetScalarComponentFromDouble(x, y, 0, gComp, (double)
> buffer[byteIndex++]);
>          imageData.SetScalarComponentFromDouble(x, y, 0, bComp, (double)
> buffer[byteIndex++]); 
> 
> However this is quite slow. 

Yep.

> Did you use some other mechanism to get
> your image data inserted into vtkImageData that is perhaps more
> efficient?  

Yep.  We wrote JNI code that effectively does a memcpy() to
vtkImage.GetVoidPointer().  I'd give you the code except that the JNI
bit is very specific to our application so it really wouldn't help
you.


-Steve
P.S.  I still don't know what ghost levels are.  Anyone?



> >On Fri, Jan 28, 2005 at 03:25:44PM -0500, Steve M. Robbins wrote:
> >
> >> Has anyone got example code that builds image data from 
> >scratch in Java?
> >> Ultimately I'd like a vtkImageData object.
> >> 
> >> I considered using vtkImageImport in java but there doesn't 
> >appear to 
> >> be any access to the two methods that actually copy data:
> >> CopyImportVoidPointer() and SetImportVoidPointer().  :-/
> >
> >I went back to copying the data directly into a vtkImageData 
> >object and finally managed to get things working.  It turns 
> >out that the only bit that I had missed initially was to call 
> >SetWholeExtent().  Using just SetExtent() is not enough, it seems.
> >
> >
> >I have read the VTK User's Guide.  The chapter on how the 
> >pipeline operates is helpful, but I'm still not sure exactly 
> >what is the distinction between "extent", "whole extent" and 
> >"update extent".  I get the feeling that the update extent is 
> >set at the output end of the pipeline (e.g. by mappers) and 
> >propagated backwards towards the source objects, but even that 
> >is not clear.  Who is responsible for setting the other two 
> >extents?  And what is a "ghost level"?
> >
> >Is there any documentation that defines these terms?
> >
> >How about source code: is there a particularly good class to 
> >start with?  Data class?  Source class?  Reader?
> >
> >Thanks,
> >-Steve
> >
> >
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list