[vtkusers] timings for vtkImageReader2
Kate Kerekes
kerekes at fastmail.fm
Thu Oct 7 16:19:08 EDT 2004
Hello again,
I apologize for the length of this message. I am still having problems with
the time it takes vtkImageReader2 to read 268 MB of data (a series of 512
files with 512x512 shorts each.) I ran the following test program (from
Mathieu Malaterre translated to tcl by me) to see how long a read takes:
#!/bin/sh
load vtkCommonTCL.dll
load vtkFilteringTCL.dll
load vtkGraphicsTCL.dll
load vtkIOTCL.dll
load vtkImagingTCL.dll
load vtkRenderingTCL.dll
load vtkHybridTCL.dll
source Interactor.tcl
source bindings-rw.tcl
source bindings-iw.tcl
source bindings.tcl
source setget.tcl
console show
set createImage yes
if {$createImage=="yes"} {
vtkImageNoiseSource noise
noise SetWholeExtent 0 511 0 511 0 511
noise SetMinimum 0.0
noise SetMaximum 1.0
[noise GetOutput] ReleaseDataFlagOn
puts "about to update vtkImageNoiseSource"
noise Update
puts "finished updating vtkImageNoiseSource"
vtkImageCast cast
cast SetInput [noise GetOutput]
cast SetOutputScalarTypeToUnsignedShort
vtkImageWriter writer
writer SetInput [cast GetOutput]
writer SetFileDimensionality 3
writer SetFileName "bench.img"
puts "about to update writer"
writer Write
puts "finished updating writer"
}
vtkImageReader2 reader
[reader GetOutput] ReleaseDataFlagOn
reader SetDataExtent 0 511 0 511 0 511
reader SetDataScalarTypeToUnsignedShort
reader SetDataByteOrderToLittleEndian
reader SetFileName "bench.img"
puts "about to update reader"
set time1 [clock clicks -milliseconds]
reader Update
set time2 [clock clicks -milliseconds]
puts "finished updating reader"
puts "reader update took [expr $time2-$time1] milliseconds"
The read takes 15 seconds on my machine (Windows XP with service pack 2, AMD
athlon 64 chipset 3000+, with 512 megs of memory). I am reading data from
the IDE harddrive. Mathieu's timing was 3 seconds. This of course is not
the newest machine out there, but it is not that old either.
Then when I try to read my series of slices, my machine takes 45 seconds.
The only difference in reading the slice files and the bench.img created by
ImageNoiseSource is that the bench.img is all three dimensions in one file
(rather than a series of slices), and the bench.img file uses unsigned
shorts rather than shorts (but both are 2 bytes, right?).
So here are my thoughts as to why the problem could be occurring--any
feedback would be appreciated:
1. my computer is too slow--I don't think this is it
2. the bench.img file only reads faster because it has just been written to
memory and is probably still in the cache and therefore takes less time to
access
3. the fact that my slices are in series and 512 different files have to be
read is the slow down
4. the code running in tcl is slower than code running in c (I can fix this
by calling a c function from tcl--but only if I think this is really the
problem)
5. there is some other problem that I am unaware of--this is my worst fear
:(
Please help! All of the other feedback I have gotten before says that the
read should take no more than a few seconds. 45 seconds is way too long for
our customer and this is not even the largest filesize that will be used.
Thanks,
Kate Kerekes
More information about the vtkusers
mailing list