[vtkusers] Bug in vtkXMLPPolyDataWriter ?

Randall Hand randall.hand at gmail.com
Wed Jan 18 12:34:56 EST 2006


Like I mentioned earlier this week, I have a piece of code like such:
#include <stdio.h>
#include <vtkPLYReader.h>
#include <vtkXMLPPolyDataWriter.h>
#include <vtkCallbackCommand.h>
#include <vtkCommand.h>
#include <sys/types.h>
#include <time.h>


static void ShowProgress( vtkObject *caller,
        unsigned long vtkNotUsed(eventId), void *, void *av)
{
    double amount;
    time_t theTime;
    char *strtime ;
    time(&theTime);
    strtime = asctime(localtime(&theTime));
    strtime[strlen(strtime)-1] = '\0';
    amount = *((double*)av);
    printf("\t%s: %s at %.1f%% Completion\n", strtime,
            caller->GetClassName(), (amount)*100.0);
}


int main (int argc, char *argv[]) {
    printf("Reading \"%s\"...\n", argv[1]);
    vtkCallbackCommand *vtkProgress = vtkCallbackCommand::New();
    vtkProgress->SetCallback(ShowProgress);


    vtkPLYReader *reader = vtkPLYReader::New();
    reader->SetFileName(argv[1]);
    reader->AddObserver(vtkCommand::ProgressEvent, vtkProgress);

    printf("Writing \"%s\"...\n", argv[2]);
    vtkXMLPPolyDataWriter *writer = vtkXMLPPolyDataWriter::New();
    writer->AddObserver(vtkCommand::ProgressEvent, vtkProgress);
    writer->SetInput(reader->GetOutput());
    writer->SetFileName(argv[2]);
    writer->SetNumberOfPieces(24);
    writer->WriteSummaryFileOn();
    writer->SetStartPiece(0);
    writer->SetEndPiece(23);
    writer->SetGhostLevel(0);

    printf("Here we go...\n");
    writer->Write();
}

Basically, I connect vtkPLYReader to a vtkXMLPPolyDataWriter to split a file
into 24 chunks for better parallelism in Paraview.  The PLY file easily
loads, consuming ~4G of Ram (I've got 32G here, so no problems there).  But
heres the process output:

[1005] [rhand at ruby:src/experiments/conv2pvtp]

[9:17:33am]% ./main
/Work/rhand/coloredvertex-newyorkcity.ply/Work/rhand/pvtp/city.pvtp
Reading "/Work/rhand/coloredvertex-newyorkcity.ply"...
Writing "/Work/rhand/pvtp/city.pvtp"...
Here we go...
        Wed Jan 18 09:17:47 2006: vtkPLYReader at 0.0% Completion
        Wed Jan 18 09:28:55 2006: vtkPLYReader at 100.0% Completion
        Wed Jan 18 09:28:55 2006: vtkXMLPPolyDataWriter at 0.0% Completion
        Wed Jan 18 09:28:55 2006: vtkXMLPPolyDataWriter at 0.0% Completion
        Wed Jan 18 09:33:11 2006: vtkXMLPPolyDataWriter at 1.0% Completion
        Wed Jan 18 09:50:50 2006: vtkXMLPPolyDataWriter at 2.0% Completion
        Wed Jan 18 10:07:05 2006: vtkXMLPPolyDataWriter at 3.0% Completion
        Wed Jan 18 10:23:48 2006: vtkXMLPPolyDataWriter at 4.0% Completion
        Wed Jan 18 10:44:23 2006: vtkPLYReader at 0.0% Completion
        Wed Jan 18 10:55:28 2006: vtkPLYReader at 100.0% Completion
Assertion failed: index < this->Internals.size(), file
/viz/home/rhand/src/VTK/vtk-ezviz/VTK/IO/vtkOffsetsManagerArray.h, line 140,
pid /70683
Abort
[1006] [rhand at ruby:src/experiments/conv2pvtp]

[10:55:29am]% ls /Work/rhand/pvtp/ -lah
total 585M
drwxr-----    2 rhand    staff          52 Jan 18 10:55 .
drwxrwxr-x   12 rhand    erdcvsta      64k Jan 18 08:47 ..
-rw-r-----    1 rhand    staff        584M Jan 18 10:44 city_0.vtp
-rw-r-----    1 rhand    staff        1.5k Jan 18 10:55 city_1.vtp




So it seems to have written the first file, but died shortly into the second
file.  city_0.vtp seems to contain the entire dataset.  See the following:
for the input PLY file:
[1066] [rhand at prism:/Work/rhand]

[11:31:25am]% head coloredvertex-newyorkcity.ply --lines=12
ply
format binary_little_endian 1.0
comment VTK generated PLY File
obj_info vtkPolyData points and polygons: vtk4.0
element vertex 24969475
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
element face 50335280

and
[1062] [rhand at prism:/Work/rhand/pvtp]

[11:29:32am]% head city_0.vtp
<?xml version="1.0"?>
<VTKFile type="PolyData" version="0.1" byte_order="BigEndian"
compressor="vtkZLibDataCompressor">
  <PolyData>
    <Piece NumberOfPoints="24969475"     NumberOfVerts="0"
NumberOfLines="0"            NumberOfStrips="0"            NumberOfPolys="
50335280"    >
      <PointData Scalars="RGB">
        <DataArray type="UInt8" Name="RGB" NumberOfComponents="3"
format="appended" offset="0"           />
      </PointData>
      <CellData>
      </CellData>
      <Points>
[1063] [rhand at prism:/Work/rhand/pvtp]

[11:29:36am]% head city_1.vtp
<?xml ve  NumberOfPoints="24969475"="PolyData" version="0
NumberOfStrips="0"Endian" compressor="vtkZLibDataCompressor">
  <PolyData>
    <Piece NumberOfPoints=""             NumberOfVerts=""
NumberOfLines=""             NumberOfStrips=""
NumberOfPolys=""            >
      <PointData Scalars="RGB">
        <DataArray type="UInt8" Name="RGB" NumberOfComponents="3"
format="appended" offset=""            />
      </PointData>
      <CellData>
      </CellData>
      <Points>
        <DataArray type="Float32" NumberOfComponents="3" format="appended"
offset=""            />
[1064] [rhand at prism:/Work/rhand/pvtp]

[11:30:14am]%

Not sure why the header is scrambled on the city_1.vtp, I double checked.
This isn't a cut-n-paste error, the header was written to the file like
that.  The last thing in the city_1.vtp is the AppendedData tag, followed by
about 4 bytes of binary junk, even though it says it's base64 encoded.

So, any ideas what's going on?  I'm using the latest of the VTK-5-0 branch,
on an SGI Irix, compiled in 64-bit mode.


--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060118/113404a7/attachment.htm>


More information about the vtkusers mailing list