Re: Building Voxel arrays from png files (compression, analysis, and visualization) [message #45202] |
Mon, 22 August 2005 16:43 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Greener writes:
> Thank you for your reply. Just before I viewed this page I printed off
> the page that you linked me to. Hopefully that is a good sign :-)
> I will try both the rebin and congrid functions, I am pretty sure that
> they both use interpolation to calculate the new voxel values. I have
> been trying to figure out how the interpolation within IDL actually
> works (in hopes to reduce the data loss I notice during compression,
> oh, and I am no mathematician either, can anyone say 'fish out of
> water' :-) I have looked for the interpolate function script with no
> success as of yet.
The INTERPOLATE command is an internal command, so you won't find
a script for it. Loss of information is inevitable, of course, if
you change the size of the array. You should try resizing with both
nearest neighbor and bilinear sampling. (Check the keywords to REBIN
and CONGRID.) In our medical images, we usually use bilinear sampling.
It is good enough for our purposes, but you might need something better.
I've heard wavelets are good for this, but I've never used them.
> Thanks again for your advice, I have noticed a fairly significant
> improvement just with the removal of the [*,*,*].
Well, we are headed in the right direction then. That's a good
thing. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Building Voxel arrays from png files (compression, analysis, and visualization) [message #45205 is a reply to message #45202] |
Mon, 22 August 2005 14:22  |
Greener
Messages: 3 Registered: August 2005
|
Junior Member |
|
|
Thank you for your reply. Just before I viewed this page I printed off
the page that you linked me to. Hopefully that is a good sign :-)
I will try both the rebin and congrid functions, I am pretty sure that
they both use interpolation to calculate the new voxel values. I have
been trying to figure out how the interpolation within IDL actually
works (in hopes to reduce the data loss I notice during compression,
oh, and I am no mathematician either, can anyone say 'fish out of
water' :-) I have looked for the interpolate function script with no
success as of yet.
Thanks again for your advice, I have noticed a fairly significant
improvement just with the removal of the [*,*,*].
dave
|
|
|
Re: Building Voxel arrays from png files (compression, analysis, and visualization) [message #45213 is a reply to message #45205] |
Mon, 22 August 2005 12:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Greener writes:
> I have no previous programming experience, prior to this I was a
> biology student with some computing background. I am working on
> speeding up the below script and trying to reduce the amount of data
> lost during compression. Currently I am relying on the IDL
> Interpolation to create a new voxel array from a series of
> 2-dimensional images. I am constrained to 1.5 GB of RAM and I am
> using the two for loops in an attempt to reduce the amount of data in
> memory at any one time.
> The program usually takes 4 days or more hours to run a set of 10,000
> images compressed 4x, resulting in a voxel array of dimensions
> [2000,2000,2500]. The images are pictures of small animal organs and
> are being used to image the arterial networks.
> Any suggestions would be greatly appreciated.
Just a couple of suggestions. First, is there any reason why
you are choosing to use INTERPOLATE rather than REBIN or
CONGRID (which, I guess, actually uses INTERPOLATE). CONGRID
just seems more straightforward to me.
Second, on your INTERPOLATE command you are using this kind
of syntax:
> new_img = INTERPOLATE(sub_vol[*,*,*],x_ramp,y_ramp,z_int,/GRID)
In fact, you use the sub_vol[*,*,*] syntax quite a lot. That is
*really* using a lot of memory. Here is an article that explains
why:
http://www.dfanning.com/misc_tips/submemory.html
Perhaps just changing this line to this:
new_img = INTERPOLATE(sub_vol,x_ramp,y_ramp,z_int,/GRID)
will speed things up dramatically.
The experts will probably have other things to say about
your algorithm. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|