Package omeroweb :: Package webgateway :: Module urls
[hide private]
[frames] | no frames]

Source Code for Module omeroweb.webgateway.urls

  1  #!/usr/bin/env python 
  2  # -*- coding: utf-8 -*- 
  3  # 
  4  # webgateway/urls.py - django application url handling configuration 
  5  #  
  6  # Copyright (c) 2007, 2008, 2009 Glencoe Software, Inc. All rights reserved. 
  7  #  
  8  # This software is distributed under the terms described by the LICENCE file 
  9  # you can find at the root of the distribution bundle, which states you are 
 10  # free to use it only for non commercial purposes. 
 11  # If the file is missing please request a copy by contacting 
 12  # jason@glencoesoftware.com. 
 13  # 
 14  # Author: Carlos Neves <carlos(at)glencoesoftware.com> 
 15   
 16  from django.conf.urls.defaults import * 
 17   
 18  webgateway = url( r'^$', 'webgateway.views.test', name="webgateway" ) 
 19  """ 
 20  Returns a main prefix 
 21  """ 
 22   
 23  annotations = url(r'^annotations/(?P<objtype>[\w.]+)/(?P<objid>\d+)/$', 'webgateway.views.annotations', name="webgateway_annotations") 
 24  """ 
 25  Retrieve annotations for object specified by object type and identifier, 
 26  optionally traversing object model graph. 
 27  """ 
 28   
 29  table_query = url(r'^table/(?P<fileid>\d+)/query/$', 'webgateway.views.table_query', name="webgateway_table_query") 
 30  """ 
 31  Query a table specified by fileid 
 32  """ 
 33   
 34  object_table_query = url(r'^table/(?P<objtype>[\w.]+)/(?P<objid>\d+)/query/$', 'webgateway.views.object_table_query', name="webgateway_object_table_query") 
 35  """ 
 36  Query bulk annotations table attached to an object specified by 
 37  object type and identifier, optionally traversing object model graph. 
 38  """ 
 39   
 40  render_image = (r'^render_image/(?P<iid>[^/]+)/(?:(?P<z>[^/]+)/)?(?:(?P<t>[^/]+)/)?$', 'webgateway.views.render_image') 
 41  """ 
 42  Returns a jpeg of the OMERO image. See L{views.render_image}. Rendering settings can be specified 
 43  in the request parameters. See L{views.getImgDetailsFromReq} for details.  
 44  Params in render_image/<iid>/<z>/<t>/ are: 
 45      - iid:  Image ID 
 46      - z:    Z index 
 47      - t:    T index 
 48  """ 
 49   
 50  render_image_region = (r'^render_image_region/(?P<iid>[^/]+)/(?P<z>[^/]+)/(?P<t>[^/]+)/$', 'webgateway.views.render_image_region') 
 51  """ 
 52  Returns a jpeg of the OMERO image, rendering only a region specified in query string as 
 53  region=x,y,width,height. E.g. region=0,512,256,256 See L{views.render_image_region}.  
 54  Rendering settings can be specified in the request parameters. 
 55  Params in render_image/<iid>/<z>/<t>/ are: 
 56      - iid:  Image ID 
 57      - z:    Z index 
 58      - t:    T index 
 59  """ 
 60   
 61  render_split_channel = (r'^render_split_channel/(?P<iid>[^/]+)/(?P<z>[^/]+)/(?P<t>[^/]+)/$', 'webgateway.views.render_split_channel') 
 62  """ 
 63  Returns a jpeg of OMERO Image with channels split into different panes in a grid. See L{views.render_split_channel}. 
 64  Rendering settings can be specified in the request parameters (as above). 
 65  Params in render_split_channel/<iid>/<z>/<t> are: 
 66      - iid:  Image ID 
 67      - z:    Z index 
 68      - t:    T index 
 69  """ 
 70   
 71  render_row_plot = (r'^render_row_plot/(?P<iid>[^/]+)/(?P<z>[^/]+)/(?P<t>[^/]+)/(?P<y>[^/]+)/(?:(?P<w>[^/]+)/)?$',  
 72      'webgateway.views.render_row_plot') 
 73  """ 
 74  Returns a gif graph of pixel values for a row of an image plane. See L{views.render_row_plot}. 
 75  Channels can be turned on/off using request. E.g. c=-1,2,-3,-4 
 76  Params in render_row_plot/<iid>/<z>/<t>/<y>/<w> are: 
 77      - iid:  Image ID 
 78      - z:    Z index 
 79      - t:    T index 
 80      - y:    Y position of pixel row 
 81      - w:    Optional line width of plot 
 82  """ 
 83   
 84  render_col_plot = (r'^render_col_plot/(?P<iid>[^/]+)/(?P<z>[^/]+)/(?P<t>[^/]+)/(?P<x>[^/]+)/(?:(?P<w>[^/]+)/)?$',  
 85      'webgateway.views.render_col_plot') 
 86  """ 
 87  Returns a gif graph of pixel values for a column of an image plane. See L{views.render_col_plot}. 
 88  Channels can be turned on/off using request. E.g. c=-1,2,-3,-4 
 89  Params in render_col_plot/<iid>/<z>/<t>/<x>/<w> are: 
 90      - iid:  Image ID 
 91      - z:    Z index 
 92      - t:    T index 
 93      - x:    X position of pixel column 
 94      - w:    Optional line width of plot 
 95  """ 
 96   
 97  render_thumbnail = url(r'^render_thumbnail/(?P<iid>[^/]+)/(?:(?P<w>[^/]+)/)?(?:(?P<h>[^/]+)/)?$', 'webgateway.views.render_thumbnail') 
 98  """ 
 99  Returns a thumbnail jpeg of the OMERO Image, optionally scaled to max-width and max-height. 
100  See L{views.render_thumbnail}. Uses current rendering settings.  
101  Params in render_thumbnail/<iid>/<w>/<h> are: 
102      - iid:  Image ID 
103      - w:    Optional max width 
104      - h:    Optional max height 
105  """ 
106   
107  render_roi_thumbnail = (r'^render_roi_thumbnail/(?P<roiId>[^/]+)/?$', 'webgateway.views.render_roi_thumbnail') 
108  """ 
109  Returns a thumbnail jpeg of the OMERO ROI. See L{views.render_roi_thumbnail}. Uses current rendering settings.  
110  """ 
111   
112  render_shape_thumbnail = (r'^render_shape_thumbnail/(?P<shapeId>[^/]+)/?$', 'webgateway.views.render_shape_thumbnail') 
113  """ 
114  Returns a thumbnail jpeg of the OMERO Shape. See L{views.render_shape_thumbnail}. Uses current rendering settings.  
115  """ 
116   
117  render_birds_eye_view = (r'^render_birds_eye_view/(?P<iid>[^/]+)/(?:(?P<size>[^/]+)/)?$', 'webgateway.views.render_birds_eye_view') 
118  """ 
119  Returns a bird's eye view JPEG of the OMERO Image. 
120  See L{views.render_birds_eye_view}. Uses current rendering settings. 
121  Params in render_birds_eye_view/<iid>/ are: 
122      - iid:   Image ID 
123      - size:  Maximum size of the longest side of the resulting bird's eye view. 
124  """ 
125   
126  render_ome_tiff = (r'^render_ome_tiff/(?P<ctx>[^/]+)/(?P<cid>[^/]+)/$', 'webgateway.views.render_ome_tiff') 
127  """ 
128  Generates an OME-TIFF of an Image (or zip for multiple OME-TIFFs) and returns the file or redirects  
129  to a temp file location. See L{views.render_ome_tiff} 
130  Params in render_ome_tiff/<ctx>/<cid> are: 
131      - ctx:      The container context. 'p' for Project, 'd' for Dataset or 'i' Image.  
132      - cid:      ID of container. 
133  """ 
134   
135  render_movie = (r'^render_movie/(?P<iid>[^/]+)/(?P<axis>[zt])/(?P<pos>[^/]+)/$', 'webgateway.views.render_movie') 
136  """ 
137  Generates a movie file from the image, spanning Z or T frames. See L{views.render_movie} 
138  Returns the file or redirects to temp file location.  
139  Params in render_movie/<iid>/<axis>/<pos> are: 
140      - iid:      Image ID 
141      - axis:     'z' or 't' dimension that movie plays 
142      - pos:      The T index (for 'z' movie) or Z index (for 't' movie) 
143  """ 
144   
145  # Template views 
146  test = (r'^test/$', 'webgateway.views.test') 
147  """ 
148  Test method: returns a blank template of the image-viewer 
149  """ 
150   
151  # json methods... 
152   
153  listProjects_json = (r'^proj/list/$', 'webgateway.views.listProjects_json') 
154  """ 
155  json method: returning list of all projects available to current user. See L{views.listProjects_json} . 
156  List of E.g. {"description": "", "id": 651, "name": "spim"} 
157  """ 
158   
159  projectDetail_json = (r'^proj/(?P<pid>[^/]+)/detail/$', 'webgateway.views.projectDetail_json') 
160  """ 
161  json method: returns details of specified Project. See L{views.projectDetail_json}. Returns E.g 
162  {"description": "", "type": "Project", "id": 651, "name": "spim"} 
163      - webgateway/proj/<pid>/detail params are: 
164      - pid:  Project ID 
165  """ 
166   
167  listDatasets_json = (r'^proj/(?P<pid>[^/]+)/children/$', 'webgateway.views.listDatasets_json') 
168  """ 
169  json method: returns list of Datasets belonging to specified Project. See L{views.listDatasets_json}. Returns E.g 
170  list of {"child_count": 4, "description": "", "type": "Dataset", "id": 901, "name": "example"} 
171      - webgateway/proj/<pid>/children params are: 
172      - pid:  Project ID 
173  """ 
174   
175  datasetDetail_json = (r'^dataset/(?P<did>[^/]+)/detail/$', 'webgateway.views.datasetDetail_json') 
176  """ 
177  json method: returns details of specified Dataset. See L{views.datasetDetail_json}. Returns E.g 
178  {"description": "", "type": "Dataset", "id": 901, "name": "example"} 
179      - webgateway/dataset/<did>/detail params are: 
180      - did:  Dataset ID 
181  """ 
182   
183  webgateway_listimages_json = url(r'^dataset/(?P<did>[^/]+)/children/$', 'webgateway.views.listImages_json', name="webgateway_listimages_json") 
184  """ 
185  json method: returns list of Images belonging to specified Dataset. See L{views.listImages_json}. Returns E.g list of  
186  {"description": "", "author": "Will Moore", "date": 1291325060.0, "thumb_url": "/webgateway/render_thumbnail/4701/", "type": "Image", "id": 4701, "name": "spim.png"} 
187      - webgateway/dataset/<did>/children params are: 
188        - did:  Dataset ID 
189      - request variables: 
190        - thumbUrlPrefix: view key whose reverse url is to be used as prefix for thumb_url instead of default 
191                          webgateway.views.render_thumbnail 
192        - tiled: if set with anything other than an empty string will add information on whether each image 
193                 is tiled on this server 
194       
195  """ 
196   
197  webgateway_listwellimages_json = url(r'^well/(?P<did>[^/]+)/children/$', 'webgateway.views.listWellImages_json', name="webgateway_listwellimages_json") 
198  """ 
199  json method: returns list of Images belonging to specified Well. See L{views.listWellImages_json}. Returns E.g list of  
200  {"description": "", "author": "Will Moore", "date": 1291325060.0, "thumb_url": "/webgateway/render_thumbnail/4701/", "type": "Image", "id": 4701, "name": "spim.png"} 
201      - webgateway/well/<did>/children params are: 
202      - did:  Well ID 
203  """ 
204   
205  webgateway_plategrid_json = url(r'^plate/(?P<pid>[^/]+)/(?:(?P<field>[^/]+)/)?$', 'webgateway.views.plateGrid_json', name="webgateway_plategrid_json") 
206  """ 
207  """ 
208   
209  imageData_json = (r'^imgData/(?P<iid>[^/]+)/(?:(?P<key>[^/]+)/)?$', 'webgateway.views.imageData_json') 
210  """ 
211  json method: returns details of specified Image. See L{views.imageData_json}. Returns E.g 
212  {"description": "", "type": "Dataset", "id": 901, "name": "example"} 
213      - webgateway/imgData/<iid>/<key> params are: 
214      - did:  Dataset ID 
215      - key:  Optional key of selected attributes to return. E.g. meta, pixel_range, rdefs, split_channel, size etc 
216  """ 
217   
218  wellData_json = url(r'^wellData/(?P<wid>[^/]+)/$', 'webgateway.views.wellData_json', name='webgateway_wellData_json') 
219  """ 
220  json method: returns details of specified Well. See L{views.wellData_json}. 
221      - webgateway/wellData/<wid>/ params are: 
222      - wid:  Well ID 
223  """ 
224   
225  webgateway_search_json = url(r'^search/$', 'webgateway.views.search_json', name="webgateway_search_json") 
226  """ 
227  json method: returns search results. All parameters in request. See L{views.search_json} 
228  """ 
229   
230  get_rois_json = url( r'^get_rois_json/(?P<imageId>[0-9]+)$', 'webgateway.views.get_rois_json', name='webgateway_get_rois_json' ) 
231  """ 
232  gets all the ROIs for an Image as json. Image-ID is request: imageId=123 
233  [{'id':123, 'shapes':[{'type':'Rectangle', 'theZ':5, 'theT':0, 'x':250, 'y':100, 'width':10 'height':45} ] 
234  """ 
235   
236  get_shape_json = url( r'^get_shape_json/(?P<roiId>[0-9]+)/(?P<shapeId>[0-9]+)$', 'webgateway.views.get_shape_json', name='webgateway_get_shape_json' ) 
237  """ 
238  gets a Shape as json. ROI-ID, Shape-ID is request: roiId=123 and shapeId=123 
239  {'type':'Rectangle', 'theZ':5, 'theT':0, 'x':250, 'y':100, 'width':10, 
240  'height':45} 
241  """ 
242   
243  full_viewer = url(r'^img_detail/(?P<iid>[0-9]+)/$', "webgateway.views.full_viewer", name="webgateway_full_viewer") 
244  """ 
245  Returns html page displaying full image viewer and image details, rendering settings etc.  
246  See L{views.full_viewer}. 
247      - webgateway/img_detail/<iid>/ params are: 
248      - iid:  Image ID.  
249  """ 
250   
251  save_image_rdef_json = (r'^saveImgRDef/(?P<iid>[^/]+)/$', 'webgateway.views.save_image_rdef_json') 
252  """ 
253  Saves rendering definition (from request parameters) on the image. See L{views.save_image_rdef_json}.  
254  For rendering parameters, see L{views.getImgDetailsFromReq} for details.  
255  Returns 'true' if worked OK.  
256      - webgateway/saveImgRDef/<iid>/ params are: 
257      - iid:  Image ID. 
258  """ 
259   
260  reset_image_rdef_json = (r'^resetImgRDef/(?P<iid>[^/]+)/$', 'webgateway.views.reset_image_rdef_json') 
261  """ 
262  Removes user's rendering settings on an image, reverting to settings created on import.  
263  See L{views.reset_image_rdef_json}.  
264      - webgateway/resetImgRDef/<iid>/ params are: 
265      - iid:  Image ID. 
266  """ 
267   
268  list_compatible_imgs_json = (r'^compatImgRDef/(?P<iid>[^/]+)/$', 'webgateway.views.list_compatible_imgs_json') 
269  """ 
270  json method: returns list of IDs for images that have channels compatible with the specified image, such 
271  that rendering settings can be copied from the image to those returned. Images are selected from the same 
272  project that the specified image is in.  
273      - webgateway/compatImgRDef/<iid>/ params are: 
274      - iid:  Image ID. 
275  """ 
276   
277  copy_image_rdef_json = (r'^copyImgRDef/$', 'webgateway.views.copy_image_rdef_json') 
278  """ 
279  Copy the rendering settings from one image to a list of images, specified in request 
280  by 'fromid' and list of 'toids'. See L{views.copy_image_rdef_json} 
281  """ 
282   
283  webgateway_su = url(r'^su/(?P<user>[^/]+)/$', 'webgateway.views.su', name="webgateway_su") 
284  """ 
285  Admin method to switch to the specified user, identified by username: <user>  
286  Returns 'true' if switch went OK. 
287  """ 
288   
289  archived_files = url( r'^archived_files/download/(?P<iid>[0-9]+)/$', 'webgateway.views.archived_files', name="archived_files" ) 
290  """ 
291  This url will download the Original Image File(s) archived at import time. If it's a single file, this will be 
292  downloaded directly. For multiple files, they are assembled into a zip file on the fly, and this is downloaded. 
293  """ 
294   
295  original_file_paths = url( r'^original_file_paths/(?P<iid>[0-9]+)/$', 'webgateway.views.original_file_paths', name="original_file_paths" ) 
296  """ Get a json array of path/name strings for original files for the Image""" 
297   
298   
299  urlpatterns = patterns('', 
300      webgateway, 
301      render_image, 
302      render_image_region, 
303      render_split_channel, 
304      render_row_plot, 
305      render_col_plot, 
306      render_roi_thumbnail, 
307      render_shape_thumbnail, 
308      render_thumbnail, 
309      render_birds_eye_view, 
310      render_ome_tiff, 
311      render_movie, 
312      # Template views 
313      test, 
314      # JSON methods 
315      listProjects_json, 
316      projectDetail_json, 
317      listDatasets_json, 
318      datasetDetail_json, 
319      webgateway_listimages_json, 
320      webgateway_listwellimages_json, 
321      webgateway_plategrid_json, 
322      imageData_json, 
323      wellData_json, 
324      webgateway_search_json, 
325      get_rois_json, 
326      get_shape_json, 
327      # image viewer 
328      full_viewer, 
329      # rendering def methods 
330      save_image_rdef_json, 
331      reset_image_rdef_json, 
332      list_compatible_imgs_json, 
333      copy_image_rdef_json, 
334      # download archived_files 
335      archived_files, 
336      original_file_paths, 
337      # switch user 
338      webgateway_su, 
339      # bulk annotations 
340      annotations, 
341      table_query, 
342      object_table_query, 
343   
344      # Debug stuff 
345   
346  ) 
347