def image(request, imageId): """ Shows an image preview (single plane), Name, Description etc. links to datasets. """ conn = getConnection(request) image = conn.getObject("Image", imageId) scriptService = conn.getScriptService() scripts = [] scriptNames = { "/EMAN2/Nonlinear_Anisotropic_Diffusion.py": "IMOD: Nonlinear Anisotropic Diffusion", "/EMAN2/Segger_Segmentation.py": "Segger: Segmentation", "/EMAN2/Eman_Filters.py": "EMAN2: Filtering", "/EMAN2/Ctf_Correction.py": "EMAN2: CTF Correction", "/EMAN2/Run_Spider_Procedure.py": "Spider: Run Procedure", } for path, display in scriptNames.items(): scriptId = scriptService.getScriptID(path) if scriptId and scriptId > 0: s = {} s["name"] = display s["id"] = scriptId scripts.append(s) if not image: return render_to_response("webemdb/data/image.html", {"image": image, "scripts": scripts}) default_z = image.getSizeZ() / 2 return render_to_response("webemdb/data/image.html", {"image": image, "scripts": scripts, "default_z": default_z})
def dataset(request, datasetId, conn=None, **kwargs): """ Shows the thumbnails in a dataset, provides a link back to EMDB entry (project) """ dataset = conn.getObject("Dataset", datasetId) entryId = None # look for parent project that has EMDB entry name (EMDB ID) for p in dataset.listParents(): try: emdbId = long(p.getName()) entryId = str(emdbId) break except: pass # add some scripts that we can run on a dataset scriptService = conn.getScriptService() scripts = [] scriptNames = { "/EMAN2/Nonlinear_Anisotropic_Diffusion.py": "IMOD: Nonlinear Anisotropic Diffusion", "/EMAN2/Segger_Segmentation.py": "Segger: Segmentation", "/EMAN2/Eman_Filters.py": "EMAN2: Filtering", "/EMAN2/Ctf_Correction.py": "EMAN2: CTF Correction", "/EMAN2/Run_Spider_Procedure.py": "Spider: Run Procedure" } for path, display in scriptNames.items(): scriptId = scriptService.getScriptID(path) if scriptId and scriptId > 0: s = {} s["name"] = display s["id"] = scriptId scripts.append(s) # gets list of {"id":annotationId, "name":fileName, "text":fileText} for .spf files spfFiles = getSpfFiles(conn.getQueryService(), conn.createRawFileStore()) return render_to_response( 'webemdb/data/dataset.html', { 'dataset': dataset, 'entryId': entryId, 'scripts': scripts, 'spfFiles': spfFiles })
def dataset(request, datasetId): """ Shows the thumbnails in a dataset, provides a link back to EMDB entry (project) """ conn = getConnection(request) dataset = conn.getObject("Dataset", datasetId) entryId = None # look for parent project that has EMDB entry name (EMDB ID) for p in dataset.listParents(): try: emdbId = long(p.getName()) entryId = str(emdbId) break except: pass # add some scripts that we can run on a dataset scriptService = conn.getScriptService() scripts = [] scriptNames = { "/EMAN2/Nonlinear_Anisotropic_Diffusion.py": "IMOD: Nonlinear Anisotropic Diffusion", "/EMAN2/Segger_Segmentation.py": "Segger: Segmentation", "/EMAN2/Eman_Filters.py": "EMAN2: Filtering", "/EMAN2/Ctf_Correction.py": "EMAN2: CTF Correction", "/EMAN2/Run_Spider_Procedure.py": "Spider: Run Procedure", } for path, display in scriptNames.items(): scriptId = scriptService.getScriptID(path) if scriptId and scriptId > 0: s = {} s["name"] = display s["id"] = scriptId scripts.append(s) # gets list of {"id":annotationId, "name":fileName, "text":fileText} for .spf files spfFiles = getSpfFiles(conn.getQueryService(), conn.createRawFileStore()) return render_to_response( "webemdb/data/dataset.html", {"dataset": dataset, "entryId": entryId, "scripts": scripts, "spfFiles": spfFiles} )
def image(request, imageId, conn=None, **kwargs): """ Shows an image preview (single plane), Name, Description etc. links to datasets. """ image = conn.getObject("Image", imageId) scriptService = conn.getScriptService() scripts = [] scriptNames = { "/EMAN2/Nonlinear_Anisotropic_Diffusion.py": "IMOD: Nonlinear Anisotropic Diffusion", "/EMAN2/Segger_Segmentation.py": "Segger: Segmentation", "/EMAN2/Eman_Filters.py": "EMAN2: Filtering", "/EMAN2/Ctf_Correction.py": "EMAN2: CTF Correction", "/EMAN2/Run_Spider_Procedure.py": "Spider: Run Procedure" } for path, display in scriptNames.items(): scriptId = scriptService.getScriptID(path) if scriptId and scriptId > 0: s = {} s["name"] = display s["id"] = scriptId scripts.append(s) if not image: return render_to_response('webemdb/data/image.html', { 'image': image, "scripts": scripts }) default_z = image.getSizeZ() / 2 return render_to_response('webemdb/data/image.html', { 'image': image, "scripts": scripts, "default_z": default_z })