Neuroglancer admin
This module creates the admin interface for all the Neuroglancer tools used by the user. It lists the classes and methods used to administer the ‘Neuroglancer’ app in our database portal. This is where the end user can create, retrieve, update and delete (CRUD) metadata associated with the ‘Neuroglancer’ app. It does not list the fields (database columns). Look in the models document for the database table model.
- class neuroglancer.admin.AnnotationSessionAdmin(model, admin_site)
Bases:
AtlasAdminModel
Administer the annotation session data.
- get_queryset(request)
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- get_urls()
Shows the HTML of the links to go to the graph, and table data.
- label(obj)
- list_display = ['animal', 'open_neuroglancer', 'annotator', 'label', 'show_points', 'annotation_type', 'created', 'updated']
- list_filter = ['annotation_type', 'created', 'updated']
- property media
- open_neuroglancer(obj)
This method creates an HTML link that allows the user to access Neuroglancer
- ordering = ['animal', 'annotation_type', 'created', 'annotator']
- search_fields = ['animal__prep_id', 'annotation_type', 'annotator__first_name']
- show_points(obj)
Shows the HTML for the link to the graph of data.
- view_points_in_session(request, id, *args, **kwargs)
Provides the HTML link to the table data
- class neuroglancer.admin.ArchiveSetAdmin(model, admin_site)
Bases:
AtlasAdminModel
Class that provides admin capability for managing a region of the brain. This was also called a structure.
- actions = [<function restore_archive>]
- fields = ['annotation_session', 'created']
- get_animal(obj)
- get_annotation_type(obj)
- get_name(obj)
- get_queryset(request)
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- has_add_permission(request, obj=None)
Returns false as the data is readonly
- has_change_permission(request, obj=None)
Returns false as the data is readonly
- has_delete_permission(request, obj=None)
Returns false as the data is readonly
- list_display = ('get_animal', 'get_name', 'get_annotation_type', 'created')
- list_filter = ['created', 'annotation_session__annotation_type']
- property media
- ordering = ['annotation_session__animal__prep_id']
- search_fields = ['annotation_session__animal__prep_id']
- class neuroglancer.admin.BrainRegionAdmin(model, admin_site)
Bases:
AtlasAdminModel
,ExportCsvMixin
Class that provides admin capability for managing a region of the brain. This was also called a structure.
- created_display(obj)
Formats the date nicely.
- list_display = ('abbreviation', 'description', 'active', 'created_display')
- list_filter = ['created', 'active']
- property media
- ordering = ['abbreviation']
- readonly_fields = ['created']
- search_fields = ['abbreviation', 'description']
- class neuroglancer.admin.CellTypeAdmin(model, admin_site)
Bases:
AtlasAdminModel
,ExportCsvMixin
“This class administers the different type of cells.
- created_display(obj)
Formats the date nicely.
- list_display = ('cell_type', 'description', 'active')
- list_filter = ['created', 'active']
- property media
- ordering = ['cell_type']
- readonly_fields = ['created']
- search_fields = ['cell_type', 'description']
- class neuroglancer.admin.CompletedTaskAdmin(model, admin_site)
Bases:
ModelAdmin
This class is used to admin the completed tasks. These are tasks that are long running and take to long for an HTTP request. They get sent to the supervisord daemon to be run outside the scope of the HTTP request.
- display_filter = ['task_name']
- has_add_permission(request)
Returns false as it is added by another process.
- has_change_permission(request, obj=None)
Returns false as it is added by another process.
- list_display = ['task_name', 'run_at', 'attempts', 'has_error', 'creator']
- list_filter = ['run_at']
- property media
- class neuroglancer.admin.MarkedCellWorkflowAdmin(model, admin_site)
Bases:
ModelAdmin
This class provides the ability to manage the data entered through Neuroglancer. These are points are entered by an anatomist and are solely for marked cells (premotor, starter etc)
- change_list_template = 'markedcell_change_list.html'
- changelist_view(request, extra_context=None)
The ‘change list’ admin view for this model.
- drilldown_link(obj)
- has_add_permission(request, obj=None)
Returns false as this data is just a report
- has_change_permission(request, obj=None)
Returns false as it is just a report.
- has_delete_permission(request, obj=None)
Returns false as it is just a report.
- list_filter = ('cell_type', 'annotation_session__created', 'annotation_session__updated')
- marked_cells(obj)
- property media
- search_fields = ['annotation_session__animal__prep_id', 'annotation_session__annotator__username']
- class neuroglancer.admin.PointsAdmin(model, admin_site)
Bases:
ModelAdmin
This class may become deprecated, but for now it gets point data from the actual JSON and not the 3 new tables we have that contain x,y,z data.
- created_display(obj)
Returns a nicely formatted creation date.
- get_queryset(request)
Returns the query set of points where the layer contains annotations
- get_urls()
Shows the HTML of the links to go to the graph, and table data.
- has_add_permission(request, obj=None)
Returns false as the data is readonly
- has_change_permission(request, obj=None)
Returns false as the data is readonly
- has_delete_permission(request, obj=None)
Returns false as the data is readonly
- list_display = ('animal', 'comments', 'owner', 'show_points', 'updated')
- list_filter = ['created', 'updated', 'readonly']
- property media
- ordering = ['-created']
- readonly_fields = ['url', 'created', 'user_date', 'updated']
- search_fields = ['comments']
- show_points(obj)
Shows the HTML for the link to the graph of data.
- view_points_3Dgraph(request, id, *args, **kwargs)
Provides a link to the 3D point graph
- Parameters
request – http request
id – id of url
args –
kwargs –
- Returns
3dGraph in a django template
- view_points_data(request, id, *args, **kwargs)
Provides the HTML link to the table data
- class neuroglancer.admin.StructureComAdmin(model, admin_site)
Bases:
ModelAdmin
This class provides the ability to manage the data entered through Neuroglancer. These are points are entered by an anatomist and are solely for the center of mass (COM) for a brain region (structure)
- get_queryset(request)
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- get_urls()
Shows the HTML of the links to go to the graph, and table data.
- list_display = ('animal', 'annotator', 'created', 'show_com', 'source')
- property media
- ordering = ('annotation_session__animal__prep_id', 'annotation_session__annotator__username', 'annotation_session__brain_region__abbreviation', 'source')
- search_fields = ('annotation_session__animal__prep_id', 'annotation_session__annotator__username', 'annotation_session__brain_region__abbreviation', 'source')
- show_com(obj)
Shows the HTML for the link to the graph of data.
- view_coms(request, id, *args, **kwargs)
Provides the HTML link to the table data
- class neuroglancer.admin.TaskAdmin(model, admin_site)
Bases:
ModelAdmin
This admin class is for taking care of the tasks associated with the pre-processing
- display_filter = ['task_name']
- has_add_permission(request, obj=None)
Returns false as this data comes in from the pre-processing
- list_display = ['task_name', 'run_at', 'priority', 'attempts', 'has_error', 'locked_by', 'locked_by_pid_running', 'creator']
- property media
- search_fields = ['task_name', 'task_params']
- class neuroglancer.admin.UrlModelAdmin(model, admin_site)
Bases:
ModelAdmin
This class provides the admin backend to the JSON data produced by Neuroglancer. In the original version of Neuroglancer, all the data was stored in the URL, hence the name of this class. The name: ‘UrlModel’ will be changed in future versions.
- exclude = ['url']
- formfield_overrides = {<class 'django.db.models.fields.CharField'>: {'widget': <django.forms.widgets.TextInput object>}}
- has_add_permission(request, obj=None)
Returns false as the data is only added via Neuroglancer
- list_display = ('animal', 'open_neuroglancer', 'open_multiuser', 'owner', 'created')
- list_filter = ['updated', 'created', 'readonly', <class 'neuroglancer.url_filter.UrlFilter'>]
- property media
- open_multiuser(obj)
This method creates an HTML link that allows the user to access Neuroglancer in multi user mode.
- open_neuroglancer(obj)
This method creates an HTML link that allows the user to access Neuroglancer
- ordering = ['-readonly', '-updated']
- pretty_url(instance)
Function to display pretty version of the JSON data. It uses the pygments library to make the JSON readable.
- Parameters
instance – admin obj
- Returns
nicely formatted JSON data that is viewed in the page.
- readonly_fields = ['animal', 'pretty_url', 'created', 'user_date', 'updated']
- search_fields = ['comments']
- neuroglancer.admin.datetime_format(dtime)
A method to return a nicely formatted date and time.
- neuroglancer.admin.delete_session(modeladmin, request, queryset)
- neuroglancer.admin.get_points_in_session(id)
Shows how many points are in data.
- neuroglancer.admin.make_active(modeladmin, request, queryset)
A method to set any object active
- Parameters
request – HTTP request.
queryset – set of querys used to update.
- neuroglancer.admin.make_inactive(modeladmin, request, queryset)
A method to set any object inactive
- Parameters
request – HTTP request.
queryset – set of querys used to update.
- neuroglancer.admin.restore_archive(modeladmin, request, queryset)
This method will restore data from the annotation_points_archive table to the annotations_points table.
Set existing data to inactive (quick)
Move inactive data to archive (select, insert, slow, use background)
Move archived data to existing (select, insert, slow use background)
- Parameters
request – the HTTP request
queryset – the query set used to fetch data