Esempio n. 1
0
def load(info):
    # set the title of the HTML pages
    info['serverRoot'].updateHtmlVars({'title': 'ISIC Archive'})

    # add event listeners
    events.bind('rest.get.describe/:resource.after', 'onDescribeResource',
                onDescribeResource)
    events.bind('model.job.save', 'onJobSave', onJobSave)

    # add custom model searching
    resource.allowedSearchTypes.update({
        'image.isic_archive',
        'featureset.isic_archive',
        'study.isic_archive',
    })

    # register licenses for template usage
    mail_utils.addTemplateDirectory(os.path.join(info['pluginRootDir'],
                                                 'server',
                                                 'license_templates'),
                                    prepend=True)

    registerPluginWebroot(Webroot(), info['name'])

    # add static file serving
    info['config']['/uda'] = {
        'tools.staticdir.on': 'True',
        'tools.staticdir.dir': os.path.join(info['pluginRootDir'], 'custom')
    }

    # add dynamic root routes
    # root endpoints -> where a user may go and expect a UI
    class Root(object):
        pass

    legacyWebroot = Root()
    legacyWebroot.gallery = staticFile(
        os.path.join(info['pluginRootDir'], 'custom', 'gallery.html'))
    legacyWebroot.segment = staticFile(
        os.path.join(info['pluginRootDir'], 'custom', 'phase1.html'))
    legacyWebroot.annotate = staticFile(
        os.path.join(info['pluginRootDir'], 'custom', 'phase2.html'))
    registerPluginWebroot(legacyWebroot, 'markup')

    # create all necessary users, groups, collections, etc
    provisionDatabase()

    # add api routes
    # remove docs for default Girder API, to simplify page
    clearRouteDocs()

    # TODO: nest these under a "/isic" path?
    info['apiRoot'].annotation = api.AnnotationResource()
    info['apiRoot'].dataset = api.DatasetResource()
    info['apiRoot'].featureset = api.FeaturesetResource()
    info['apiRoot'].image = api.ImageResource()
    info['apiRoot'].segmentation = api.SegmentationResource()
    info['apiRoot'].study = api.StudyResource()
    info['apiRoot'].task = api.TaskResource()
    api.attachUserApi(info['apiRoot'].user)
Esempio n. 2
0
def load(info):
    resource.allowedSearchTypes.add('challenge.covalic')

    info['apiRoot'].challenge = challenge.Challenge()
    info['apiRoot'].challenge_phase = phase.Phase()
    info['apiRoot'].covalic_submission = submission.Submission()

    registerPluginWebroot(CustomAppRoot(), info['name'])
Esempio n. 3
0
def load(info):
    # set the title of the HTML pages
    info['serverRoot'].updateHtmlVars({'title': 'ISIC Archive'})

    # add event listeners
    events.bind('rest.get.describe/:resource.after',
                'onDescribeResource', onDescribeResource)
    events.bind('model.job.save', 'onJobSave', onJobSave)

    # add custom model searching
    resource.allowedSearchTypes.update({
        'image.isic_archive',
        'featureset.isic_archive',
        'study.isic_archive',
    })

    # register licenses for template usage
    mail_utils.addTemplateDirectory(
        os.path.join(info['pluginRootDir'], 'server', 'license_templates'),
        prepend=True)

    registerPluginWebroot(Webroot(), info['name'])

    # add static file serving
    info['config']['/uda'] = {
        'tools.staticdir.on': 'True',
        'tools.staticdir.dir': os.path.join(info['pluginRootDir'], 'custom')
    }

    # add dynamic root routes
    # root endpoints -> where a user may go and expect a UI
    class Root(object):
        pass
    legacyWebroot = Root()
    legacyWebroot.gallery = staticFile(
        os.path.join(info['pluginRootDir'], 'custom', 'gallery.html'))
    legacyWebroot.segment = staticFile(
        os.path.join(info['pluginRootDir'], 'custom', 'phase1.html'))
    legacyWebroot.annotate = staticFile(
        os.path.join(info['pluginRootDir'], 'custom', 'phase2.html'))
    registerPluginWebroot(legacyWebroot, 'markup')

    # create all necessary users, groups, collections, etc
    provisionDatabase()

    # add api routes
    # remove docs for default Girder API, to simplify page
    clearRouteDocs()

    # TODO: nest these under a "/isic" path?
    info['apiRoot'].annotation = api.AnnotationResource()
    info['apiRoot'].dataset = api.DatasetResource()
    info['apiRoot'].featureset = api.FeaturesetResource()
    info['apiRoot'].image = api.ImageResource()
    info['apiRoot'].segmentation = api.SegmentationResource()
    info['apiRoot'].study = api.StudyResource()
    info['apiRoot'].task = api.TaskResource()
    api.attachUserApi(info['apiRoot'].user)
Esempio n. 4
0
def load(info):
    index = IndexAPIHandler()
    image = ImageResource()
    label = LabelResource()
    assignment = AssignmentResource()

    print("asdfasdfsdafasdgsadgasg" + PLUGIN_ROOT_DIR)
    path = os.path.join(PLUGIN_ROOT_DIR, 'web_client/static', 'index.html')
    index.cp_config['tools.staticdir.dir'] = os.path.join(info['pluginRootDir'], 'web_client/static')
    registerPluginWebroot(index, "")
    info['apiRoot'].image = image
    info['apiRoot'].label = label
    info['apiRoot'].assignment = assignment
Esempio n. 5
0
def load(info):
    resource.allowedSearchTypes.add('challenge.covalic')

    info['apiRoot'].challenge = challenge.Challenge()
    info['apiRoot'].challenge_phase = phase.Phase()
    info['apiRoot'].covalic_submission = submission.Submission()

    registerPluginWebroot(CustomAppRoot(), info['name'])

    events.bind('jobs.job.update', 'covalic', onJobUpdate)
    events.bind('model.setting.validate', 'covalic', validateSettings)
    events.bind('model.challenge_challenge.save.after', 'covalic',
                challengeSaved)
    events.bind('model.challenge_phase.save.after', 'covalic', onPhaseSave)
    events.bind('model.user.save.after', 'covalic', onUserSave)
Esempio n. 6
0
def load(info):
    index = IndexAPIHandler()
    image = ImageResource()
    label = LabelResource()
    labelImage = LabelImageResource()
    assignment = AssignmentResource()
    brush_canvas = BrushCanvasResource()
    print("asdfasdfsdafasdgsadgasg" + PLUGIN_ROOT_DIR)
    path = os.path.join(PLUGIN_ROOT_DIR, 'web_client/static', 'index.html')
    index.cp_config['tools.staticdir.dir'] = os.path.join(
        info['pluginRootDir'], 'web_client/static')
    registerPluginWebroot(index, "")
    info['apiRoot'].image = image
    info['apiRoot'].label = label
    info['apiRoot'].assignment = assignment
    info['apiRoot'].brush_canvas = brush_canvas
    info['apiRoot'].labelImage = labelImage
Esempio n. 7
0
def load(info):
    """OSUMO plugin entry point."""
    # Check environment variables for anonymous user/password; bail if not set.
    anonuser = os.environ.get('OSUMO_ANON_USER')
    if not anonuser:
        try:
            f = open(os.path.join(info['pluginRootDir'],
                                  'osumo_anonlogin.txt'))

            with f:
                anonuser = f.read().strip()
        except IOError:
            pass

    if not anonuser:
        error_message = ' '.join(
            ('Environment variable OSUMO_ANON_USER must be set, or the',
             'file "osumo_anonlogin.txt" must exist.'))

        logprint.error(error_message)
        raise RuntimeError(error_message)

    user_model = ModelImporter.model('user')
    anon_user = user_model.findOne({'login': anonuser})

    if anon_user is None:
        anon_user = user_model.createUser(login=anonuser,
                                          password=None,
                                          firstName='Public',
                                          lastName='User',
                                          email='*****@*****.**',
                                          admin=False,
                                          public=False)
        anon_user['status'] = 'enabled'

        anon_user = user_model.save(anon_user)

    Osumo._cp_config['tools.staticdir.dir'] = (os.path.join(
        info['pluginRootDir'], 'web_client'))
    osumo = Osumo(anonuser)
    registerPluginWebroot(osumo, info['name'])
    info['apiRoot'].osumo = osumo

    events.bind('data.process', 'osumo', osumo.dataProcess)
Esempio n. 8
0
def load(info):
    info['apiRoot'].app = App()
    info['serverRoot'].updateHtmlVars({'title': 'Slicer extension manager'})

    registerPluginWebroot(Webroot(), info['name'])
Esempio n. 9
0
def load(info):
    registerPluginWebroot(SomeWebroot(), info['name'])
Esempio n. 10
0
def load(info):
    print info
    Circular._cp_config['tools.staticdir.dir'] = os.path.join(
        info['pluginRootDir'], 'web_client')
    registerPluginWebroot(Circular(info), info['name'])