pysilcam/process.py
def statextract(imc, settings, timestamp, nnmodel, class_labels):
    '''extracts statistics of particles in imc (raw corrected image)

    Args:
        imc                         : background-corrected image
        timestamp                   : timestamp of image collection
        settings                    : PySilCam settings
        nnmodel                     : loaded tensorflow model from silcam_classify
        class_labels                : lables of particle classes in tensorflow model

    Returns:
        stats                       : (list of particle statistics for every particle, according to Partstats class)
        imbw                        : segmented image
        saturation                  : percentage saturation of image
    '''
    logger.debug('segment')

    # simplyfy processing by squeezing the image dimensions into a 2D array
    # min is used for squeezing to represent the highest attenuation of all wavelengths
    img = np.uint8(np.min(imc, axis=2))

    if settings.Process.real_time_stats:
        imbw = image2blackwhite_fast(img, settings.Process.threshold) # image2blackwhite_fast is less fancy but
    else:
        imbw = image2blackwhite_accurate(img, settings.Process.threshold) # image2blackwhite_fast is less fancy but
    # image2blackwhite_fast is faster than image2blackwhite_accurate but might cause problems when trying to
    # process images with bad lighting

    logger.debug('clean')

    # clean segmented image (small particles and border particles)
    imbw = clean_bw(imbw, settings.Process.minimum_area)

    # fill holes in particles
    imbw = ndi.binary_fill_holes(imbw)

    write_segmented_images(imbw, imc, settings, timestamp)

    logger.debug('measure')
    # calculate particle statistics
    stats, saturation = measure_particles(imbw, imc, settings, timestamp, nnmodel, class_labels)

    return stats, imbw, saturation
extracts statistics of particles in imc (raw corrected image)

    Args:
        imc                         : background-corrected image
        timestamp                   : timestamp of image collection
        settings                    : PySilCam settings
        nnmodel                     : loaded tensorflow model from silcam_classify
        class_labels                : lables of particle classes in tensorflow model

    Returns:
        stats                       : (list of particle statistics for every particle, according to Partstats class)
        imbw                        : segmented image
        saturation                  : percentage saturation of image
    
extracts statistics of particles in imc (raw corrected image)
extracts statistics of particles in imc ( raw corrected image )
def statextract(imc, settings, timestamp, nnmodel, class_labels):
    logger.debug('segment')
    img = np.uint8(np.min(imc, axis=2))
    if settings.Process.real_time_stats:
        imbw = image2blackwhite_fast(img, settings.Process.threshold) 
    else:
        imbw = image2blackwhite_accurate(img, settings.Process.threshold) 
    logger.debug('clean')
    imbw = clean_bw(imbw, settings.Process.minimum_area)
    imbw = ndi.binary_fill_holes(imbw)
    write_segmented_images(imbw, imc, settings, timestamp)
    logger.debug('measure')
    stats, saturation = measure_particles(imbw, imc, settings, timestamp, nnmodel, class_labels)
    return stats, imbw, saturation
def statextract ( imc , settings , timestamp , nnmodel , class_labels ) : logger . debug ( 'segment' ) img = np . uint8 ( np . min ( imc , axis = 2 ) ) if settings . Process . real_time_stats : imbw = image2blackwhite_fast ( img , settings . Process . threshold ) else : imbw = image2blackwhite_accurate ( img , settings . Process . threshold ) logger . debug ( 'clean' ) imbw = clean_bw ( imbw , settings . Process . minimum_area ) imbw = ndi . binary_fill_holes ( imbw ) write_segmented_images ( imbw , imc , settings , timestamp ) logger . debug ( 'measure' ) stats , saturation = measure_particles ( imbw , imc , settings , timestamp , nnmodel , class_labels ) return stats , imbw , saturation
extracts statistics of particles in imc (raw corrected image)
extracts statistics of particles in imc ( raw corrected image )
'''extracts statistics of particles in imc (raw corrected image)

    Args:
        imc                         : background-corrected image
        timestamp                   : timestamp of image collection
        settings                    : PySilCam settings
        nnmodel                     : loaded tensorflow model from silcam_classify
        class_labels                : lables of particle classes in tensorflow model

    Returns:
        stats                       : (list of particle statistics for every particle, according to Partstats class)
        imbw                        : segmented image
        saturation                  : percentage saturation of image
    ''' # simplyfy processing by squeezing the image dimensions into a 2D array # min is used for squeezing to represent the highest attenuation of all wavelengths # image2blackwhite_fast is less fancy but # image2blackwhite_fast is less fancy but # image2blackwhite_fast is faster than image2blackwhite_accurate but might cause problems when trying to # process images with bad lighting # clean segmented image (small particles and border particles) # fill holes in particles # calculate particle statistics
stats                       : (list of particle statistics for every particle, according to Partstats class)
imbw                        : segmented image
saturation                  : percentage saturation of image
stats : ( list of particle statistics for every particle according to Partstats class ) imbw : segmented image saturation : percentage saturation of image
imc
settings
timestamp
nnmodel
class_labels
imc                         
None
timestamp                   
timestamp of image collection
timestamp of image collection
settings                    
None
nnmodel                     
loaded tensorflow model from silcam_classify
loaded tensorflow model from silcam_classify
class_labels                
lables of particle classes in tensorflow model
lables of particle classes in tensorflow model