예제 #1
0
cols = [[ 0.        ,  0.        ,  0.5       ],
        [ 0.        ,  0.00196078,  1.        ],
        [ 0.        ,  0.50392157,  1.        ],
        [ 0.08538899,  1.        ,  0.88235294],
        [ 0.49019608,  1.        ,  0.47754586],
        [ 0.89500316,  1.        ,  0.07273877],
        [ 1.        ,  0.58169935,  0.        ],
        [ 1.        ,  0.11692084,  0.        ]]

nrnsBlender = []
matchOrigin = False


for nrnInd, nrn in enumerate(swcs):

    if nrnInd == 0:
        add = False
    else:
        add = True

    tmpB = BlenderSWCImporter(nrn, add, matchOrigin, colMap=cols)

    # tmpB.importSWC(cols[nrnInd])

    tmpB.importWholeSWC()

    nrnsBlender.append(tmpB)



예제 #2
0
import sys
sys.path.append('/home/ajay/repos/GJEMS/GJEMS/morph')

from blenderHelper import BlenderSWCImporter


print(sys.argv)
assert len(sys.argv) == 5, \
    'This script takes only 5 arguments, with the path of the swcfile expected as the 5th arguement, but ' \
        + str(len(sys.argv)) + ' found'
swcFName = sys.argv[4]

abc = BlenderSWCImporter(swcFName, matchRootOrigin=False)
abc.importWholeSWC()
예제 #3
0
    if nrnInd == 0:
        add = False
    else:
        add = True

    # tmpB = BlenderSWCImporter(nrn, add, matchOrigin, colMap=cols)
    # tmpB.importWholeSWC()

    # matchOrigin = True

    sswcMaterials = []
    for scolInd, scol in enumerate(Scols):
        mat = bpy.data.materials.new("Material {}".format(scolInd))
        mat.use_transparency = True
        mat.diffuse_color = scol
        mat.diffuse_intensity = 1.0
        mat.alpha = alphas[scolInd]
        mat.emit = emits[scolInd]
        sswcMaterials.append(mat)

    tmpB = BlenderSWCImporter(os.path.abspath(nrn),
                              add,
                              matchOrigin,
                              sswcMaterials=sswcMaterials,
                              restrictRadiusTo=0.00001)
    tmpB.importWholeSWC(col=cols[nrnInd])

    nrnsBlender.append(tmpB)

# tmpB.addSphere(position=[0, 0, 0], col=[1, 0, 0], radius=2)
예제 #4
0
# ----------------------------------------------------------------------------------------------------------------------
nrnsBlender = []
matchOrigin = False
scaleDownBy = 1
restrictRadiusTo = 0

for nrnInd, nrn in enumerate(swcs):

    if nrnInd == 0:
        add = False
    else:
        add = True

    # tmpB = BlenderSWCImporter(nrn, add, matchOrigin, colMap=cols)
    # tmpB.importWholeSWC()

    # matchOrigin = True

    tmpB = BlenderSWCImporter(os.path.abspath(nrn),
                              add,
                              matchOrigin,
                              colMap=Scols,
                              scaleDownBy=scaleDownBy,
                              restrictRadiusTo=restrictRadiusTo)
    tmpB.importWholeSWC(col=cols[nrnInd])

    nrnsBlender.append(tmpB)

# tmpB.addSphere(position=[0, 0, 0], col=[1, 0, 0], radius=2)
for nrnInd, nrn in enumerate(swcs):

    if nrnInd == 0:
        add = False
    else:
        add = True

    # tmpB = BlenderSWCImporter(nrn, add, matchOrigin, colMap=cols)
    # tmpB.importWholeSWC()

    # matchOrigin = True

    sswcMaterials = []
    for scolInd, scol in enumerate(Scols):
        mat = bpy.data.materials.new("Material {}".format(scolInd))
        mat.use_transparency = True
        mat.diffuse_color = scol
        mat.diffuse_intensity = 1.0
        mat.alpha = alphas[scolInd]
        mat.emit = emits[scolInd]
        sswcMaterials.append(mat)

    tmpB = BlenderSWCImporter(os.path.abspath(nrn), add, matchOrigin, sswcMaterials=sswcMaterials)
    tmpB.importWholeSWC(col=cols[nrnInd])

    nrnsBlender.append(tmpB)




예제 #6
0
    if nrnInd == 0:
        add = False
    else:
        add = True

    # tmpB = BlenderSWCImporter(nrn, add, matchOrigin, colMap=cols)
    # tmpB.importWholeSWC()

    # matchOrigin = True

    sswcMaterials = []
    for scolInd, scol in enumerate(Scols):
        mat = bpy.data.materials.new("Material {}".format(scolInd))
        mat.use_transparency = True
        mat.diffuse_color = scol
        mat.diffuse_intensity = 1.0
        mat.alpha = alphas[scolInd]
        mat.emit = emits[scolInd]
        sswcMaterials.append(mat)

    tmpB = BlenderSWCImporter(os.path.abspath(nrn),
                              add,
                              matchOrigin,
                              sswcMaterials=sswcMaterials)
    tmpB.importWholeSWC(col=cols[nrnInd])

    nrnsBlender.append(tmpB)

# tmpB.addSphere(position=[0, 0, 0], col=[1, 0, 0], radius=2)
예제 #7
0
    # 'swcFiles/GoodSamplesDLInt1_v2/newlyEmerged/HB130523-3NS_3ptSoma_USTD.swc',
    # 'swcFiles/GoodSamplesDLInt1_v2/newlyEmerged/HB130605-1NS_3ptSoma_USTD.swc',
    # 'swcFiles/GoodSamplesDLInt1_v2/newlyEmerged/HB130605-2NS_3ptSoma_USTD.swc',

    # 'swcFiles/GoodSamplesDLInt1_v2/newlyEmerged/HB130523-3NS_3ptSoma.swc',
    # 'swcFiles/GoodSamplesDLInt1_v2/newlyEmerged/HB130605-1NS_3ptSoma.swc',
]

cols = [[0., 0., 0.5], [0., 0.00196078, 1.], [0., 0.50392157, 1.],
        [0.08538899, 1., 0.88235294], [0.49019608, 1., 0.47754586],
        [0.89500316, 1., 0.07273877], [1., 0.58169935, 0.],
        [1., 0.11692084, 0.]]

nrnsBlender = []
matchOrigin = False

for nrnInd, nrn in enumerate(swcs):

    if nrnInd == 0:
        add = False
    else:
        add = True

    tmpB = BlenderSWCImporter(nrn, add, matchOrigin, colMap=cols)

    # tmpB.importSWC(cols[nrnInd])

    tmpB.importWholeSWC()

    nrnsBlender.append(tmpB)
예제 #8
0
import sys
sys.path.append('/home/aj/repos/BlenderSWCVizualizer')

from blenderHelper import BlenderSWCImporter

print(sys.argv)
assert len(sys.argv) == 5, \
    'This script takes only 5 arguments, with the path of the swcfile expected as the 5th arguement, but ' \
        + str(len(sys.argv)) + ' found'
swcFName = sys.argv[4]

abc = BlenderSWCImporter(swcFName, matchRootOrigin=False)
abc.importWholeSWC([0, 0, 1])
from blenderHelper import BlenderSWCImporter

print(sys.argv)
assert len(sys.argv) == 5, \
    'This script takes only 5 arguments, with the path of the swcfile expected as the 5th arguement, but ' \
        + str(len(sys.argv)) + ' found'
swcFName = sys.argv[4]

swcName = swcFName.rstrip('.swc')
ptSoma = False
if swcName[-8:] == '_3ptSoma':
    ptSoma = True
    swcName = swcName[:-8]

# partLabels = ['_AZ', '_DB', '_VB']
partLabels = ['-AZ', '-DB', '-VB']
cols = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
shouldAdd = False
blenderNrns = []

for partLabel, col in zip(partLabels, cols):

    if not ptSoma:
        partName = swcName + partLabel + '.swc'
    else:
        partName = swcName + partLabel + '_3ptSoma.swc'
    nrn = BlenderSWCImporter(partName, add=shouldAdd, matchRootOrigin=False)
    shouldAdd = True
    blenderNrns.append(nrn)
    nrn.importWholeSWC(col)
예제 #10
0
import sys
sys.path.append('/home/ajay/repos/GJEMS/GJEMS/morph')

from blenderHelper import BlenderSWCImporter

print(sys.argv)
assert len(sys.argv) == 5, \
    'This script takes only 5 arguments, with the path of the swcfile expected as the 5th arguement, but ' \
        + str(len(sys.argv)) + ' found'
swcFName = sys.argv[4]

abc = BlenderSWCImporter(swcFName, matchRootOrigin=False)
abc.importWholeSWC()
assert len(sys.argv) == 5, \
    'This script takes only 5 arguments, with the path of the swcfile expected as the 5th arguement, but ' \
        + str(len(sys.argv)) + ' found'
swcFName = sys.argv[4]


swcName = swcFName.rstrip('.swc')
ptSoma = False
if swcName[-8:] == '_3ptSoma':
    ptSoma = True
    swcName = swcName[:-8]

# partLabels = ['_AZ', '_DB', '_VB']
partLabels = ['-AZ', '-DB', '-VB']
cols = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
shouldAdd = False
blenderNrns = []

for partLabel, col in zip(partLabels, cols):

    if not ptSoma:
        partName = swcName + partLabel + '.swc'
    else:
        partName = swcName + partLabel + '_3ptSoma.swc'
    nrn = BlenderSWCImporter(partName, add=shouldAdd, matchRootOrigin=False)
    shouldAdd = True
    blenderNrns.append(nrn)
    nrn.importWholeSWC(col)


예제 #12
0
파일: vizSSWC.py 프로젝트: asobolev/GJEMS
import sys
sys.path.append('/home/ajay/repos/GJEMS/GJEMS/morph')

from blenderHelper import BlenderSWCImporter
import numpy as np

print(sys.argv)
assert len(sys.argv) == 5, \
    'This script takes only 5 arguments, with the path of the swcfile expected as the 5th arguement, but ' \
    + str(len(sys.argv)) + ' found'
sswcFName = sys.argv[4]

cols = np.asarray([[0., 0., 0.5], [0., 0.00196078, 1.], [0., 0.50392157, 1.],
                   [0.08538899, 1., 0.88235294], [0.49019608, 1., 0.47754586],
                   [0.89500316, 1., 0.07273877], [1., 0.58169935, 0.],
                   [1., 0.11692084, 0.]])

blenderObj = BlenderSWCImporter(sswcFName, colMap=cols, matchRootOrigin=False)
blenderObj.importWholeSWC()
예제 #13
0
# ---------------------------Emit values of SSWC Materials--------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------
emits = [1 for x in range(nPts)]
# ----------------------------------------------------------------------------------------------------------------------
# --------------------------Alpha values of SSWC Materials--------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------
alphas = [1 for x in range(nPts)]
# alphas = [1, 1, 1, 0.5, 0.5, 1, 1, 1]
# ----------------------------------------------------------------------------------------------------------------------

if nPts % len(baseCols) > 0:
    raise(ValueError('nPts must be a integral multiple of ' + str(len(baseCols))))

cols = np.zeros([nPts, 3])
scaleFactor = int(nPts / len(baseCols))

for ind in range(3):
    cols[:, ind] = np.interp(range(nPts), range(0, nPts, scaleFactor), baseCols[:, ind])

sswcMaterials = []
for scolInd, scol in enumerate(cols):
    mat = bpy.data.materials.new("Material {}".format(scolInd))
    mat.use_transparency = True
    mat.diffuse_color = scol
    mat.diffuse_intensity = 1.0
    mat.alpha = alphas[scolInd]
    mat.emit = emits[scolInd]
    sswcMaterials.append(mat)

blenderObj = BlenderSWCImporter(sswcFName, sswcMaterials=sswcMaterials, matchRootOrigin=False)
blenderObj.importWholeSWC()