I'm afraid that I can't replicate your problems here.
The showcost schedule gives me the same values as running
the registration in verbose mode.
Can you put the images somewhere for me so that I can check
if it has something to do with them?
As for the absolute cost function value - there are several
practical issues of constructing histograms, smoothing images,
correcting for voxels at the edge of the field of view, etc
which probably change the values slightly. All that is important
for the registration to work is that the cost is monotonic in
measuring good/bad transformations. These practical additions
are important for getting things to work well, and they are
probably why the values are not the perfect theoretical values.
All the best,
On 16 Dec 2004, at 11:35, Martin Kavec wrote:
> Hi Mark,
> I have tested the approach you suggested. However,
> I am puzzeled with numbers I get. I want to get the value of
> normalized mutual
> information so I use "-cost normmi" option. I am not setting dof and
> bins since
> it doesn't seem to affect the result.
> 1. If I set both input and reference images to the same highres volume
> "-init unity.mat" (1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1), I would assume
> that the
> cost function should be maximal, i.e. =2 and, I guess, in FSL =-2.
> However for
> different input/reference image I am getting different numbers:
> -1.786447 0.0 -0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 0.0 0.0 0.0
> 2. I would also assume that if I run flirt on the same input images in
> registration mode and with "-schedule showcost", the cost function
> value should
> be same. Provided the number after the iteration step XXX is a cost
> function value,
> XXX : -1.1338 :: 0.852393 0.00369968 0.0853298 62.6364 69.734 -21.1884
> the very last iteration and "-schedule showcost" don't give me the
> same numbers.
> Could you please shed some light on what am I missing? Thanks a lot.
> Quoting Mark Jenkinson <[log in to unmask]>:
>> Hi Martin,
>> I hadn't forgotten your email, I just needed time to make a schedule
>> file to do what you wanted.
>> There are three things you need in the schedule file:
>> measurecost (which you had) , printparams and setscale commands
>> Flirt (at present) requires all the scales to be stepped through
>> sequentially in order to generate the appropriate reference and input
>> images internally. Hence you need setscale for 8 then 4 then 2 then
>> I'm attaching my schedule file (showcost) which printed the correct
>> function measurement for me. You need to use it in registration
>> mode, rather than applyxfm mode. For example:
>> flirt -in epi -ref highres -schedule showcost -init epi2out.mat
>> where epi2out.mat is the previously generated registration matrix,
>> and -omat /dev/null is just used to junk the printing out of the final
>> matrix (which of course is just the same as the -init in this case).
>> Let me know if you have any trouble with this.
>> All the best,