def main(InputFile, ContrastName, Interleave, TR, Regressor, RunMC=""):
    print "RunFillPipelineOnFile_SC.py"

    print "RunMC:\t{}".format(RunMC)
    print 'RunMC=="first":\t{}'.format(RunMC == "first")
    print 'RunMC=="last":\t{}'.format(RunMC == "last")
    print 'RunMC=="none":\t{}'.format(RunMC == "none")

    if RunMC == "first":
        print "Running MC first"
        InputFile = RMC.main(InputFile)

    print InputFile

    STCFiles, Methods = STC.main(InputFile, TR, Interleave)

    for stcfile, meth in zip(STCFiles, Methods):

        if RunMC == "last":
            MCstcfile = RMC.main(stcfile)
        else:
            MCstcfile = stcfile

        print MCstcfile
        GLM.main(MCstcfile, meth, Regressor, ContrastName, TR, Interleave)
                            pr.wait()
                            
                            WrkFile=os.path.join(OutputDir,'Smooth_{}'.format(InputID))
                            
                            RegPaths=[os.path.join(InputBase,'Regressors_0.5Hz.txt'),os.path.join(InputBase,'Regressors_20Hz.txt')]
                            
                            for r in RegPaths:
                                cmd='cp {} {}'.format(r,CPdir)
                                print cmd
                                pr=sp.Popen(cmd,shell=True)
                                pr.wait()

                            reg=os.path.join(CPdir,'Regressors_0.5Hz.txt')
                            WrkDir,trash=os.path.split(WrkFile)
                            #main(InputNii,meth,Regressor,con,tr,itl)
                            GLM.main(WrkFile,meth,reg,'1028',float(tr),itl)