Created
February 22, 2011 14:00
-
-
Save mhl/838695 to your computer and use it in GitHub Desktop.
In Fiji display SWC files in the 3D Viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
from java.awt import Color | |
from ij3d import Image3DUniverse | |
univ = Image3DUniverse(512, 512) | |
univ.show() | |
# d = '/home/mark/painting-demo/static/data' | |
d = '/home/mark/tracing-examples/' | |
swc_files = [ os.path.join(d,x) for x in os.listdir(d) if re.search('(?i)\.swc',x) ] | |
# Just take the first 3 largest files: | |
swc_files.sort( key=os.path.getsize, reverse=True ) | |
swc_files[-3:len(swc_files)] | |
from tracing import PathAndFillManager | |
pafm = PathAndFillManager(500, # width | |
500, # height | |
50, # depth | |
1, # x spacing | |
1, # y spacing | |
1, # z spacing | |
"micrometres") | |
for swc_file in swc_files: | |
if not pafm.importSWC(swc_file,False): # second parameter is ignoreCalibration | |
IJ.error("Failed to load: "+swc_file) | |
for i in range(pafm.size()): | |
path = pafm.getPath(i) | |
path.addTo3DViewer(univ, Color.blue, None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment