[vtkusers] Re: ImageReader error

Alexandre Guimond guimond at bwh.harvard.edu
Mon Jul 2 11:09:01 EDT 2001


On Mon, 2 Jul 2001 10:30:53 -0400 (EDT)
TJ Wilkinson <tswilkin at fas.harvard.edu> writes:

> I have been using vtkImageReader with great success for about a month now,
> but just last week I began receiving the following error whenever I try to
> use vtkImageReader.
> 
> Generic Warning: In d:\wvtkbin\cpp\vtkImageReader.cpp, line 750
> File operation failed. row = 0, Read = 1352, Skip0 = -2792, Skip1 =
> 1036800, FilePos = -1
> 
> I haven't changed the calling code, and I've tried loading other files.  I
> also rebuilt the dll just for kicks, but nothing is helping.
> 
> I am going to continue trying new things, but if anyone has encountered
> this problem before, please tell me how you fixed it.

I also ran into problems last week with reading images.  some of them
only occur on multi-cpu machines, others even on single cpu machines.
they all seem to be related to the reading part.  I'm trying to track
them down, but so far, no success.

for example, this python script fails to convert a vtkStructuredPoints
file containing scalar data (e.g. a 3D MRI volume) to the usual I.001,
I.002... set of slices (without headers) on my sun 420R (4 cpus).
When it doesn't seg faults, some of the slices are blank.  It worked
fine before last week, and still works on a single cpu machine.

if you want to try it, call it like 'vtk2I mri.vtk mri/I'

#!/usr/local/bin/python

import sys
import os
from vtkpython import *

InputFileName=sys.argv[-2]
OutputFileName=sys.argv[-1]

reader=vtkStructuredPointsReader()
reader.SetFileName(InputFileName)

translate=vtkImageTranslateExtent()
translate.SetInput(reader.GetOutput())
translate.SetTranslation(0,0,1)

cast=vtkImageCast()
cast.SetInput(translate.GetOutput())
cast.SetOutputScalarTypeToUnsignedShort()

os.mkdir(os.path.dirname(OutputFileName))

writer=vtkImageWriter()
writer.SetInput(cast.GetOutput())
writer.SetFileDimensionality(2)
writer.SetFilePrefix(OutputFileName)
writer.SetFilePattern('%s.%03d')
writer.Write()

-- 
Alexandre Guimond, Ph.D. guimond at bwh.harvard.edu Phone:(617) 278-0800 
http://spl.bwh.harvard.edu:8000/~guimond/          Fax:(617) 264-5154
Brigham and Women's Hospital, Harvard Medical School
CNI, RF396, 221 Longwood Av, Boston, MA 02115




More information about the vtkusers mailing list