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

Home » Public Forums » archive » Re: Can i avoid the loop,help me speed up,thanks
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: Can i avoid the loop,help me speed up,thanks [message #61885 is a reply to message #61883] Mon, 04 August 2008 18:35 Go to previous messageGo to previous message
Chris[6] is currently offline  Chris[6]
Messages: 84
Registered: July 2008
Member
On Aug 4, 11:31 am, Vince Hradil <hrad...@yahoo.com> wrote:
> On Aug 4, 3:44 pm, "ben.bighair" <ben.bigh...@gmail.com> wrote:
>
>
>
>> On Aug 4, 9:29 am, Rongchang Chen <chenrc1...@gmail.com> wrote:
>
>>> I wrote a procedure to create sinograms from projections in
>>> tomography,the main part of procedure please see below.
>>> For large size and number projections,it's very very slow.
>>> Can i avoid the loop(one is OK) to speed up,or another way to create
>>> sinograms?
>>> Thank you very much!!
>
>>> ************
>>> n_sinogra:number of sinogram
>>> n_projection:number of projection
>>> files_projection:a string vector contain Directory and name of
>>> projection
>>> files_sino:a string vector contain Directory and name of sinogram
>
>>> for jj = 0,n_sinogram-1 do begin
>>>     print,'now creating',jj+1,'th sinogram'
>>>     sino = fltarr(sizepro[0],n_projection)
>
>>>     for ii=0, n_projection-1 do begin
>>>         image = float(read_image(files_projection[ii]))
>>>         some processing of image
>>>         sino(*,ii) = image(*,jj)
>>>     endfor
>
>>>     write_tiff,files_sino(jj),sino,/short,/float
>>> endfor
>>> *****************
>
>> Hi,
>
>> I don't think it is possible for anyone to penetrate where you are
>> having trouble with the given information.  I think you might try
>> using the builtin PROFILER routine for a start.  It should reveal to
>> you where you are spending most of your time.
>
>> Unrelated to the speed issue, you seem to be specifying TIFF output
>> simultaneously as a SHORT integer and a FLOAT.  What type of image do
>> you want to be saving?
>
>> Cheers,
>> Ben
>
> I agree with Ben - the question is: what is in the "some processing of
> image" step?  If this can be "vectorized", then you might be able to
> avoid some looping.

I would also add that you are taking a huge penalty by opening every
file in each outer loop iteration. IO is very, very slow. If you are
looking for a speedup, see if you can reverse the order of the loops
and read each file only once. The next step is to see if you can
eliminate your (currently) outer loop through vectorization, but this
requires a more detailed description of what kind of image processing
you are doing.

Chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Counting the lengths of continuous numbers in an array
Next Topic: Short array memory allocation

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

Current Time: Wed Oct 08 19:35:23 PDT 2025

Total time taken to generate the page: 0.00437 seconds