Exemplo n.º 1
0
def qc_series(data, results, action):
    """
    QCMR_UMCU Checks: Philips fBIRN analysis reimplemented in python
      Weisskoff analysis
      Ghosting
      Residual Noise
      Temporal Fluctuation
      Spatial Noise

    Workflow:
        1. Read image or sequence
        2. Run test
        3. Build results output
    """
    try:
        params = action['params']
    except KeyError:
        params = {}

    ## 1. read images
    dcmInfile,pixeldataIn,dicomMode = wadwrapper_lib.prepareInput(data.series_filelist[0], 
                                                                  headers_only=False, logTag=logTag(), 
                                                                  skip_check=True, splitOnPosition=False)

    qclib = qc_lib.fBIRN_QC()
    cs = qc_lib.fBIRN_Struct(dcmInfile=dcmInfile, pixeldataIn=pixeldataIn, dicomMode=dicomMode)
    cs.verbose = True # output lot's of comments

    ## 2. Run tests
    reportkeyvals = []
    error, namevals = qclib.QC(cs)
    if not error:
        for typ, name, val in namevals:
            reportkeyvals.append( (typ, name, val) )

    if error:
        raise ValueError("{} ERROR! processing error in QC".format(logTag()))

    for typ, name, val in reportkeyvals:
        if typ == 'float':
            results.addFloat(name, val)
        elif typ == 'string':
            results.addString(name, val)
        elif typ == 'object':
            results.addObject(name, val)
Exemplo n.º 2
0
def snr_series(data, results, action):
    """
    QCMR_UMCU Checks:
      B0 mapping test

    Workflow:
        1. Read image or sequence
        2. Run test
        3. Build results output
    """
    try:
        params = action['params']
    except KeyError:
        params = {}

    ## 1. read images
    dcmInfile,pixeldataIn,dicomMode = wadwrapper_lib.prepareInput(data.series_filelist[0], 
                                                                  headers_only=False, logTag=logTag(), 
                                                                  skip_check=True, splitOnPosition=False)

    qclib = qc_lib.fBIRN_QC()
    cs = qc_lib.fBIRN_Struct(dcmInfile=dcmInfile, pixeldataIn=pixeldataIn, dicomMode=dicomMode)
    cs.verbose = True # output lot's of comments
    if 'circleradiusfactor' in params:
        qclib.usePartCircle = float(params['circleradiusfactor'])

    ## 2. Run tests
    reportkeyvals = []
    error, namevals = qclib.PureSNR(cs)
    if not error:
        for typ, name, val in namevals:
            reportkeyvals.append( (typ, name, val) )

    if error:
        raise ValueError("{} ERROR! processing error in PureSNR".format(logTag()))

    for typ, name, val in reportkeyvals:
        if typ == 'float':
            results.addFloat(name, val)
        elif typ == 'string':
            results.addString(name, val)
        elif typ == 'object':
            results.addObject(name, val)