The random numbers should be the same ones each time, as the code
calls "rand('state',0);" beforehand. The reason for them is that they
are intended to reduce bias due to interpolation, which introduces a
small amount of smoothing. This means that if an image is shifted by
half a voxel, then it will appear smoother, which may have the effect
of systematically reducing or increasing the cost function.
As Bas points out, the most likely reason is that the realignment
parameters are saved in the headers (or mat file for 4D NIfTI data),
and serve as starting estimates if realignment is run again. If these
headers (or mat files) were reset each time, then the results should
be the same.
Occasionally, on multi-core machines it is possible to obtain very
slightly different results that are dependent on how the operations
are split up among cores. Rounding errors mean that results differ
slightly depending on the order that things are done - particularly
when using single precision arithmetic. For example:
x=randn([10000,1],'single');
sum1 = sum(x);
sum2 = sum(flipud(x));
sum1-sum2
Best regards,
-John
On 17 October 2011 10:41, Marko Wilke <[log in to unmask]> wrote:
> Hi,
>
> I think it may actually be inherent in spm_realign: if you look at lines
> 179ff, it seems that the grid that is initiated for sampling is then
> slightly modified using random numbers. I dimly remember John mentioned
> something about the reason for that on the list or in private years ago, but
> I can't seem to find it. Probably was a good one, though :) So bottomline, I
> believe that the points the images are sampled at are meant to very slightly
> differ from run to run, so it is not suprising the results would, too. In
> any case, differences on the order of magnituded you mentioned (10^-9) would
> not worry me too much.
>
> Cheers,
> Marko
>
> S.F.W. Neggers wrote:
>>
>> perhaps because when you realign already realigned images again,
>> corrections will get smaller every time you do this?
>>
>> Good luck,
>>
>> Bas
>>
>> Op 17-10-11 10:13, Natalia Yakunina schreef:
>>>
>>> Hello everybody
>>>
>>>
>>> I was wondering if it's normal that after I run realignment several
>>> times with EXACTLY the same set of parameters, motion parameters
>>> rp*.txt files come out slightly different EVERY TIME (not all of the
>>> values are different, but some of them are; the difference is of order
>>> 10^-9 but still..). I've run it five times, and all five sets of files
>>> are different from each other.
>>> If this is how it is supposed to be, what's the reason for that? And
>>> how much does this kind of difference affect GLM results?
>>> I am trying to reproduce some old results, and I've stumbled on this
>>> the very first step.
>>> Thank you!
>>>
>>>
>>> Best Regards,
>>> Natalia
>>
>>
>> --
>> --------------------------------------------------
>> Dr. S.F.W. Neggers
>> Division of Brain Research
>> Rudolf Magnus Institute for Neuroscience
>> Utrecht University Medical Center
>>
>> Visiting : Heidelberglaan 100, 3584 CX Utrecht
>> Room B.01.1.03
>> Mail : Huispost B01.206, P.O. Box 85500
>> 3508 GA Utrecht, the Netherlands
>> Tel : +31 (0)88 7559609
>> Fax : +31 (0)88 7555443
>> E-mail :[log in to unmask]
>> Web :http://www.neuromri.nl/people/bas-neggers
>> :http://www.neuralnavigator.com (CEO)
>> --------------------------------------------------
>>
>> ------------------------------------------------------------------------
>>
>> /De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
>> uitsluitend bestemd voor de geadresseerde. Indien u dit bericht
>> onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en de
>> afzender direct te informeren door het bericht te retourneren. Het
>> Universitair Medisch Centrum Utrecht is een publiekrechtelijke
>> rechtspersoon in de zin van de W.H.W. (Wet Hoger Onderwijs en
>> Wetenschappelijk Onderzoek) en staat geregistreerd bij de Kamer van
>> Koophandel voor Midden-Nederland onder nr. 30244197. /
>>
>> /Denk s.v.p aan het milieu voor u deze e-mail afdrukt. /
>>
>> ------------------------------------------------------------------------
>>
>> /This message may contain confidential information and is intended
>> exclusively for the addressee. If you receive this message
>> unintentionally, please do not use the contents but notify the sender
>> immediately by return e-mail. University Medical Center Utrecht is a
>> legal person by public law and is registered at the Chamber of Commerce
>> for Midden-Nederland under no. 30244197. /
>>
>> /Please consider the environment before printing this e-mail. /
>>
>
> --
> ____________________________________________________
> PD Dr. med. Marko Wilke
> Facharzt für Kinder- und Jugendmedizin
> Leiter, Experimentelle Pädiatrische Neurobildgebung
> Universitäts-Kinderklinik
> Abt. III (Neuropädiatrie)
>
>
> Marko Wilke, MD, PhD
> Pediatrician
> Head, Experimental Pediatric Neuroimaging
> University Children's Hospital
> Dept. III (Pediatric Neurology)
>
>
> Hoppe-Seyler-Str. 1
> D - 72076 Tübingen, Germany
> Tel. +49 7071 29-83416
> Fax +49 7071 29-5473
> [log in to unmask]
>
> http://www.medizin.uni-tuebingen.de/kinder/epn
> ____________________________________________________
>
|