[vtkusers] (no subject)

Shannon L. Hastings hastings at bmi.osu.edu
Fri Oct 29 14:10:47 EDT 2004


I am using the 4.2 windows release with the java wrappers and have
noticed the following problem.   I am trying to serialize from a
vtkDataWriter  to a vtkDataReader using a byte array or string etc
whatever will work.  I have this code working in c++ but with the java
wrappers I get a "Error reading binary data" in reader.  Also, I have
tried to use the writer to write out ASCII to a string and noticed that
is not supported as it gives a "OutputString was not long enough."  So I
am using binary on both ends (see below). The image comes out on the
other side corrupted.  There is something definitely wrong with the
bytes or the interpretation of them, possible due to the JNI layer or
due to the fact that the RegisterAndGetOutputString() is returning a
Java String and not a char[];  Any thoughts?
 
Thanks in advance!
Shannon
 
 
Here is the snippet:
 
vtkStructuredPointsWriter writer = new vtkStructuredPointsWriter();
vtkStructuredPointsReader reader = new vtkStructuredPointsReader();
vtkImageData output;  //assume output has some image in it
 
writer.SetInput(output);
writer.SetFileTypeToBinary();                  
writer.SetWriteToOutputString(1);
writer.Write();
 
//serialize
String data = writer.RegisterAndGetOutputString();
 
//deserialize
reader.ReadFromInputStringOn();
reader.SetBinaryInputString(data.getBytes(),data.length());
reader.Update();
 
 
_____________________________
      Shannon L. Hastings
                           Senior Research Specialist
 
Multiscale Computing Lab        333 W. Tenth Ave
Biomedical Informatics               3175 Graves Hall
Ohio State University                 Columbus, OH 43210
                                                614-292-9461
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041029/4520fc26/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1709 bytes
Desc: image001.gif
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041029/4520fc26/attachment.gif>


More information about the vtkusers mailing list