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

Question: multiple warping?/ optimization of deformation? #23

Open
mdhe1248 opened this issue Sep 25, 2016 · 2 comments
Open

Question: multiple warping?/ optimization of deformation? #23

mdhe1248 opened this issue Sep 25, 2016 · 2 comments

Comments

@mdhe1248
Copy link
Contributor

mdhe1248 commented Sep 25, 2016

Hi Tim and Cody,
I am wondering how I can perform "two-step" registration. I first want to register images with a coarse grid size. Then, I want to use a high grid size for the second registartion. My strategy was to re-register warped images. Tim mentioned that we don't have to register images twice. There are something about optimization and initial guess. If I understood correctly, the deformations from the first registration can be used as an initial guess in the second registration.

After registration, I examined mon.

julia> mon[1]
Dict{Symbol,Any} with 1 entry:
  :u => 3x3x2 SharedArray{FixedSizeArrays.Vec{3,Float64},3}:

I also obtained ϕs using griddeformations

u = load(fileout, "u")
ϕs = griddeformations(u, knots)

ϕs are deformations. How can I use the ϕs as an initial guess?

@timholy
Copy link
Member

timholy commented Sep 25, 2016

It's possible you'll need to make a couple of code tweaks in various places, but the hard work is already done. See, for example, https://github.com/HolyLab/BlockRegistration/blob/a328e76cf2a313caf68231ec387a1838f54b2a17/src/RegisterOptimize.jl#L509-L515.

@mdhe1248
Copy link
Contributor Author

The line says,
ϕs, penalty = optimize!(ϕs, ϕs_old, dp, λt, mmis; kwargs...)
I guess I should decide λt by myself. Some experiment may be necessary. ϕs may be an empty array. ϕs_old can be obtained using u and griddeformations function. How could I obtain mmis and dp when my algorithm is RegisterWorkerApertures?

I obtained mismatch by adding :mismatch argument in monitor:

mon = monitor(algorithm, (), Dict{Symbol,Any}(:u=>ArrayDecl(Array{Vec{3,Float64},3}, gridsize), :mismatch => 0))

After registration, I got mismatch.

julia> mon[1]
Dict{Symbol,Any} with 2 entries:
  :u        => 3x3x2 SharedArray{FixedSizeArrays.Vec{3,Float64},3}:
  :mismatch => 770315.6484996271

Can I use :mismatch as mmis in optimize! function?

Next, I tried to get dp:

mon = monitor(algorithm, (), Dict{Symbol,Any}(:u=>0, :datapenalty=>0))

After driver, the results do not seem promising:

julia> mon[1]
Dict{Symbol,Any} with 2 entries:
  :u           => 3x3x2 Array{FixedSizeArrays.Vec{3,Float64},3}:
  :datapenalty => 0

I don't get datapenaly. It seems that datapenalty can be obtained when λ has a range.
https://github.com/HolyLab/BlockRegistrationScheduler/blob/master/src/RegisterWorkerApertures.jl#L180-L190
I tried a range of λ and got this error:

ERROR: On worker 2:
Too few data points for sigmoidal fit
 in fit_sigmoid at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:994
 in auto_λ at /home/donghoon/.julia/v0.4/BlockRegistration/src/RegisterOptimize.jl:774
 in worker at /home/donghoon/.julia/v0.4/BlockRegistrationScheduler/src/RegisterWorkerApertures.jl:183
 in worker at /home/donghoon/.julia/v0.4/BlockRegistrationScheduler/src/RegisterWorkerShell.jl:148
 in anonymous at multi.jl:913
 in run_work_thunk at multi.jl:651
 [inlined code] from multi.jl:913
 in anonymous at task.jl:63
 in remotecall_fetch at multi.jl:737
 [inlined code] from /home/donghoon/.julia/v0.4/BlockRegistrationScheduler/src/RegisterDriver.jl:85
 in anonymous at task.jl:447

...and 3 other exceptions.

Then again, how could I obtain mmis and dp when my algorithm is RegisterWorkerApertures? Is there easier ways, where I don't need these variables?

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

2 participants