[vtkusers] vtkStructuredPointsWriter writes a blank file
Matheus Viana
vianamp at gmail.com
Thu Jun 19 19:06:35 EDT 2014
Hi Bill, this is the code. I also tried to comments the lines related
to SetDataByteOrderToBigEndian
and SetDataScalarTypeToUnsignedShort, but they don't make any difference.
int main() {
vtkTIFFReader *TIFFReader = vtkTIFFReader::New();
TIFFReader -> SetDataByteOrderToBigEndian();
TIFFReader -> SetDataExtent(0,653,0,3959,0,3959);
TIFFReader -> SetFilePrefix("/Users/matheusviana/Desktop/images/im");
TIFFReader -> SetFilePattern("%s%04d.tif");
TIFFReader -> SetDataScalarTypeToUnsignedShort();
TIFFReader -> Update();
vtkStructuredPointsWriter *ImageDataWriter =
vtkStructuredPointsWriter::New();
ImageDataWriter -> SetFileType(VTK_BINARY);
ImageDataWriter -> SetInput(TIFFReader -> GetOutput());
ImageDataWriter -> SetFileName("Result.vtk");
ImageDataWriter -> Write();
return 1;
}
*Matheus Viana*
*Postdoctoral Research Employee*
*Developmental and Cell Biology*
*University of California Irvine*
2014-06-19 18:46 GMT-03:00 Bill Lorensen <bill.lorensen at gmail.com>:
> Please post your updated code.
>
>
> On Thu, Jun 19, 2014 at 4:56 PM, Matheus Viana <vianamp at gmail.com> wrote:
> > I got the same result, blank file.
> >
> > Matheus Viana
> > Postdoctoral Research Employee
> > Developmental and Cell Biology
> > University of California Irvine
> >
> >
> >
> >
> > 2014-06-19 17:35 GMT-03:00 Bill Lorensen <bill.lorensen at gmail.com>:
> >
> >> So, lets say each image is 512 x 512, and you have 3960 images,
> >> TIFFReader -> SetDataExtent(0,511,0,511,0,3959);
> >>
> >> On Thu, Jun 19, 2014 at 3:29 PM, Matheus Viana <vianamp at gmail.com>
> wrote:
> >> > They are in separate files.
> >> >
> >> > Matheus Viana
> >> > Postdoctoral Research Employee
> >> > Developmental and Cell Biology
> >> > University of California Irvine
> >> >
> >> >
> >> >
> >> >
> >> > 2014-06-19 16:21 GMT-03:00 Bill Lorensen <bill.lorensen at gmail.com>:
> >> >
> >> >> Are the images all in one file? Or separate files for each image?
> >> >>
> >> >>
> >> >> On Thu, Jun 19, 2014 at 1:56 PM, Matheus Viana <vianamp at gmail.com>
> >> >> wrote:
> >> >> > Dear David,
> >> >> >
> >> >> > I tried to use XMLImageDataWriter and it seems to be working.
> >> >> > However,
> >> >> > the
> >> >> > original VTK file that has 2Gb is then saved as a vti file that has
> >> >> > only
> >> >> > 10Mb. I think this is fine because my data is very sparse with a
> lot
> >> >> > of
> >> >> > zeros. I can make sure that it is working well because Paraview
> >> >> > crashes
> >> >> > when
> >> >> > I tried to load the file. I'll check it again later on. Anyway, do
> >> >> > you
> >> >> > think
> >> >> > the bug is in the StructuredPointsWriter?
> >> >> >
> >> >> > Bill, I tried to not specify the data extent, but in this case the
> >> >> > reader
> >> >> > reads only the first image of the sequence. Is there anything else
> I
> >> >> > have to
> >> >> > set up?
> >> >> >
> >> >> > Matheus Viana
> >> >> > Postdoctoral Research Employee
> >> >> > Developmental and Cell Biology
> >> >> > University of California Irvine
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > 2014-06-19 14:20 GMT-03:00 Bill Lorensen <bill.lorensen at gmail.com
> >:
> >> >> >
> >> >> >> The data extents you specified will produce a zero length
> structured
> >> >> >> points.
> >> >> >>
> >> >> >> For the tiff reader, you need not specify the extents if you want
> >> >> >> all
> >> >> >> of the data. And I'm not sure what the other methods will do in
> the
> >> >> >> tiff reader.
> >> >> >> vtkTIFFReader *TIFFReader = vtkTIFFReader::New();
> >> >> >> TIFFReader ->
> >> >> >> SetFilePrefix("/Users/matheusviana/Desktop/images/im");
> >> >> >> TIFFReader -> SetFilePattern("%s%04d.tif");
> >> >> >> TIFFReader -> Update();
> >> >> >>
> >> >> >> On Thu, Jun 19, 2014 at 8:14 AM, matheus_viana <vianamp at gmail.com
> >
> >> >> >> wrote:
> >> >> >> > Guys, I'd like to know if there is any error in this code below.
> >> >> >> > The
> >> >> >> > code
> >> >> >> > works fine for small size dataset, but it writes a blank file
> when
> >> >> >> > the
> >> >> >> > dataset has more than 2Gb. I'm working on 64bit OSX.
> >> >> >> >
> >> >> >> > Thanks a lot.
> >> >> >> >
> >> >> >> > int main() {
> >> >> >> > vtkTIFFReader *TIFFReader = vtkTIFFReader::New();
> >> >> >> > TIFFReader -> SetDataByteOrderToBigEndian();
> >> >> >> > TIFFReader -> SetDataExtent(0,0,0,0,0,3959);
> >> >> >> > TIFFReader ->
> >> >> >> > SetFilePrefix("/Users/matheusviana/Desktop/images/im");
> >> >> >> > TIFFReader -> SetFilePattern("%s%04d.tif");
> >> >> >> > TIFFReader -> SetDataScalarTypeToUnsignedShort();
> >> >> >> > TIFFReader -> Update();
> >> >> >> >
> >> >> >> > vtkStructuredPointsWriter *ImageDataWriter =
> >> >> >> > vtkStructuredPointsWriter::New();
> >> >> >> > ImageDataWriter -> SetFileType(VTK_BINARY);
> >> >> >> > ImageDataWriter -> SetInput(TIFFReader -> GetOutput());
> >> >> >> > ImageDataWriter -> SetFileName("Result.vtk");
> >> >> >> > ImageDataWriter -> Write();
> >> >> >> >
> >> >> >> > return 1;
> >> >> >> > }
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > View this message in context:
> >> >> >> >
> >> >> >> >
> >> >> >> >
> http://vtk.1045678.n5.nabble.com/vtkStructuredPointsWriter-writes-a-blank-file-tp5727536.html
> >> >> >> > Sent from the VTK - Users mailing list archive at Nabble.com.
> >> >> >> > _______________________________________________
> >> >> >> > Powered by www.kitware.com
> >> >> >> >
> >> >> >> > Visit other Kitware open-source projects at
> >> >> >> > http://www.kitware.com/opensource/opensource.html
> >> >> >> >
> >> >> >> > Please keep messages on-topic and check the VTK FAQ at:
> >> >> >> > http://www.vtk.org/Wiki/VTK_FAQ
> >> >> >> >
> >> >> >> > Follow this link to subscribe/unsubscribe:
> >> >> >> > http://public.kitware.com/mailman/listinfo/vtkusers
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> --
> >> >> >> Unpaid intern in BillsBasement at noware dot com
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Unpaid intern in BillsBasement at noware dot com
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Unpaid intern in BillsBasement at noware dot com
> >
> >
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140619/1dfde023/attachment.html>
More information about the vtkusers
mailing list