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

Home » Public Forums » archive » Can i avoid the loop,help me speed up,thanks
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Can i avoid the loop,help me speed up,thanks [message #61892] Mon, 04 August 2008 06:29 Go to next message
Rongchang Chen is currently offline  Rongchang Chen
Messages: 12
Registered: August 2008
Junior Member
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
*****************
Re: Can i avoid the loop,help me speed up,thanks [message #61959 is a reply to message #61892] Tue, 12 August 2008 05:47 Go to previous message
Rongchang Chen is currently offline  Rongchang Chen
Messages: 12
Registered: August 2008
Junior Member
On Aug 11, 7:20 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
>> I use PROFILER to check and show the I/O take most of time,use Chris
>> suggestion,I read all the projections(in 3D array) in advance and it
>> speed up a lot,but use 3D array I can just read 100 projections,if
>> more it complain’ % Array has too many elements.’ ??? how to avoid
>> this.
>
> You don't have enough memory available. Use "memtest.pro" from ITTVIS to
> figure out the largest array you can make. So you basically have 3
> options, the last one being, obviously, the easiest:
> 1) buy more memory. If on windows, you can't get more than 2Gb of memory
> for IDL, unless you play with the /3gb option on windows AND that you
> enable IDL to get access to 3gb... I don't know if it is feasible on IDL 7.
>
> 2) switch to Linux. You will be able to a) access more memory and b)
> access more contiguous memory (bigger arrays, look on ITTVIS website for
> an explanation)
>
> 3) don't create one big array, but an array of pointer, each pointing to
> a single entity (or image). Like that, each entity use a small amount of
> memory and you will be able to store much more entities.
>
>> I’m thinking dose IDL has some type of file that I can write one row
>> each time without read the file first??
>> Thank you very much.
>
> look at openW with the /append keyword.
>
> Jean

Now working,used pointer successful avoiding 100 projections limit.

Thank you very much for helpful discussion.

Rongchang
Re: Can i avoid the loop,help me speed up,thanks [message #61964 is a reply to message #61892] Mon, 11 August 2008 10:20 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
> I use PROFILER to check and show the I/O take most of time,use Chris
> suggestion,I read all the projections(in 3D array) in advance and it
> speed up a lot,but use 3D array I can just read 100 projections,if
> more it complain� % Array has too many elements.� ??? how to avoid
> this.

You don't have enough memory available. Use "memtest.pro" from ITTVIS to
figure out the largest array you can make. So you basically have 3
options, the last one being, obviously, the easiest:
1) buy more memory. If on windows, you can't get more than 2Gb of memory
for IDL, unless you play with the /3gb option on windows AND that you
enable IDL to get access to 3gb... I don't know if it is feasible on IDL 7.

2) switch to Linux. You will be able to a) access more memory and b)
access more contiguous memory (bigger arrays, look on ITTVIS website for
an explanation)

3) don't create one big array, but an array of pointer, each pointing to
a single entity (or image). Like that, each entity use a small amount of
memory and you will be able to store much more entities.


> I�m thinking dose IDL has some type of file that I can write one row
> each time without read the file first??
> Thank you very much.

look at openW with the /append keyword.

Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: neural networks
Next Topic: Re: RESOLVE_ALL problem

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

Current Time: Wed Oct 08 15:36:17 PDT 2025

Total time taken to generate the page: 0.00528 seconds