def buildPipeline(self):
        for subj in self.subjects:
            s = self.subjects[subj]
            count = len(s)
            """Wherever iterative model building was run, the indiv --> nlin xfm is stored
               in the group with the name "final". We need to use this group for to get the
               transform and do the stats calculation, and then reset to the current group.
               Calculate stats first from average to timepoint included in average"""

            if self.timePoint == -1:
                # This means that we used the last file for each of the subjects
                # to create the common average. This will be a variable time 
                # point, so we have to determine it for each of the input files
                timePointToUse = len(s) - 1
            else:
                timePointToUse = self.timePoint

            currGroup = s[timePointToUse].currentGroupIndex
            index = s[timePointToUse].getGroupIndex("final")
            xfmToNlin = s[timePointToUse].getLastXfm(self.nlinFH, groupIndex=index)
            
            if xfmToNlin:
                self.xfmToCommon = [xfmToNlin]
            else:
                self.xfmToCommon = []
            if self.nlinFH:
                s[timePointToUse].currentGroupIndex = index
                self.statsCalculation(s[timePointToUse], self.nlinFH, xfm=None, useChainStats=False)
                s[timePointToUse].currentGroupIndex = currGroup
            """Next: If timepoint included in average is NOT final timepoint, 
               also calculate i to i+1 stats."""
            if count - timePointToUse > 1:
                self.statsCalculation(s[timePointToUse], s[timePointToUse+1], xfm=xfmToNlin, useChainStats=True)
            if not 1 - timePointToUse < 0:
                """ Average happened at time point other than first time point. 
                    Loop over points prior to average."""
                for i in reversed(range(timePointToUse)): 
                    self.statsAndConcat(s, i, count, beforeAvg=True)
                         
            # Loop over points after average. If average is at first time point, this loop
            # will hit all time points (other than first). If average is at subsequent time 
            # point, it hits all time points not covered previously. 
            #
            # xfmToCommon (possibly) needs to be reset: if the average time point is not the first time point
            # then the array xfmToCommon now contains a list of transformations from the first time point to the
            # average. For instance if the average time point is time point 3, then xfmToCommon now contains:
            # [ time_0_to_time_1.xfm, time_1_to_time_2.xfm, time_2_to_average_at_time_point2.xfm ]
            if xfmToNlin:
                self.xfmToCommon = [xfmToNlin]
            else:
                self.xfmToCommon = []  
            for i in range(timePointToUse + 1, count):
                self.statsAndConcat(s, i, count, beforeAvg=False)
dataset/ETHPy150Open Mouse-Imaging-Centre/pydpiper/atoms_and_modules/minc_modules.py/LongitudinalStatsConcatAndResample.buildPipeline/swapped operands of `-`