Hi,
> I have a case where I want to explicitly compare the pre- and post-BBR cost values. Would the adaptation of the standard bbr.sch (bbrinit.sch, below) get me the initial cost?
>
> I include an example log file. It's not clear to me why there is any change at all from the initial matrix, as the optimization instructions were removed. I also want to verify that the first entry in the printed line is the cost. (The rest appears to be (out_mat * inv(init_mat)), in column order.)
The gridmeasurecost is a form of optimisation, so to avoid any optimisation then replace these lines:
measurecost 6 UU:1-2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
gridmeasurecost 6 UU:1-2 -0.07 0.07 0.07 -0.07 0.07 0.07 -0.07 0.07 0.07 -4.0 4.0 4.0 -4.0 4.0 4.0 -4.0 4.0 4.0 0.0 0.0 0.0 abs 8
with this:
measurecost 6 UU:1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
(note the change from UU:1-2 to UU:1)
Also, delete the line:
setrowqsform UU
As this adds a modification of the initial matrix.
I can also confirm that the first value is the cost function value and that the rest are the 12 parameters of the affine matrix.
All the best,
Mark
> Thanks,
> Chris
>
> --------------
> bbrinit.sch
> --------------
>
> # 1mm scale
> setscale 1 force
> setoption costfunction bbr
> setoption optimisationtype brent
> setoption tolerance 0.0005 0.0005 0.0005 0.02 0.02 0.02 0.002 0.002 0.002 0.001 0.001 0.001
> setoption boundguess 1
> setoption bbrstep 200
> clear UA
> clear UU
> clear UV
> clear U
> setrowqsform UU
> setrow UU 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
> measurecost 6 UU:1-2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
> gridmeasurecost 6 UU:1-2 -0.07 0.07 0.07 -0.07 0.07 0.07 -0.07 0.07 0.07 -4.0 4.0 4.0 -4.0 4.0 4.0 -4.0 4.0 4.0 0.0 0.0 0.0 abs 8
> sort U
> # Optimization removed up to the final "sort U" call
> print U:1
>
> ---------------------
> Example output
> ---------------------
>
> The output image will use the sform from the reference image
> The output image will use the transformed sform from the input image
> Init Matrix =
> -0.999709 0.023971 -0.002755 213.594883
> -0.023976 -0.999711 0.001729 214.232119
> -0.002713 0.001794 0.999995 45.523607
> 0.000000 0.000000 0.000000 1.000000
>
>>> # 1mm scale
>>> setscale 1 force
>>> setoption costfunction bbr
>>> setoption optimisationtype brent
>>> setoption tolerance 0.0005 0.0005 0.0005 0.02 0.02 0.02 0.002 0.002 0.002 0.001 0.001 0.001
>>> setoption boundguess 1
>>> setoption bbrstep 200
>>> clear UA
>>> clear UU
>>> clear UV
>>> clear U
>>> setrowqsform UU
>>> setrow UU 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
>>> measurecost 6 UU:1-2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 rel 8
>>> gridmeasurecost 6 UU:1-2 -0.07 0.07 0.07 -0.07 0.07 0.07 -0.07 0.07 0.07 -4.0 4.0 4.0 -4.0 4.0 4.0 -4.0 4.0 4.0 0.0 0.0 0.0 abs 8
>>> sort U
>>> print U:1
> 1.051098 0.995108 0.074652 -0.064709 0.000000 -0.069772 0.994766 0.074652 0.000000 0.069943 -0.069772 0.995108 0.000000 7.439822 2.278273 2.165399 1.000000
>>>
>>>
>
> Final result:
> -0.993335 0.093731 0.067080 208.226551
> -0.098291 -0.992814 -0.068257 228.158019
> 0.060200 -0.074396 0.995410 49.637629
> 0.000000 0.000000 0.000000 1.000000
>
> --
> Chris Markiewicz
> Center for Reproducible Neuroscience
> Stanford University
|