Ejemplo n.º 1
0
def create_poly_region(ctx, img=None, features=None):
    '''Create a region file
    
    Parameters
    ----------
    ctx : :class:`wise.project.AnalysisContext`
    img : :class:`libwise.imgutils.Image`, optional
        Image to use as background
    features : :class:`wise.features.FeaturesGroup`, optional
        Features to plot on top of the image


    .. _tags: task_general
    '''
    from libwise.app import PolyRegionEditor

    if img is None:
        img = ctx.get_ref_image()

    prj = ctx.get_projection(img)

    editor = PolyRegionEditor.PolyRegionEditor(img, prj=prj, current_folder=ctx.get_data_dir())

    if features is not None:
        wiseutils.plot_features(editor.ax, features, mode='com', c=plotutils.black, s=20)
    editor.start()
Ejemplo n.º 2
0
    def do_plot(fig):
        ax_all = fig.subplots()

        plotutils.imshow_image(ax_all, ref_img, projection=projection, **img_kargs)

        if region_list is not None:
            for region, gdata in data.df.groupby('region'):
                features = wds.DatedFeaturesGroupScale(0, features=gdata.features.values)

                wiseutils.plot_features(ax_all, features, mode='com', c=region.get_color(), label=region.get_name())
                plotutils.plot_region(ax_all, region, projection=projection, text=False, 
                                      color=region.get_color(), fill=True)
        else:
            features = wds.DatedFeaturesGroupScale(0, features=data.df.features.values)
            wiseutils.plot_features(ax_all, features, mode='com')

        if legend:
            ax_all.legend(loc='best')