Esempio n. 1
0
def module_main(ctx):

    try:

        filename = a3.inputs['FileName'].path

        #Inizialization
        tstart = time.clock()
        print(SEPARATOR)
        print('Loading the following image: ', filename)

        #Load and reshape image
        img = ImageClass.load(filename)

        #Print important image parameters
        print_line_by_line(str(img))

        #Create Output 1
        ch_1_Nb = a3.inputs['Channel'] - 1
        ch_1 = img.get_dimension(ch_1_Nb, 'C')
        ch_1.metadata['Path'] = filename
        ch_1.reorder('ZYXCT')
        a3.outputs['Channel'] = ch_1

        #Finalization
        tstop = time.clock()
        print('Processing finished in ' + str((tstop - tstart)) + ' seconds! ')
        print('Image loaded successfully!')
        print(SEPARATOR)

    except Exception as e:
        raise error("Error occured while executing '" + str(ctx.type()) +
                    "' module '" + str(ctx.name()) + "' !",
                    exception=e)
Esempio n. 2
0
def module_threshold(image, method="Otsu", kwargs={}):

    #Threshold image
    output, logText = threshold(image, method, **kwargs)

    #Print logText
    print_line_by_line(logText)
    return output
Esempio n. 3
0
def module_threshold(image, method="Otsu", kwargs={}):

    #Threshold image
    output, logText = threshold(image, method, **kwargs)
    print('Threshold value(s): ' + str(logText.split('\n')[-2].split(':')[-1]))

    #Print logText
    print_line_by_line(logText)

    return output