[vtkusers] Re: how to isolate slices from a single raw volume file

arpit baldeva abaldeva at yahoo.com
Thu Mar 25 17:41:16 EST 2004


hi,

Thanks a lot for help. I tried using
SetFileNameSliceOffset() but it didn't work. Result is
still the same and the data read started from the
origin of file and not from a particular offset.

I also came across SetDataVOI(int[6]) but it also
didn't do the job. Still worst, it resulted in some
error. 

Generic Warning: In
C:\martink\vtk42\VTK\IO\vtkImageReader.cxx, line 303
File operation failed. row = 0, Tried to Read = 512,
Read = 0, Skip0 = -514, Skip1 = 514, FilePos =
75628642

Here is my code to read the raw file of a volume.
vtkImageReader* HeadDataSetReader=
vtkImageReader::New(); 
(HeadDataSetReader)->SetFileDimensionality(3);//all
the slices are in one file 
(HeadDataSetReader)->SetFileName("Female.raw"); 
(HeadDataSetReader)->SetDataByteOrderToBigEndian();
(HeadDataSetReader)->SetDataScalarTypeToUnsignedShort();

(HeadDataSetReader)->SetDataSpacing(1.0, 1.0,3.0); 
(HeadDataSetReader)->SetDataOrigin(0.0, 0.0, 0.0);
Now either one of these two.
(HeadDataSetReader)->SetFileNameSliceOffset(100);
(HeadDataSetReader)->SetDataExtent(0,255, 0,255,
0,50); 
or
(HeadDataSetReader)->SetDataVOI(0,255, 0,255,
100,150);

It doesn't work. Any suggestions ? Thanks a lot. 

Arpit.

	




>>>>> "arpit" == arpit baldeva <abaldeva at yahoo.com>
writes:

    arpit> Assuming 256x256 images, if I use
    arpit> SetDataExtent(0,255,0,255,0,49) and
    arpit> SetDataExtent(0,255,0,255,50,149) methods
for my
    arpit> vtkImageReader object, it doesnt work for
the second
    arpit> case. In the second case, it reads 100
slices but from the
    arpit> begining and not from the 50th slice.

    arpit> Any suggestions on how to do it in vtk ? Or
is it that i
    arpit> need to write some code outside vtk ? 
thanks a lot. I ll
    arpit> appreciate any help.

Using vtkImageReader2

    reader.SetFileNameSliceOffset(50)
    reader.SetDataExtent(0, 255, 0, 255, 0, 49)

should read slices 50 -> 99.


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html



More information about the vtkusers mailing list