View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005775VTK(No Category)public2007-09-25 03:302008-06-03 14:48
Reporteremiliano79 
Assigned ToSean McBride 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005775: vtkPLYReader does not work on win and mac ASCII ply files
DescriptionThe vtkPLYReader is able to load ply files either in binary format or in ASCII format, but in the second case there is a problem with line termination characters. The vtkPLYReader reads only ASCII lines terminating with LF character (0x0A) according to unix-like operating systems: to achieve platform independence, it is supposed to works fine also on win and mac ASCII files. In the former the lines terminate with CR LF (0x0D 0x0A), in the latter lines terminate with CR (0x0D). So the vtkPLYReader has to recognize different line terminations as well.
Additional InformationI have modified the vtkPLY.cxx file to implement platform independent line termination reading.
Just replace this section in the vtkPLY.cxx file:


 /* convert line-feed and tabs into spaces */
  /* (this guarentees that there will be a space before the */
  /* null character at the end of the string) */

  str[BIG_STRING-2] = ' ';
  str[BIG_STRING-1] = '\0';


  for (ptr = str, ptr2 = str_copy; *ptr != '\0'; ptr++, ptr2++) {
    *ptr2 = *ptr;

    if (*ptr == '\t') {
      *ptr = ' ';
      *ptr2 = ' ';
    }

    else if (*ptr == '\n') {
      *ptr = ' ';
      *ptr2 = '\0';
      break;
    }
  }


with:


  /* convert line-feed and tabs into spaces */
  /* (this guarentees that there will be a space before the */
  /* null character at the end of the string) */

  str[BIG_STRING-2] = ' ';
  str[BIG_STRING-1] = '\0';

  for (ptr = str, ptr2 = str_copy; *ptr != '\0'; ptr++, ptr2++) {
    *ptr2 = *ptr;

    if (*ptr == '\t') {
      *ptr = ' ';
      *ptr2 = ' ';
    }

/* -----------------------------------------------------------------------
    *-*-* PATCH *-*-* PATCH *-*-* PATCH *-*-* PATCH *-*-*
--------------------------------------------------------------------------
Patch to allow reading PLY files in Unix, Windows and Mac end line format
------------------------------------------------------------------------*/

    else if (*ptr == '\r') {
      *ptr = ' ';
      *ptr2 = '\0';
    }

/* -----------------------------------------------------------------------
    *-*-* PATCH *-*-* PATCH *-*-* PATCH *-*-* PATCH *-*-*
-------------------------------------------------------------------------/

    else if (*ptr == '\n') {
      *ptr = ' ';
      *ptr2 = '\0';
      break;
    }
  }
TagsNo tags attached.
Project
Type
Attached Filestxt file icon plyPatch.txt [^] (2,289 bytes) 2007-11-12 15:36 [Show Content]
cxx file icon TestPLYReader.cxx [^] (2,441 bytes) 2007-11-12 16:58
png file icon TestPLYReader.png [^] (32,740 bytes) 2007-11-12 16:58


txt file icon plyTestPatch.txt [^] (3,307 bytes) 2007-11-12 16:59 [Show Content]

 Relationships

  Notes
(0009282)
emiliano79 (reporter)
2007-09-25 03:46

The modified function in the vtkPLY.cxx file is the get_words() one.
(0009668)
Mathieu Coursolle (reporter)
2007-11-12 15:38

Here is a patch with the proposed changed. It also contains the changes proposed in 5776.

New file types are added (float32, int32 and uint8), to be able to open
the stanford bunny: http://www-graphics.stanford.edu/data/3Dscanrep/ [^]

It was tested on Intel Mac OS 10.5.
(0009669)
Mathieu Coursolle (reporter)
2007-11-12 17:00

I attached a proposed test which loads the stanford bunny available at:
ftp://graphics.stanford.edu/pub/3Dscanrep/bunny.tar.gz [^]

I attached the test file: TestPLYReader.cxx
the validation image: TestPLYReader.png
as well as the updated patch file which include that test.
(0009686)
Sean McBride (developer)
2007-11-15 10:50

We have just committed a fix for this in CVS, as of 2007-11-15 10:50 ish. Can you please confirm it is fixed? Thanks.
(0012229)
Sean McBride (developer)
2008-06-03 14:48

Many months with no feedback from reporter. Closed.

 Issue History
Date Modified Username Field Change
2007-09-25 03:30 emiliano79 New Issue
2007-09-25 03:46 emiliano79 Note Added: 0009282
2007-11-12 15:36 Mathieu Coursolle File Added: plyPatch.txt
2007-11-12 15:38 Mathieu Coursolle Note Added: 0009668
2007-11-12 16:58 Mathieu Coursolle File Added: TestPLYReader.cxx
2007-11-12 16:58 Mathieu Coursolle File Added: TestPLYReader.png
2007-11-12 16:59 Mathieu Coursolle File Added: plyTestPatch.txt
2007-11-12 17:00 Mathieu Coursolle Note Added: 0009669
2007-11-14 12:38 Sean McBride Status backlog => tabled
2007-11-14 12:38 Sean McBride Assigned To => Sean McBride
2007-11-15 10:50 Sean McBride Status tabled => @80@
2007-11-15 10:50 Sean McBride Resolution open => fixed
2007-11-15 10:50 Sean McBride Note Added: 0009686
2008-06-03 14:48 Sean McBride Status @80@ => closed
2008-06-03 14:48 Sean McBride Note Added: 0012229
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2018 MantisBT Team