A bug? Unexpected results of the physiology noise correction:-S

Hi afni experts,
I do physiology noise correction to my EPI data recently. Physiology data of each epi run was picked out from the .resp and .puls files. If the EPI run with TR of 2 seconds has 120 TR and the physiology data has the sample rate of 50, 212050 time points from the start MDH Time of this run will be picked out. Then the 212050 points were saved as text files and then inputted to RetroTS.m to generate regressors.
But I found the t value between two experimental conditions became smaller after removing physiology noise. So I would like to know what RetroTS.m have done to generate the regressors and I open the function RetroTS.m. Then I found a problem at my first glance:

if (isfield(Opt,'SliceOrder'))
         for (i=1:2:Opt.Nslices),
            Opt.SliceOffset(i) = tt; tt = tt+dtt;
         for (i=2:2:Opt.Nslices),
            Opt.SliceOffset(i) = tt; tt = tt+dtt;
         for (i=Opt.Nslices:-2:1),
            Opt.SliceOffset(i) = tt; tt = tt+dtt;
         for (i=Opt.Nslices-1:-2:1),
            Opt.SliceOffset(i) = tt; tt = tt+dtt;
          % timing already set in Opt.SliceOffset, do nothing

If the options of the RetroTS are set like this:

Opt.SliceOffset = SliceOffset;
    Opt.SliceOrder = 'Custom';

Opt.SliceOffset will become all zeros no matter what offset value you input.I am not sure it is a bug or deliberate setting.If it is a bug, there may be more bugs in this function because it was truly found at my first glance.
Do you think there is something wrong with my processing procedures or with the function RetroTS.m mentioned above?
Thank you in advance!

Hi Jogi Ho,

It certainly looks incorrect in that case. That zeros()
call looks like it was inserted later, since it is a
duplicate from a few lines above. Following the logic of
the first call is harder, as it depends on the rest of
the program. Maybe the second one is not even needed.

But a simple fix might be to put that zeros() call within
an ‘if(~strcmpi(Opt.SliceOrder,‘Custom’))’ test. If you
want to test that out to be positive, please let me know
how it goes.

I am making that change in the python version, RetroTS.py,
with the new code, in case that is helpful:

if main_info['slice_order'] != 'Custom' or \
      len(main_info['slice_offset']) != main_info['number_of_slices']:
   main_info['slice_offset'] = [0] * main_info['number_of_slices']

But I would rather not make a corresponding change in
the Matlab version without trying it out. Let me know
if you want to contribute a change to that.


  • rick