Ghosts and Extents (was [vtkusers] vtkImageImport in java?)
Stewart, Terry
Terry.Stewart at xeroxlabs.com
Thu Feb 9 13:35:49 EST 2006
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. Did you use some other mechanism to get
your image data inserted into vtkImageData that is perhaps more
efficient?
Thx.
Terry
>Howdy,
>
>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
>
>
More information about the vtkusers
mailing list