Exemplo n.º 1
0
 def delete_cache(back):
     # Help -> Delete Directory Slots
     # RCOS TODO: Are you sure?
     ans = back.user_option('Are you sure you want to delete cache?')
     if ans != 'Yes':
         return
     back.invalidate_result()
     df2.close_all_figures()
     back.hs.delete_cache()
     back.populate_result_table()
Exemplo n.º 2
0
 def delete_cache(back):
     # Help -> Delete Directory Slots
     # RCOS TODO: Are you sure?
     ans = back.user_option('Are you sure you want to delete cache?')
     if ans != 'Yes':
         return
     back.invalidate_result()
     df2.close_all_figures()
     back.hs.delete_cache()
     back.populate_result_table()
Exemplo n.º 3
0
def mask_creator_demo(mode=0):
    print('*** START DEMO ***')
    print('mode = %r' % mode)
    # try:
    #     from hscom import fileio as io
    #     img = io.imread('/zebra.jpg', 'RGB')
    # except ImportError as ex:
    #     print('cant read zebra: %r' % ex)
    #     img = np.random.uniform(255, 255, size=(100, 100))

    img = mpimg.imread('zebra2.jpg')
    ax = plt.subplot(111)
    ax.imshow(img)

    if mode == 0:
        mc = MaskCreator(ax)
        # Do interaction
        plt.show()
        # Make mask from selection
        mask = mc.get_mask(img.shape)
        # User must close previous figure
    elif mode == 1:
        from hsgui import guitools
        from hsviz import draw_func2 as df2
        ax.set_title('Click two points to select an ROI (old mode)')
        # Do selection
        roi = guitools.select_roi()
        # Make mask from selection
        mask = roi_to_mask(img.shape, roi)
        # Close previous figure
        df2.close_all_figures()

    # Modify the image with the mask
    masked_img = apply_mask(img, mask)
    # show the modified image
    plt.imshow(masked_img)
    plt.title('Region outside of mask is darkened')
    print('show2')
    plt.show()
Exemplo n.º 4
0
 def delete_queryresults_dir(back):
     # RCOS TODO: Are you sure?
     df2.close_all_figures()
     back.invalidate_result()
     back.hs.delete_queryresults_dir()
     back.populate_result_table()
Exemplo n.º 5
0
 def delete_global_prefs(back):
     # RCOS TODO: Are you sure?
     df2.close_all_figures()
     back.hs.delete_global_prefs()
Exemplo n.º 6
0
 def delete_queryresults_dir(back):
     # RCOS TODO: Are you sure?
     df2.close_all_figures()
     back.invalidate_result()
     back.hs.delete_queryresults_dir()
     back.populate_result_table()
Exemplo n.º 7
0
 def delete_global_prefs(back):
     # RCOS TODO: Are you sure?
     df2.close_all_figures()
     back.hs.delete_global_prefs()