schlegelp / catmaid-to-blender Goto Github PK
View Code? Open in Web Editor NEWPlugin for Blender to interface with CATMAID Server and Pull Data
License: GNU General Public License v3.0
Plugin for Blender to interface with CATMAID Server and Pull Data
License: GNU General Public License v3.0
Show additional options only upon changing dropdown/ticking a box. See this example using check()
:
import bpy
def main(context):
for ob in context.scene.objects:
print(ob)
class SimplePanel(bpy.types.Panel):
"""Creates Import Menu in Properties -> Scene """
bl_label = "Test"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
def draw(self, context):
layout = self.layout
row = layout.row(align=True)
row.alignment = 'EXPAND'
row.operator("object.simple_operator", text = "Run", icon ='VISIBLE_IPO_ON')
class SimpleOperator(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.simple_operator"
bl_label = "Simple Object Operator"
bl_options = {'REGISTER', 'UNDO'}
val1 = bpy.props.BoolProperty()
val2 = bpy.props.BoolProperty()
val3 = bpy.props.BoolProperty()
@classmethod
def poll(cls, context):
"""If this returns False, operator is greyed-out."""
return context.selected_objects != []
def check(self, context):
"""While this returns True, draw() is called continuously."""
return True
def execute(self, context):
main(context)
return {'FINISHED'}
def draw(self, context):
layout = self.layout
layout.prop(self, "val1")
if self.val1:
box = layout.box()
box.prop(self, "val2")
box.prop(self, "val3")
def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self, width = 800)
def register():
bpy.utils.register_class(SimpleOperator)
bpy.utils.register_class(SimplePanel)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
bpy.utils.unregister_class(SimplePanel)
if __name__ == "__main__":
register()
Add function to export meshes from Blender directly to CATMAID
The current code is hard coded to work only with pid=1.
The script should be updated either to have pid as a variable (similar to server_url), or, better yet, to query the server for projects visible to the user.
Hi,
I noticed that if you change the radii of the nodes of a skeleton in Catmaid, the add-on does not import the skeletons using those radii. Would it be possible to add a feature that could do that? Also, I was wondering if it is possible to import skeletons with strahler analysis shading so main branches are brighter and more distal branches are darker or more transparent
Thanks,
Ben Gorko
I am attempting to colorize neurons imported from CATMAID by their respective annotations but it is colorizing everything in the 3D space to the single color selected within this feature. Let me just walk through my process to better help you understand what I mean.
I first import by annotation i.e "KCaBp"
This loads in about 10 neuron skeletons.
Then I use the color by annotations feature to color any "KCaBp" brown and leave the exclude box blank.
This works fine, every KCaBp changes to brown.
I again import by annotation but this time "KCy"
This loads in around 65 neuron skeletons.
Then I attempt to use the color by annotations feature again but color the "KCy" cyan.
(I attempted to use and disregard the exclude box as an experiment since the color by annotations feature was causing me trouble.)
When I did use the exclude box I typed in "KCaBp" so that it would not change the color of the KCaBp neurons to cyan, leaving them brown.
However, this would change everything in the 3D space to cyan (both KCy and KCaBp).
Hi Phillip -
When attempting to pull in neurons by annonation or skeleton ID I receive the following errors.
I am installing Blender on a new computer so I downloaded the Catmaid-to-Blender import addon and was able to connect without a problem. However, I am still unable to retrieve any neurons. If you could help me to understand what may be going wrong, I would greatly appreciate it.
Thank you
Hey Philipp - I'm new to Blender and am trying to have a play with your excellent tools here. When I try to create an SVG for a single selected neuron using 'export connectors' tool with the same settings you have in your example on GitHub to get a neuron with a bar chart and coloured postsynapses, I do not get a 'valid' SVG. When I try to open it in Chrome, I get this complaint:
"This page contains the following errors:
error on line 5037 at column 6: Opening and ending tag mismatch: svg line 0 and g
Below is a rendering of the page up to the first error."
And then a small image of the neuron and its bar charts, which looks incomplete. However, the output in the terminal seems fine. I can successfully export an SVG using the export morphology option.
Any idea where I am going wrong?
Thank you!
Generate URL to CATMAID stack of current cursor position
Using the plugin requires numpy to be installed. It would be nice to mention this in the installation notes.
I'm looking to import all non-zero length skeletons from Seymour, on MacOS. I figured I'd be able to do so by just specify minimum length as 1, and leaving everything else blank. trying that gives the following:
Python: Traceback (most recent call last):
File "/Users/swilson/Library/Application Support/Blender/3.6/scripts/addons/CATMAIDImport.py", line 421, in execute
neuron_names = client.get_names(skeletons_to_retrieve)
File "/Users/swilson/Library/Application Support/Blender/3.6/scripts/addons/CATMAIDImport.py", line 1713, in get_names
return self.fetch(url, post=post)
File "/Users/swilson/Library/Application Support/Blender/3.6/scripts/addons/CATMAIDImport.py", line 1526, in fetch
raise HTTPError('{} errors encountered: {}'.format(len(errors),
requests.exceptions.HTTPError: 1 errors encountered: 500 Server Error: 'NoneType' object is not iterable for url: https://neurophyla.mrc-lmb.cam.ac.uk/catmaid/drosophila/l1/seymour/1/skeleton/neuronnames
Note that this same error appears regardless of the minimum size threshold or any downsampling values tested. Importing neurons via annotations or names is no problem - is it the case that you cannot leave both of these empty?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.