Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Optimize! #27

Open
mdhe1248 opened this issue Sep 26, 2016 · 0 comments
Open

Error in Optimize! #27

mdhe1248 opened this issue Sep 26, 2016 · 0 comments

Comments

@mdhe1248
Copy link
Contributor

mdhe1248 commented Sep 26, 2016

Pleae help me to solve this error:

julia> optimize!(ϕs_new, ϕsi, ap, λt, mmisc);
ERROR: Not yet implemented for incommensurate knots
 in compose at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterDeformation.jl:296
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:85
 in _penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:134
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:112
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:123
 in eval_grad_f at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:548
 in anonymous at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:520
 in gnorm at /home/donghoon/.julia/v0.4/Optim/src/interior.jl:400
 in interior at /home/donghoon/.julia/v0.4/Optim/src/interior.jl:330
 in optimize! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:526

Below is more detailed explanation:
I was trying to optimize a deformation matrix ϕs_new.

julia> optimize!(ϕs_new, ϕs, ap, λt, mmis)
ERROR: MethodError: `maxshift` has no method matching maxshift(::Float32)
 in optimize! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:522

Here, maxshift requires a type like this: CachedInterpolations.CachedInterpolation{RegisterCore.NumDenom{Float32},3,7,(5,5,3)}
The type of mmis was Array{Float32,8}.
Therefore, Tim converted mmis.

using Base.tail
ND = NumDenom{eltype(mmis)}
mmisr = reinterpret(ND, mmis, tail(size(mmis)));
N = ndims(ap)
mmisc = cachedinterpolators(mmisr, N, ntuple(d->(size(mmisr,d)+1)>>1, N));

There were still errors:

julia> optimize!(ϕs_new, ϕs, ap, λt, mmisc)
ERROR: MethodError: `compose` has no method matching compose(::RegisterDeformation.GridDeformation{Float32,3,Array{FixedSizeArrays.Vec{3,Float32},3},LinSpace{Float64}}, ::RegisterDeformation.GridDeformation{Float32,3,Array{FixedSizeArrays.Vec{3,Float32},3},LinSpace{Float64}})
Closest candidates are:
  compose{T1,T2,N,A<:Interpolations.AbstractInterpolation{T,N,IT<:Union{Interpolations.InterpolationType,Tuple{Vararg{Interpolations.InterpolationType}}},GT<:Union{Interpolations.GridType,Interpolations.NoInterp,Tuple{Vararg{Union{Interpolations.GridType,Interpolations.NoInterp}}}}}}(::RegisterDeformation.GridDeformation{T1,N,A<:Interpolations.AbstractInterpolation{T,N,IT<:Union{Interpolations.InterpolationType,Tuple{Vararg{Interpolations.InterpolationType}}},GT<:Union{Interpolations.GridType,Interpolations.NoInterp,Tuple{Vararg{Union{Interpolations.GridType,Interpolations.NoInterp}}}}},L}, ::RegisterDeformation.GridDeformation{T2,N,A<:AbstractArray{T,N},L})
  compose{T,N}(::Function, ::RegisterDeformation.GridDeformation{T,N,A<:AbstractArray{T,N},L})
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:85
 in _penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:134
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:112
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:123
 in eval_grad_f at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:548
 in anonymous at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:520
 in gnorm at /home/donghoon/.julia/v0.4/Optim/src/interior.jl:400
 in interior at /home/donghoon/.julia/v0.4/Optim/src/interior.jl:330
 in optimize! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:526

It was something related to interpolation:

julia> ϕsi = map(RegisterDeformation.interpolate, ϕs);

Still, all error have not been disappeared.

julia> optimize!(ϕs_new, ϕsi, ap, λt, mmisc);
ERROR: Not yet implemented for incommensurate knots
 in compose at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterDeformation.jl:296
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:85
 in _penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:134
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:112
 in penalty! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterPenalty.jl:123
 in eval_grad_f at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:548
 in anonymous at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:520
 in gnorm at /home/donghoon/.julia/v0.4/Optim/src/interior.jl:400
 in interior at /home/donghoon/.julia/v0.4/Optim/src/interior.jl:330
 in optimize! at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant