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)
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)
def load(info): info["serverRoot"], info["serverRoot"].girder = (CustomAppRoot(), info["serverRoot"]) info["serverRoot"].api = info["serverRoot"].girder.api del info["serverRoot"].girder.api info["apiRoot"].collection.route("GET", ("unbound", "default", "noargs"), unboundHandlerDefaultNoArgs) info["apiRoot"].collection.route("GET", ("unbound", "default"), unboundHandlerDefault) info["apiRoot"].collection.route("GET", ("unbound", "explicit"), unboundHandlerExplicit) info["apiRoot"].other = Other() path = os.path.join(globals()["PLUGIN_ROOT_DIR"], "static.txt") info["serverRoot"].static_route = staticFile(path)
def load(info): info['serverRoot'], info['serverRoot'].girder = (CustomAppRoot(), info['serverRoot']) info['serverRoot'].api = info['serverRoot'].girder.api del info['serverRoot'].girder.api info['apiRoot'].collection.route('GET', ('unbound', 'default'), unboundHandlerDefault) info['apiRoot'].collection.route('GET', ('unbound', 'explicit'), unboundHandlerExplicit) info['apiRoot'].other = Other() path = os.path.join(globals()['PLUGIN_ROOT_DIR'], 'static.txt') info['serverRoot'].static_route = staticFile(path)
def load(self, info): info['serverRoot'], info['serverRoot'].girder = ( CustomAppRoot(), info['serverRoot']) info['serverRoot'].api = info['serverRoot'].girder.api del info['serverRoot'].girder.api info['apiRoot'].collection.route('GET', ('unbound', 'default', 'noargs'), unboundHandlerDefaultNoArgs) info['apiRoot'].collection.route('GET', ('unbound', 'default'), unboundHandlerDefault) info['apiRoot'].other = Other() path = os.path.join(os.path.dirname(__file__), 'data', 'static.txt') info['serverRoot'].static_route = staticFile(path)
def load(info): info['serverRoot'], info['serverRoot'].girder = ( CustomAppRoot(), info['serverRoot']) info['serverRoot'].api = info['serverRoot'].girder.api del info['serverRoot'].girder.api info['apiRoot'].collection.route('GET', ('unbound', 'default'), unboundHandlerDefault) info['apiRoot'].collection.route('GET', ('unbound', 'explicit'), unboundHandlerExplicit) info['apiRoot'].other = Other() path = os.path.join(globals()['PLUGIN_ROOT_DIR'], 'static.txt') info['serverRoot'].static_route = staticFile(path)
def load(self, info): getPlugin('worker').load(info) dist = os.path.join(os.path.dirname(__file__), 'dist') webroot = staticFile(os.path.join(dist, 'index.html')) registerPluginWebroot(webroot, 'stroke') info['config']['/stroke_static'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'stroke_static') } info['config']['/itk'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'itk') } info['apiRoot'].study = Study() info['apiRoot'].series = Series() info['apiRoot'].item.route('GET', (':id', 'dicom_thumbnail', ':uid'), _getThumbnail) info['apiRoot'].item.route('POST', (':id', 'dicom_thumbnail'), _createThumbnail) Folder().ensureIndex(('isStudy', {'sparse': True})) Folder().exposeFields(level=AccessType.READ, fields={ 'isStudy', 'nSeries', 'studyDate', 'patientId', 'studyModality' }) Item().exposeFields(level=AccessType.READ, fields={'isSeries'}) events.bind('model.file.finalizeUpload.after', 'stroke', _handleUpload) events.bind('model.item.remove', 'stroke.decrement_series_count', _decrementSeriesCount) events.bind('model.item.remove', 'stroke.clean_thumbnails', lambda e: _removeThumbnails(e.info)) # Guest user support events.bind('model.user.authenticate', 'stroke', _authenticateGuestUser) try: User().createUser(login='******', password='******', firstName='Guest', lastName='User', email='*****@*****.**') except ValidationException: pass
def load(self, info): info['serverRoot'], info['serverRoot'].girder = ( CustomAppRoot(), info['serverRoot']) info['serverRoot'].api = info['serverRoot'].girder.api del info['serverRoot'].girder.api info['apiRoot'].collection.route('GET', ('unbound', 'default', 'noargs'), unboundHandlerDefaultNoArgs) info['apiRoot'].collection.route('GET', ('unbound', 'default'), unboundHandlerDefault) info['apiRoot'].collection.route('GET', ('unbound', 'explicit'), unboundHandlerExplicit) info['apiRoot'].other = Other() path = os.path.join(os.path.dirname(__file__), 'data', 'static.txt') info['serverRoot'].static_route = staticFile(path)
def load(self, info): getPlugin('worker').load(info) addTemplateDirectory(os.path.join(os.path.dirname(__file__)), 'mail_templates') dist = os.path.join(os.path.dirname(__file__), 'dist') webroot = staticFile(os.path.join(dist, 'index.html')) registerPluginWebroot(webroot, 'demo_site') info['config']['/stroke_ct_static'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'stroke_ct_static') } info['config']['/itk'] = { 'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(dist, 'itk') } info['apiRoot'].study = Study() info['apiRoot'].series = Series() info['apiRoot'].photomorph = Photomorph() info['apiRoot'].inpainting = Inpainting() Folder().ensureIndex(('isStudy', {'sparse': True})) Folder().ensureIndex(('isPhotomorph', {'sparse': True})) Folder().ensureIndex(('photomorphExampleFolder', {'sparse': True})) Folder().ensureIndex(('inpaintingExampleFolder', {'sparse': True})) Folder().exposeFields(level=AccessType.READ, fields={ 'isStudy', 'nSeries', 'studyDate', 'patientId', 'studyModality', 'photomorphJobId', 'isPhotomorph', 'photomorphInputFolderId', 'photomorphOutputItems', 'photomorphJobStatus', 'photomorphMaskRect' }) Item().exposeFields(level=AccessType.READ, fields={ 'isSeries', 'isPhotomorph', 'originalName', 'photomorphTakenDate' }) Job().exposeFields(level=AccessType.READ, fields={ 'photomorphId', 'inpaintingImageId', 'inpaintingMaskId', 'inpaintingImageResultId', 'inpaintingFolderId' }) events.bind('model.file.finalizeUpload.after', 'demo_site', _handleUpload) events.bind('model.item.remove', 'demo_site', _itemDeleted) events.bind('jobs.job.update', 'demo_site', _jobUpdated) # Guest user support events.bind('model.user.authenticate', 'demo_site', _authenticateGuestUser) try: User().createUser(login='******', password='******', firstName='Guest', lastName='User', email='*****@*****.**') except ValidationException: pass
def load(info): # set the title of the HTML pages info['serverRoot'].updateHtmlVars({'title': 'ISIC Archive'}) # add event listeners # note, 'model.setting.validate' must be bound before initialSetup is called events.bind('model.setting.validate', 'isic', validateSettings) events.bind('model.user.save.created', 'onUserCreated', onUserCreated) events.bind('rest.get.item/:id.after', 'onGetItem', onGetItem) ModelImporter.model('setting').set(SettingKey.USER_DEFAULT_FOLDERS, 'none') # add custom model searching resource.allowedSearchTypes.update({ 'image.isic_archive', 'featureset.isic_archive', 'study.isic_archive', }) # create all necessary users, groups, collections, etc initialSetup(info) # add static file serving app_base = os.path.join(os.curdir, os.pardir) app_path = os.path.join(app_base, 'girder', 'plugins', 'isic_archive', 'custom') info['config']['/uda'] = { 'tools.staticdir.on': 'True', 'tools.staticdir.dir': app_path } # add dynamic root routes # root endpoints -> where a user may go and expect a UI class Root(object): pass info['serverRoot'].uda = Root() # "/uda/gallery" -> returns a single page gallery info['serverRoot'].uda.gallery = staticFile(os.path.join(info['pluginRootDir'], 'custom', 'gallery.html')) # "/uda/task" -> redirects to appropriate task view for the user info['serverRoot'].uda.task = TaskHandler(info['pluginRootDir']) # "/uda/annotator/:id" -> the reconfigurable image annotator info['serverRoot'].uda.annotate = staticFile(os.path.join(info['pluginRootDir'], 'custom', 'phase1.html')) # "/uda/map/:id" info['serverRoot'].uda.map = staticFile(os.path.join(info['pluginRootDir'], 'custom', 'phase2.html')) # add api routes # remove docs for default Girder API, to simplify page clearRouteDocs() info['apiRoot'].uda = UDAResource(info['pluginRootDir']) # TODO: nest these under a "/isic" path info['apiRoot'].annotation = api.AnnotationResource(info['pluginRootDir']) 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() # Serve isic app from /isic info['serverRoot'].isic = Webroot()