Esempio n. 1
0
def main2():
    funcSpecs = {'Orient': '', 'Dimensions': '', 'Thickness': 0, 'Reps': 0, 'TR': 0, 'Origin': 0, 'Slices': 0}
    subjDict = {'sub{:003d}'.format(s): {'Run{:d}'.format(i): dict(funcSpecs) for i in [4]} for s in [15]}
    #-------------------#
    #    Ready, Begin   #
    #-------------------#
    subj = 'sub015'
    scan = 'Run4'
    print '\n', subj, scan

    #---------------------------------#
    #       Directory Pointers        #
    #---------------------------------#
    ICEWORD = '/Volumes/Data/IcewordNEW'
    FUNC = os.path.join(ICEWORD, subj, 'Func')
    RD = os.path.join(FUNC, scan, 'RealignDetails')

    #---------------------------------#
    #       Functional Images         #
    #---------------------------------#
    img = '-'.join([subj, scan.lower() + '.nii.gz'])
    imgFile = os.path.join(FUNC, scan, img)

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing getFuncSpec():
    #  ++
    #       This will extract the specs of the imageFIle and update
    #       the subjDict to reflect the information extracted.
    #       Supplied variables are the image file in question, the
    #       subject Dictionary, and the reference to subj and scan,
    #       this is done as a control check to make sure the program is
    #       outputting the correct information.
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    print '\n\tpopulating header'
    getFuncSpec(imgFile, subjDict[subj][scan])

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing volumeTrim():
    #  ++
    #       This will trim the first X volumes from the image. If the
    #       image has 214 TRs, then only 1 volume is removed, otherwise
    #       5 volumes will be removed.
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if subjDict[subj][scan]['Reps'] == '214':
        trim = '1'
    else:
        trim = '5'

    imgFile = volumeTrim(imgFile, trim)
    getFuncSpec(imgFile, subjDict[subj][scan])

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing writeReport():
    #  ++
    #       sub4dImg -- input file
    #       subStatsImg -- output file name
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    writeReport(subjDict)
Esempio n. 2
0
def main2():
    funcSpecs = {
        'Orient': '',
        'Dimensions': '',
        'Thickness': 0,
        'Reps': 0,
        'TR': 0,
        'Origin': 0,
        'Slices': 0
    }
    subjDict = {
        'sub{:003d}'.format(s):
        {'Run{:d}'.format(i): dict(funcSpecs)
         for i in [4]}
        for s in [15]
    }
    #-------------------#
    #    Ready, Begin   #
    #-------------------#
    subj = 'sub015'
    scan = 'Run4'
    print '\n', subj, scan

    #---------------------------------#
    #       Directory Pointers        #
    #---------------------------------#
    ICEWORD = '/Volumes/Data/IcewordNEW'
    FUNC = os.path.join(ICEWORD, subj, 'Func')
    RD = os.path.join(FUNC, scan, 'RealignDetails')

    #---------------------------------#
    #       Functional Images         #
    #---------------------------------#
    img = '-'.join([subj, scan.lower() + '.nii.gz'])
    imgFile = os.path.join(FUNC, scan, img)

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing getFuncSpec():
    #  ++
    #       This will extract the specs of the imageFIle and update
    #       the subjDict to reflect the information extracted.
    #       Supplied variables are the image file in question, the
    #       subject Dictionary, and the reference to subj and scan,
    #       this is done as a control check to make sure the program is
    #       outputting the correct information.
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    print '\n\tpopulating header'
    getFuncSpec(imgFile, subjDict[subj][scan])

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing volumeTrim():
    #  ++
    #       This will trim the first X volumes from the image. If the
    #       image has 214 TRs, then only 1 volume is removed, otherwise
    #       5 volumes will be removed.
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    if subjDict[subj][scan]['Reps'] == '214':
        trim = '1'
    else:
        trim = '5'

    imgFile = volumeTrim(imgFile, trim)
    getFuncSpec(imgFile, subjDict[subj][scan])

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing writeReport():
    #  ++
    #       sub4dImg -- input file
    #       subStatsImg -- output file name
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    writeReport(subjDict)
Esempio n. 3
0
def main():
    funcSpecs = {'Orient': '', 'Dimensions': '', 'Thickness': 0, 'Reps': 0, 'TR': 0, 'Origin': 0, 'Slices': 0}
    subjDict = {'sub{:003d}'.format(s): {'Run{:d}'.format(i): dict(funcSpecs) for i in [1, 2, 3, 4]} for s in range(1, 20)}
    #-------------------#
    #    Ready, Begin   #
    #-------------------#
    for subscan in [(sub, scan) for sub in subjDict.keys() for scan in subjDict[sub].keys()]:
        subj, scan = subscan
        print '\n', subj, scan

        #---------------------------------#
        #       Directory Pointers        #
        #---------------------------------#
        ICEWORD = '/Volumes/Data/IcewordNEW'
        FUNC = os.path.join(ICEWORD, subj, 'Func')
        RD = os.path.join(FUNC, scan, 'RealignDetails')

        #---------------------------------#
        #       Functional Images         #
        #---------------------------------#
        img = '_'.join([subj, scan.lower(), 'RAW.nii'])
        imgFile = os.path.join(FUNC, scan, img)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing getFuncSpec():
        #  ++
        #       This will extract the specs of the imageFIle and update
        #       the subjDict to reflect the information extracted.
        #       Supplied variables are the image file in question, the
        #       subject Dictionary, and the reference to subj and scan,
        #       this is done as a control check to make sure the program is
        #       outputting the correct information.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        print '\n\tpopulating header'
        getFuncSpec(imgFile, subjDict[subj][scan])

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing makeImageCorrections():
        #  ++
        #       This will make corrections to each of the images via resample.
        #       It returns a pointer to the new image file created.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        print '\n\tmaking Image corrections'
        imgFile = makeImageCorrections(imgFile)
        getFuncSpec(imgFile, subjDict[subj][scan])

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing volumeTrim():
        #  ++
        #       This will trim the first X volumes from the image. If the
        #       image has 214 TRs, then only 1 volume is removed, otherwise
        #       5 volumes will be removed.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        if subjDict[subj][scan]['Reps'] == '214':
            trim = '1'
        else:
            trim = '5'

        imgFile = volumeTrim(imgFile, trim)
        getFuncSpec(imgFile, subjDict[subj][scan])

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing sliceTiming():
        #  ++
        #       This will trim the first X volumes from the image. If the
        #       image has 214 TRs, then only 1 volume is removed, otherwise
        #       5 volumes will be removed.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        imgFile = sliceTiming(imgFile)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing volumeReg():
        #  ++
        #       After a base volume is identified, volumeReg is performed.
        #       It will correct for motion related errors.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        base = baseVolume(imgFile)
        imgFile = volumeReg(imgFile, base)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing despikeVolume():
        #  ++
        #       After a base volume is identified, volumeReg is performed.
        #       It will correct for motion related errors.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        imgFile = despikeVolume(imgFile)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing smoothVolume():
        #  ++
        #       After a base volume is identified, volumeReg is performed.
        #       It will correct for motion related errors.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        imgFile = smoothVolume(imgFile)
        getFuncSpec(imgFile, subjDict[subj][scan])

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing writeReport():
    #  ++
    #       sub4dImg -- input file
    #       subStatsImg -- output file name
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    writeReport(subjDict)
Esempio n. 4
0
def main():
    funcSpecs = {
        'Orient': '',
        'Dimensions': '',
        'Thickness': 0,
        'Reps': 0,
        'TR': 0,
        'Origin': 0,
        'Slices': 0
    }
    subjDict = {
        'sub{:003d}'.format(s):
        {'Run{:d}'.format(i): dict(funcSpecs)
         for i in [1, 2, 3, 4]}
        for s in range(1, 20)
    }
    #-------------------#
    #    Ready, Begin   #
    #-------------------#
    for subscan in [(sub, scan) for sub in subjDict.keys()
                    for scan in subjDict[sub].keys()]:
        subj, scan = subscan
        print '\n', subj, scan

        #---------------------------------#
        #       Directory Pointers        #
        #---------------------------------#
        ICEWORD = '/Volumes/Data/IcewordNEW'
        FUNC = os.path.join(ICEWORD, subj, 'Func')
        RD = os.path.join(FUNC, scan, 'RealignDetails')

        #---------------------------------#
        #       Functional Images         #
        #---------------------------------#
        img = '_'.join([subj, scan.lower(), 'RAW.nii'])
        imgFile = os.path.join(FUNC, scan, img)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing getFuncSpec():
        #  ++
        #       This will extract the specs of the imageFIle and update
        #       the subjDict to reflect the information extracted.
        #       Supplied variables are the image file in question, the
        #       subject Dictionary, and the reference to subj and scan,
        #       this is done as a control check to make sure the program is
        #       outputting the correct information.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        print '\n\tpopulating header'
        getFuncSpec(imgFile, subjDict[subj][scan])

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing makeImageCorrections():
        #  ++
        #       This will make corrections to each of the images via resample.
        #       It returns a pointer to the new image file created.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        print '\n\tmaking Image corrections'
        imgFile = makeImageCorrections(imgFile)
        getFuncSpec(imgFile, subjDict[subj][scan])

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing volumeTrim():
        #  ++
        #       This will trim the first X volumes from the image. If the
        #       image has 214 TRs, then only 1 volume is removed, otherwise
        #       5 volumes will be removed.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        if subjDict[subj][scan]['Reps'] == '214':
            trim = '1'
        else:
            trim = '5'

        imgFile = volumeTrim(imgFile, trim)
        getFuncSpec(imgFile, subjDict[subj][scan])

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing sliceTiming():
        #  ++
        #       This will trim the first X volumes from the image. If the
        #       image has 214 TRs, then only 1 volume is removed, otherwise
        #       5 volumes will be removed.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        imgFile = sliceTiming(imgFile)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing volumeReg():
        #  ++
        #       After a base volume is identified, volumeReg is performed.
        #       It will correct for motion related errors.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        base = baseVolume(imgFile)
        imgFile = volumeReg(imgFile, base)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing despikeVolume():
        #  ++
        #       After a base volume is identified, volumeReg is performed.
        #       It will correct for motion related errors.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        imgFile = despikeVolume(imgFile)

        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        # Executing smoothVolume():
        #  ++
        #       After a base volume is identified, volumeReg is performed.
        #       It will correct for motion related errors.
        #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        imgFile = smoothVolume(imgFile)
        getFuncSpec(imgFile, subjDict[subj][scan])

    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    # Executing writeReport():
    #  ++
    #       sub4dImg -- input file
    #       subStatsImg -- output file name
    #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    writeReport(subjDict)