comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Reading Multiple DICOM Files
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Reading Multiple DICOM Files [message #65550 is a reply to message #65549] Mon, 09 March 2009 11:07 Go to previous messageGo to previous message
rtk is currently offline  rtk
Messages: 22
Registered: September 2008
Junior Member
On Mar 8, 6:17 pm, Jye <jye.sm...@gmail.com> wrote:
> if i eq 0 then All_Images = image_slice else All_Images =
> [[[All_Images]], [[image_slice]]]

Forget too much Java, which, I agree, is a bad thing. I'd say you
have been doing too much Matlab programming. The vast majority of
your problem lies with the line above. If I run this code on my box:

pro ttt0
s = systime(1)
for i=0,899 do begin
im = fix(dist(256))
if (i eq 0) then begin
all = im
endif else begin
all = [[[all]], [[im]]]
endelse
endfor
print, 'runtime = ', systime(1)-s
help, all
end

It takes 93 seconds. However, if I run this code:

pro ttt2
all = intarr(256,256,900)
s = systime(1)
for i=0,899 do begin
im = fix(dist(256))
all[*,*,i] = im
endfor
print, 'runtime = ', systime(1)-s
help, all
end

it takes 1.6 seconds. The only difference is that the output array is
allocated once, instead of 900 times with 899 ever-increasing array
copies to boot. Since you know the number of file in advance,
allocate All_Images and just assign into it.

Ron
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Changing color of composite objects
Next Topic: Re: starting point of dashed lines

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:19:42 PDT 2025

Total time taken to generate the page: 0.00406 seconds