Dear community.
This is following up on an earlier question of me (here). I opened this thread, because my current question no longer fits the original one.
My problem is that I need to loop through a stack of a few hundred slices. I would like to store the AffineMap generated by RegisterQD.jl in such a way that I can address the according map with an index related to the image of the stack in a later part of my script. So I am basically looking for some kind of Array/Matrix/Collection-variable that holds my AffineMaps.
However, I am having trouble creating or using said array. I can create it, but cannot assign values to it.
julia> using CoordinateTransformations #necessary to get the AffineMap type in this sample
julia> tfm=AffineMap([0 0;0 0],[0,0]) #the values do not matter, it does not even work with others
AffineMap([0 0; 0 0], [0, 0])
julia> tfmarr=Array{AffineMap,1}
Array{AffineMap,1}
julia> tfmarr[1]=tfm #trying to assign a value to the array
ERROR: MethodError: no method matching setindex!(::Type{Array{AffineMap,1}}, ::AffineMap{Array{Int64,2},Array{Int64,1}}, ::Int64)
Stacktrace:
[1] top-level scope at none:0
I usually generate arrays using the zeros()
command. But this fails for AffineMaps:
julia> tfmarr=zeros(AffineMap,1500)
ERROR: MethodError: no method matching zero(::Type{AffineMap})
Closest candidates are:
zero(::Type{LibGit2.GitHash}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/LibGit2/src/oid.jl:220
zero(::Type{Pkg.Resolve.VersionWeights.VersionWeight}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/resolve/VersionWeights.jl:19
zero(::Type{Pkg.Resolve.MaxSum.FieldValues.FieldValue}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/resolve/FieldValues.jl:44
...
Stacktrace:
[1] zeros(::Type{AffineMap}, ::Tuple{Int64}) at ./array.jl:467
[2] zeros(::Type{AffineMap}, ::Int64) at ./array.jl:464
[3] top-level scope at none:0
Where am I going wrong? Are arrays just not a way to store AffineMaps? If this is the case, how do I store them properly for later use in the script (and possible saving)?