AffineTransforms.jl
AffineTransforms.jl copied to clipboard
Pre-allocating outputs
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!
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.
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.