Filter löschen
Filter löschen

which function is running while we have handle function?

2 Ansichten (letzte 30 Tage)
Neda
Neda am 8 Feb. 2018
Beantwortet: Steven Lord am 8 Feb. 2018
I'm wondering on the below code which function is running? I am new in matlab. I read the handle function, but still confuse to understand this? is bspline_registration_image is performing or lsqnonlin? or both? appreciate any comment.
% Start the b-spline nonrigid registration optimizer
O_trans = lsqnonlin(@(x)bspline_registration_image(x,sizes,Spacing,I1s,I2s,type),O_trans,[],[],optim);

Akzeptierte Antwort

Steven Lord
Steven Lord am 8 Feb. 2018
You called lsqnonlin. One or more times while lsqnonlin is running, it calls the function handle with some input arguments it has computed. Calling that function handle calls bspline_registration_image with the input lsqnonlin computed as well as the inputs sizes, Spacing, I1s, I2s, and type you specified when you constructed the function handle.
Think of a function handle as a way to refer to a function that doesn't require hard-coding the name of the function. Using function handles gives you the flexibility to call lsqnonlin and have it call bspline_registration_image one time and Neda_custom_registration_image the next, without requiring any changes to lsqnonlin itself.

Weitere Antworten (0)

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by