AffineTransforms.jl icon indicating copy to clipboard operation
AffineTransforms.jl copied to clipboard

Pre-allocating outputs

Open jianghaizhu opened this issue 9 years ago • 2 comments

I am using AffineTransforms.jl in my code a lot. Thanks for this fantastic package.

I am dealing with large 3D arrays and a lot of transforms. I have to put

tfm = AffineTransform(rot, trans)
m = TransformedArray(itp, tfm)
transform!(m1, m)

in a loop.

Since AffineTransform() and TransformedArray() would allocate memory everytime they are called, I end up allocating an enormous amount of memories. Is there a way to pre-allocating the outputs of these functions?

Thanks a lot!

jianghaizhu avatar Sep 30 '16 20:09 jianghaizhu

TransformedArray shouldn't allocate any substantial amount of memory, if you're already created the interpolation object---it's basically a wrapper. AffineTransform will allocate, although it's a fairly small amount of memory.

I suspect that the future is CoordinateTransformations and ImageTransformations, but the latter isn't mature yet.

timholy avatar Oct 25 '16 17:10 timholy

Thanks. I did realize that the large memory allocation is from Interpolations.jl. I checked out CoordinateTransformations, but it doesn't seem to me that it uses interpolations. I am keeping an eye on ImageTransformations.

jianghaizhu avatar Oct 25 '16 20:10 jianghaizhu