Пример #1
0
def run_script():
    '''Function to be run when this file is used as a script'''
    selected_mode, img1_in, img2_in = get_setup()
    if not selected_mode:
        return
    corrected_stack = drift.get_corrected_stack((img1_in, img2_in), mode=selected_mode)
    img1, img2 = tools.stack_to_list_of_imp(corrected_stack)
    img_ratio = ImageCalculator().run('Divide create', img2, img1)
    img_ratio.setTitle('Jump-ratio [%s divided by %s]' % (img2.getShortTitle(),
                                                          img1.getShortTitle())
                      )
    img_ratio.changes = True
    img_ratio.copyScale(img1_in)
    img_ratio.show()
    IJ.run(img_ratio, 'Enhance Contrast', 'saturated=0.35')
    # We want to optimise the lower displaylimit:
    minimum = img_ratio.getProcessor().getMin()
    maximum = img_ratio.getProcessor().getMax()
    stat = img_ratio.getStatistics(Stats.MEAN + Stats.STD_DEV)
    mean = stat.mean
    stdv = stat.stdDev
    if minimum < mean - stdv:
        if mean - stdv >= 0:
            img_ratio.getProcessor().setMinAndMax(mean - stdv, maximum)
        else:
            img_ratio.getProcessor().setMinAndMax(0, maximum)
        img_ratio.updateAndDraw()
Пример #2
0
def run_script():
    """Function to be run when this file is used as a script"""
    images = tools.get_images()
    if not images:
        return
    elif len(images) >= 2:
        corrected_stack = drift.get_corrected_stack(images, "SIFT")
        corrected_stack.copyScale(images[0])
        corrected_stack.show()
def run_script():
    '''Function to be run when this file is used as a script'''
    selected_mode, pre1_in, pre2_in, post_in = get_setup()
    if not selected_mode:
        return
    corrected_stack = drift.get_corrected_stack((pre1_in, pre2_in, post_in), mode=selected_mode)
    pre1_imp, pre2_imp, post_imp = tools.stack_to_list_of_imp(corrected_stack)

    mapping = ElementalMapping.ThreeWindow(pre1_imp, pre2_imp, post_imp)
    map_imp, snr_imp, r_imp, lna_imp = mapping.get_result()

    for imp in (map_imp, snr_imp, r_imp, lna_imp):
        imp.copyScale(post_in)
        show_imp(imp)