def insert_stack(self): s = Stack() s.title = "Example Stack" s.image_base = "http://incf.ini.uzh.ch/image-stack-fib/" s.trakem2_project = False s.dimension = Integer3D(x=2048, y=1536, z=460) s.resolution = Double3D(x=5.0001, y=5.0002, z=9.0003) s.num_zoom_levels = -1 s.file_extension = 'jpg' s.tile_width = 256 s.tile_height = 256 s.tile_source_type = 1 s.save() return s
def insert_stack(self): s = Stack() s.title = "Example Stack" s.dimension = Integer3D(x=2048, y=1536, z=460) s.resolution = Double3D(x=5.0001, y=5.0002, z=9.0003) s.save() sm = StackMirror() sm.stack = s sm.image_base = "http://incf.ini.uzh.ch/image-stack-fib/" sm.file_extension = 'jpg' sm.tile_width = 256 sm.tile_height = 256 sm.tile_source_type = 1 sm.save() return s
def handle(self, *args, **options): if not options['user_id']: raise CommandError("You must specify a user ID with --user") user = User.objects.get(pk=options['user_id']) projects: Dict[str, Dict] = { 'Default Project': { 'stacks': [] }, 'Evaluation data set': { 'stacks': [] }, 'Focussed Ion Beam (FIB)': { 'stacks': [] }, } # Define the details of a stack for two of these projects: projects['Default Project']['stacks'].append({ 'title': 'Original data.', 'dimension': Integer3D(4096, 4096, 16), 'resolution': Double3D(3.2614000000000001, 3.2614000000000001, 60), 'comment': '''<p>©2007 by Stephan Saalfeld.</p> <p>Rendered with <a href="http://www.povray.org/">POV-Ray v3.6</a> using this <a href="http://fly.mpi-cbg.de/~saalfeld/download/volume.tar.bz2">scene-file</a>.</p>''', 'mirrors': [{ 'title': 'Public copy', 'image_base': 'http://fly.mpi-cbg.de/map/evaluation/original/', }] }) projects['Focussed Ion Beam (FIB)']['stacks'].append({ 'title': 'Focussed Ion Beam (FIB) stack of Rat Striatum', 'dimension': Integer3D(2048, 1536, 460), 'resolution': Double3D(5, 5, 9), 'comment': ''' <p>©2009 <a href="http://people.epfl.ch/graham.knott">Graham Knott</a>.</p> <p>Public INCF data set available at the <a href="http://www.incf.org/about/nodes/switzerland/data">Swiss INCF Node</a>.</p>''', 'mirrors': [{ 'title': 'FIB Public copy', 'image_base': 'http://incf.ini.uzh.ch/image-stack-fib/', }] }) # Make sure that each project and its stacks exist, and are # linked via ProjectStack: for project_title in projects: project_object, _ = Project.objects.get_or_create( title=project_title) for stack_dict in projects[project_title]['stacks']: stack, _ = Stack.objects.get_or_create( title=stack_dict['title'], defaults={ 'dimension': stack_dict['dimension'], 'resolution': stack_dict['resolution'], }) mirrors = list(StackMirror.objects.filter(stack=stack)) if not mirrors: for m in stack_dict['mirrors']: mirrors.append( StackMirror.objects.create( stack=stack, title=m['title'], image_base=m['image_base'])) ProjectStack.objects.get_or_create(project=project_object, stack=stack) projects[project_title]['project_object'] = project_object # Also set up the FIB project for tracing with treelines: tracing_project = projects['Focussed Ion Beam (FIB)']['project_object'] call_command('catmaid_setup_tracing_for_project', '--project_id', str(tracing_project.id), '--user', str(user.id))