1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 import warnings
17 import Numeric, math, types
18 from mglutil.math.rotax import rotax
19
20 from NetworkEditor.items import NetworkNode
21 from NetworkEditor.macros import MacroNode
22 from Vision import UserLibBuild
23
24 from symserv.symOperators import SymNFold, SymTrans, SymTransXYZ, SymRot,\
25 SymHelix, SymMerge, SymMultiply, SymSplit, CenterOfMass, SymOrient,\
26 ApplyTransfToCoords, PDBtoMatrix, SymScale, SymTranspose,SymInverse,\
27 DistanceBetweenTwoPoints
28
29 from symserv.VisionInterface.SymservWidgets import NEXYZVectGUI
30
31
33 """turns a list of lists of 4x4 matrices into a list of 4x4 matrices.
34 This is used to remove the additional list created because all instanceMatrices
35 input ports of the nodes in thei file are NOT singleConnection by default.
36 """
37 if matricesList is None:
38 return None
39
40
41 if len(matricesList) and type(matricesList[0])!=types.ListType:
42 return matricesList
43
44 mats = []
45 for m in matricesList:
46 mats.extend(m)
47
48 return mats
49
51 try:
52 ed = net.getEditor()
53 from MolKit.VisionInterface.MolKitNodes import molkitlib
54 ed.addLibraryInstance(
55 molkitlib, 'MolKit.VisionInterface.MolKitNodes', 'molkitlib')
56 except:
57 warnings.warn(
58 'Warning! Could not import molitlib from MolKit.VisionInterface')
59
60
62 try:
63 ed = net.getEditor()
64 from DejaVu.VisionInterface.DejaVuNodes import vizlib
65 ed.addLibraryInstance(
66 vizlib, 'DejaVu.VisionInterface.DejaVuNodes', 'vizlib')
67 except:
68 warnings.warn(
69 'Warning! Could not import vizlib from DejaVu/VisionInterface')
70
71
73 """Create a stream of transformation set to identity"""
74
75 - def __init__(self, name='Identity', symmetry=1, **kw):
76 kw['name']=name
77 kw['symmetry'] = symmetry
78 apply( NetworkNode.__init__, (self,), kw)
79
80 self.widgetDescr['copies'] = {
81 'class':'NEThumbWheel', 'width':100, 'height':26, 'wheelPad':4,
82 'oneTurn':10, 'precision':3, 'increment':1, 'type':'int', 'min':1,
83 'lockBMin':0,'lockType':1,'lockIncrement':1,
84 'lockBIncrement':1, 'lockMin':1, 'master':'node',
85 'initValue':1.0,
86 'labelCfg':{'text':'# copies'},
87 'widgetGridCfg':{'labelSide':'top'},
88 }
89
90 ip = self.inputPortsDescr
91 ip.append(datatype='int', name='copies')
92
93 op = self.outputPortsDescr
94 op.append(datatype='instancemat(0)', name='outMatrices')
95
96 code = """def doit(self, copies):
97 result = []
98 for i in xrange(copies):
99 result.append(Numeric.identity(4, 'f'))
100 self.outputData(outMatrices=result)
101 """
102
103 if code: self.setFunction(code)
104
105 from mglutil.math.rotax import rotVectToVect
106
108 """Create a stream of rotations that align 3D vectors"""
109
110 - def __init__(self, name='Vect2Vect', symmetry=1, **kw):
111 kw['name']=name
112 kw['symmetry'] = symmetry
113 apply( NetworkNode.__init__, (self,), kw)
114
115 ip = self.inputPortsDescr
116 ip.append(datatype='None', name='vect1')
117 ip.append(datatype='None', name='vect2')
118
119 op = self.outputPortsDescr
120 op.append(datatype='instancemat(0)', name='outMatrices')
121
122 code = """def doit(self, vect1, vect2):
123 from math import sqrt
124 try:
125 vect1[0][0]
126 vect1_1D=False
127 except:
128 vect1_1D=True
129 try:
130 vect2[0][0]
131 vect2_1D=False
132 except:
133 vect2_1D=True
134
135 if vect1_1D+vect2_1D == 1:
136 if vect1_1D:
137 vect1 = list([vect1])*len(vect2)
138 else:
139 vect2 = list([vect2])*len(vect1)
140
141 if not (vect1_1D or vect2_1D):
142 assert len(vect1[0])==3
143 assert len(vect2[0])==3
144 result = []
145 for i in xrange(len(vect1)):
146 v1 = vect1[i]
147 v2 = vect2[i]
148 n1 = 1.0/sqrt(v1[0]*v1[0] + v1[1]*v1[1] + v1[2]*v1[2])
149 n2 = 1.0/sqrt(v2[0]*v2[0] + v2[1]*v2[1] + v2[2]*v2[2])
150 v1 = (v1[0]*n1, v1[1]*n1, v1[2]*n1)
151 v2 = (v2[0]*n2, v2[1]*n2, v2[2]*n2)
152 result.append( Numeric.array( rotVectToVect(v1, v2), 'f') )
153 else:
154 v1 = vect1
155 v2 = vect2
156 n1 = 1.0/sqrt(v1[0]*v1[0] + v1[1]*v1[1] + v1[2]*v1[2])
157 n2 = 1.0/sqrt(v2[0]*v2[0] + v2[1]*v2[1] + v2[2]*v2[2])
158 v1 = (v1[0]*n1, v1[1]*n1, v1[2]*n1)
159 v2 = (v2[0]*n2, v2[1]*n2, v2[2]*n2)
160 result = [Numeric.array( rotVectToVect(v1, v2 ), 'f')]
161 self.outputData(outMatrices=result)
162 """
163
164 if code: self.setFunction(code)
165
166
168 """To be subclassed"""
169
170 - def __init__(self, name='Prototype', symmetry=1, **kw):
171 kw['name']=name
172 kw['symmetry'] = symmetry
173 apply( NetworkNode.__init__, (self,), kw)
174
175 self.operator = SymNFold( (1,0,0), (0,0,0), symmetry, 1 )
176
177 code = """def doit(self, matrices=None, vector=None, point=None, \
178 identity=None):
179
180 matrices = ToList(matrices)
181 self.operator.set(vector=vector, point=point, symmetry=%d,
182 identity=identity)
183 result = self.operator(matrices)
184 self.outputData(outMatrices=result)\n"""%symmetry
185
186 if code: self.setFunction(code)
187
188 self.widgetDescr['vector'] = {
189 'class':'NEVectorGUI',
190 'size':100, 'continuous':1,'mode':'XY',
191 'labelGridCfg':{'columnspan':2},
192 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
193 'labelCfg':{'text':str(symmetry)+'-fold vector'},
194 'initialValue':[1.,0,0]}
195
196
197 self.widgetDescr['point'] = {
198 'class':'NEVectEntry',
199 'labelGridCfg':{'columnspan':2},
200 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
201 'labelCfg':{'text':'Point'},
202 'initialValue':[0., 0., 0.],
203 }
204
205 self.widgetDescr['identity'] = {
206 'class':'NECheckButton',
207 'initialValue':1,
208 'labelGridCfg':{'sticky':'we'},
209 'labelCfg':{'text':'Identity'},
210 }
211
212 ip = self.inputPortsDescr
213 ip.append(datatype='instancemat(0)', required=False,
214 singleConnection=False, name='matrices')
215 ip.append(datatype='None', required=False, name='vector')
216 ip.append(datatype='None', required=False, name='point')
217 ip.append(datatype='int', required=False, name='identity')
218
219 op = self.outputPortsDescr
220 op.append(datatype='instancemat(0)', name='outMatrices')
221
222
224 """Apply a 2-fold symmetry to an incoming stream of 4x4 matrices.
225 The node then outputs a list of 4x4 matrices, concatenated with any incoming
226 matrices.
227 The symmetry axis is controlled by a vector gui located in the node parameter
228 panel. Additionally, a center of origin can be specified as well as the number
229 of symmetries. The identity checkbutton controls whether the identity matrix
230 is added or not. """
231
232 - def __init__(self, name='Sym2Fold', **kw):
236
237
238
240 """Apply a 3-fold symmetry to an incoming stream of 4x4 matrices.
241 The node then outputs a list of 4x4 matrices, concatenated with any incoming
242 matrices.
243 The symmetry axis is controlled by a vector gui located in the node parameter
244 panel. Additionally, a center of origin can be specified as well as the number
245 of symmetries. The identity checkbutton controls whether the identity matrix
246 is added or not. """
247
248
249 - def __init__(self, name='Sym3Fold', **kw):
253
254
256 """Apply a 4-fold symmetry to an incoming stream of 4x4 matrices.
257 The node then outputs a list of 4x4 matrices, concatenated with any incoming
258 matrices.
259 The symmetry axis is controlled by a vector gui located in the node parameter
260 panel. Additionally, a center of origin can be specified as well as the number
261 of symmetries. The identity checkbutton controls whether the identity matrix
262 is added or not. """
263
264 - def __init__(self, name='Sym4Fold', **kw):
268
269
271 """Apply a 5-fold symmetry to an incoming stream of 4x4 matrices.
272 The node then outputs a list of 4x4 matrices, concatenated with any incoming
273 matrices.
274 The symmetry axis is controlled by a vector gui located in the node parameter
275 panel. Additionally, a center of origin can be specified as well as the number
276 of symmetries. The identity checkbutton controls whether the identity matrix
277 is added or not. """
278
279 - def __init__(self, name='Sym5Fold', **kw):
283
284
286 """Apply a 6-fold symmetry to an incoming stream of 4x4 matrices.
287 The node then outputs a list of 4x4 matrices, concatenated with any incoming
288 matrices.
289 The symmetry axis is controlled by a vector gui located in the node parameter
290 panel. Additionally, a center of origin can be specified as well as the number
291 of symmetries. The identity checkbutton controls whether the identity matrix
292 is added or not. """
293
294 - def __init__(self, name='Sym6Fold', **kw):
298
299
300
302 """Apply an N-fold symmetry to an incoming stream of 4x4 matrices.
303 The node then outputs a list of 4x4 matrices, concatenated with any incoming
304 matrices.
305 The symmetry axis is controlled by a vector gui located in the node parameter
306 panel. Additionally, a center of origin can be specified as well as the number
307 of symmetries. The identity checkbutton controls whether the identity matrix
308 is added or not. """
309
310 - def __init__(self, name='SymNFold', **kw):
311 kw['name']=name
312 apply( NetworkNode.__init__, (self,), kw)
313
314 self.operator = SymNFold( (1,0,0), (0,0,0), 1, 1 )
315
316 code = """def doit(self, matrices=None, vector=None, point=None,\
317 symmetry=None, identity=None):
318
319 matrices = ToList(matrices)
320 self.operator.set(vector=vector, point=point, symmetry=symmetry,
321 identity=identity)
322 result = self.operator(matrices)
323 self.outputData(outMatrices=result)\n"""
324
325 if code: self.setFunction(code)
326
327 self.widgetDescr['vector'] = {
328 'class':'NEVectorGUI',
329 'size':100, 'continuous':1,'mode':'XY',
330 'labelGridCfg':{'columnspan':2},
331 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
332 'labelCfg':{'text':'n-fold vector'},
333 'initialValue':[1.,0,0] }
334
335
336 self.widgetDescr['point'] = {
337 'class':'NEVectEntry',
338 'labelGridCfg':{'columnspan':2},
339 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
340 'labelCfg':{'text':'Point'},
341 'initialValue':[1.,0,0],
342 }
343
344 self.widgetDescr['symmetry'] = {
345 'class':'NEDial','size':100,
346 'type':'int', 'min':1, 'lockMin':1, 'lockBMin':1,
347 'lockType':1, 'oneTurn':10,
348 'initialValue':1,
349 'labelGridCfg':{'columnspan':2},
350 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
351 'labelCfg':{'text':'# symetries'},
352 }
353
354 self.widgetDescr['identity'] = {
355 'class':'NECheckButton',
356 'initialValue':1,
357 'labelCfg':{'text':'Identity'},
358 }
359
360 ip = self.inputPortsDescr
361 ip.append(datatype='instancemat(0)', required=False,
362 singleConnection=False, name='matrices')
363 ip.append(datatype='None', required=False, name='vector')
364 ip.append(datatype='None', required=False, name='point')
365 ip.append(datatype='int', required=False, name='symmetry')
366 ip.append(datatype='int', required=False, name='identity')
367
368 op = self.outputPortsDescr
369 op.append(datatype='instancemat(0)', name='outMatrices')
370
371
373 """Apply a translation to an incomming stream of 4x4 matrices.
374 The node then outputs a list of 4x4 matrices, concatenated with any incoming
375 matrices. The axis of translation is controlled by a vector gui widget and the
376 lenght of the vector by a thumbwheel widget located in the parameter panel.
377 The identity checkbutton controls whether the identity matrix is added or not.
378 """
379 - def __init__(self, name='SymTranslation', **kw):
380 kw['name']=name
381 apply( NetworkNode.__init__, (self,), kw)
382
383 self.operator = SymTrans( (1.0,0.0,0.0), 0.0, 0 )
384
385 code = """def doit(self, matrices=None, vector=None, length=None,\
386 identity=None):
387 matrices = ToList(matrices)
388 self.operator.set(vector=vector, identity=identity,length=length)
389 result = self.operator(matrices)
390 self.outputData(outMatrices=result)
391 """
392
393 if code: self.setFunction(code)
394
395 self.widgetDescr['vector'] = {
396 'class':'NEVectorGUI', 'size':100,
397 'labelGridCfg':{'columnspan':2},
398 'widgetGridCfg':{'columnspan':2,'labelSide':'top'},
399 'labelCfg':{'text':''},'continuous':1,
400 'initialValue':[1.,0,0]
401 }
402
403 self.widgetDescr['length'] = {
404 'class':'NEThumbWheel', 'width':100, 'height':26, 'wheelPad':4,
405 'oneTurn':1, 'precision':3,
406 'labelGridCfg':{'columnspan':2},
407 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
408 'labelCfg':{'text':'vector length:'},
409 }
410
411 self.widgetDescr['identity'] = {
412 'class':'NECheckButton',
413 'initialValue':0,
414 'labelCfg':{'text':'Identity'},
415 }
416
417 ip = self.inputPortsDescr
418 ip.append(datatype='instancemat(0)', required=False,
419 singleConnection=False, name='matrices')
420 ip.append(datatype='None', required=False, name='vector')
421 ip.append(datatype='None', required=False, name='length')
422 ip.append(datatype='int', required=False, name='identity')
423
424 op = self.outputPortsDescr
425 op.append(datatype='instancemat(0)', name='outMatrices')
426
427
429 """Apply a translation to an incomming stream of 4x4 matrices.
430 The node then outputs a list of 4x4 matrices, concatenated with any incoming
431 matrices. The axis of translation is controlled by a vector gui widget and the
432 lenght of the vector by a thumbwheel widget located in the parameter panel.
433 The identity checkbutton controls whether the identity matrix is added or not.
434 """
435 - def __init__(self, name='SymTranslationXYZ', **kw):
436 kw['name']=name
437 apply( NetworkNode.__init__, (self,), kw)
438
439 self.operator = SymTransXYZ( (0,0,0, (0,0,0),(0,0,0),(0,0,0)),0 )
440
441 code = """def doit(self, matrices=None, vector=None, identity=None):
442 matrices = ToList(matrices)
443 self.operator.set(data=vector, identity=identity)
444 result = self.operator(matrices)
445 self.outputData(outMatrices=result)\n"""
446
447 if code: self.setFunction(code)
448
449 self.widgetDescr['vector'] = {
450 'class':'NEXYZVectGUI',
451 'vectX':'1 0 0','vectY':'0 1 0','vectZ':'0 0 1',
452 'labelGridCfg':{'columnspan':2},
453 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
454 'labelCfg':{'text':''},
455 }
456
457 self.widgetDescr['identity'] = {
458 'class':'NECheckButton',
459 'initialValue':0,
460 'labelCfg':{'text':'Identity'},
461 }
462
463 ip = self.inputPortsDescr
464 ip.append(datatype='instancemat(0)', required=False,
465 singleConnection=False, name='matrices')
466 ip.append(datatype='None', required=False, name='vector')
467 ip.append(datatype='int', required=False, name='identity')
468
469 op = self.outputPortsDescr
470 op.append(datatype='instancemat(0)', name='outMatrices')
471
472
474 """Apply a rotation to an incomming stream of 4x4 matrices.
475 The node then outputs a list of 4x4 matrices, concatenated with any incoming
476 matrices.The axis of rotation is controlled by a vector gui widget located in
477 the parameter panel. Additionally, a center of origin can be specified as well
478 as the rotation angle. The identity checkbutton controls whether the identity
479 matrix is added or not. """
480
481 - def __init__(self, name='SymRotation', **kw):
482 kw['name']=name
483 apply( NetworkNode.__init__, (self,), kw)
484
485 self.operator = SymRot( (1,0,0), (0,0,0), 0, 0 )
486
487 code = """def doit(self, matrices=None, vector=None, point=None,\
488 angle=None, identity=None):
489 matrices = ToList(matrices)
490 self.operator.set(vector=vector, point=point, angle=angle,
491 identity=identity)
492 result = self.operator(matrices)
493 self.outputData(outMatrices=result)\n"""
494
495 if code: self.setFunction(code)
496
497 self.widgetDescr['vector'] = {
498 'class':'NEVectorGUI', 'size':100,
499 'labelGridCfg':{'columnspan':2},
500 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
501 'labelCfg':{'text':'rot. axis'},
502 'initialValue':[1.,0,0]
503 }
504
505 self.widgetDescr['point'] = {
506 'class':'NEVectEntry',
507 'labelGridCfg':{'columnspan':2},
508 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
509 'labelCfg':{'text':'Point'},
510 'initialValue':[0.,0,0]
511 }
512
513 self.widgetDescr['angle'] = {
514 'class':'NEDial', 'size':100,
515 'type':'float', 'oneTurn':360,
516 'labelGridCfg':{'columnspan':2},
517 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
518 'labelCfg':{'text':'angle'},
519 }
520
521 self.widgetDescr['identity'] = {
522 'class':'NECheckButton',
523 'initialValue':0,
524 'labelCfg':{'text':'Identity'},
525 }
526
527 ip = self.inputPortsDescr
528 ip.append(datatype='instancemat(0)', required=False,
529 singleConnection=False, name='matrices')
530 ip.append(datatype='None', required=False, name='vector')
531 ip.append(datatype='None', required=False, name='point')
532 ip.append(datatype='float', required=False, name='angle')
533 ip.append(datatype='int', required=False, name='identity')
534
535 op = self.outputPortsDescr
536 op.append(datatype='instancemat(0)', name='outMatrices')
537
538
540 """Generates a helix.
541 Helix parameters are controlled by a VectorGUI widget located in the
542 parameter panel
543
544 Input:
545 matrices: matrices to be pre-multiplied with the helical transformation
546 vector: the 3-D vector defining the oriention of the helical axis
547 point: a 3-D point defining the location in space of the helical axis
548 angle: angular value in degrees between 2 consecutive copies
549 hrise: displacement along the helical axis between 2 consecutive copies
550 copies: number of transformations
551 """
552
553 - def __init__(self, name='SymHelix', **kw):
554
555 kw['name']=name
556 apply( NetworkNode.__init__, (self,), kw)
557
558 self.operator = SymHelix( (0.,1.,0.), (0.,0.,0.), 0., 0., 1 )
559
560 code = """def doit(self, matrices=None, vector=None, point=None,\
561 angle=None, hrise=None, copies=None):
562
563 matrices = ToList(matrices)
564 self.operator.set(vector=vector, point=point, angle=angle, hrise=hrise,
565 copies=copies)
566 result = self.operator(matrices)
567 self.outputData(outMatrices=result)\n"""
568
569 if code: self.setFunction(code)
570
571
572 self.widgetDescr['vector'] = {
573 'class':'NEVectorGUI', 'size':100,
574 'continuous':1,
575 'initialValue':[0.,1.,0],
576 'widgetGridCfg':{'labelSide':'top'},
577 'labelCfg':{'text':'rot. axis'},
578 }
579
580 self.widgetDescr['point'] = {
581 'class':'NEVectEntry',
582 'initialValue':[0.,0,0],
583 'widgetGridCfg':{'labelSide':'top'},
584 'labelCfg':{'text':'point'},
585 }
586
587 self.widgetDescr['angle'] = {
588 'class':'NEDial', 'size':100,
589 'oneTurn':360, 'type':'float',
590 'widgetGridCfg':{'labelSide':'top'},
591 'labelCfg':{'text':'angle'},
592 }
593
594 self.widgetDescr['hrise'] = {
595 'class':'NEThumbWheel', 'width':100, 'height':26, 'wheelPad':4,
596 'oneTurn':1, 'precision':3, 'type':'float',
597 'initValue':1.0,
598 'widgetGridCfg':{'labelSide':'top'},
599 'labelCfg':{'text':'rise'},
600 }
601
602 self.widgetDescr['copies'] = {
603 'class':'NEThumbWheel', 'width':100, 'height':26, 'wheelPad':4,
604 'oneTurn':10, 'precision':3, 'increment':1, 'type':'int', 'min':1,
605 'lockBMin':0,'lockType':1,'lockIncrement':1,
606 'lockBIncrement':1, 'lockMin':1,
607 'initValue':1.0,
608 'widgetGridCfg':{'labelSide':'top'},
609 'labelCfg':{'text':'# copies'},
610 }
611
612 ip = self.inputPortsDescr
613 ip.append(datatype='instancemat(0)', required=False,
614 singleConnection=False, name='matrices')
615 ip.append(datatype='None', required=False, name='vector')
616 ip.append(datatype='None', required=False, name='point')
617 ip.append(datatype='float', required=False, name='angle')
618 ip.append(datatype='float', required=False, name='hrise')
619 ip.append(datatype='int', required=False, name='copies')
620
621 op = self.outputPortsDescr
622 op.append(datatype='instancemat(0)', name='outMatrices')
623
624
626 """Merges incoming matrices"""
627
628 - def __init__(self, name='SymMerge', **kw):
629 kw['name']=name
630 apply( NetworkNode.__init__, (self,), kw)
631
632 self.operator = SymMerge()
633
634 code = """def doit(self, matrices=None):
635 matrices = ToList(matrices)
636 result = self.operator(matrices)
637 self.outputData(outMatrices=result)\n"""
638
639 if code: self.setFunction(code)
640
641 ip = self.inputPortsDescr
642 ip.append(datatype='instancemat(0)', required=False,
643 singleConnection=False, name='matrices')
644
645 op = self.outputPortsDescr
646 op.append(datatype='instancemat(0)', name='outMatrices')
647
648
650 """SymMultiply multiplies incoming matrices and ouputs them.
651
652 - 1 parent is multiplied with itself
653 - 2 parents: two valid options:
654 * either one of the parents has lenght 1 (1 matrix) which is then
655 multiplied to all other matrices of the second parent, or
656 * both parents have the same amount of matrices."""
657
658 - def __init__(self, name='SymMultiply', **kw):
659 kw['name']=name
660 apply( NetworkNode.__init__, (self,), kw)
661
662 self.operator = SymMultiply()
663
664 code = """def doit(self, stream1=None, stream2=None):
665 if stream1 or stream2:
666 if stream1:
667 stream1 = stream1[0]
668 if stream2:
669 stream2 = stream2[0]
670 result = self.operator(matA=stream1, matB=stream2)
671 self.outputData(outMatrices=result)\n"""
672
673 if code: self.setFunction(code)
674
675 ip = self.inputPortsDescr
676 ip.append(datatype='instancemat(0)', required=False,
677 singleConnection=False, name='stream1')
678 ip.append(datatype='instancemat(0)', required=False,
679 singleConnection=False, name='stream2')
680
681 op = self.outputPortsDescr
682 op.append(datatype='instancemat(0)', name='outMatrices')
683
684
686 """Transpose all incomming (4x4) matrices"""
687
688 - def __init__(self, name='Transpose', **kw):
689 kw['name']=name
690 apply( NetworkNode.__init__, (self,), kw)
691
692 m=Numeric.identity(4).astype('f')
693 self.operator = SymTranspose()
694
695 code = """def doit(self, matrices):
696 matrices = ToList(matrices)
697 result = self.operator(matrices)
698 self.outputData(outMatrices=result)\n"""
699
700 if code: self.setFunction(code)
701
702 ip = self.inputPortsDescr
703 ip.append(datatype='instancemat(0)', singleConnection=False,
704 name='inMatrices')
705
706 op = self.outputPortsDescr
707 op.append(datatype='instancemat(0)', name='outMatrices')
708
710 """Inverse all incomming (4x4) matrices"""
711
712 - def __init__(self, name='Inverse', **kw):
713 kw['name']=name
714 apply( NetworkNode.__init__, (self,), kw)
715
716 m=Numeric.identity(4).astype('f')
717 self.operator = SymInverse()
718
719 code = """def doit(self, matrices):
720 matrices = ToList(matrices)
721 result = self.operator(matrices)
722 self.outputData(outMatrices=result)\n"""
723
724 if code: self.setFunction(code)
725
726 ip = self.inputPortsDescr
727 ip.append(datatype='instancemat(0)', singleConnection=False,
728 name='inMatrices')
729
730 op = self.outputPortsDescr
731 op.append(datatype='instancemat(0)', name='outMatrices')
732
734 """unselected matrices of the incomming stream are sent to
735 output port 0, selected matrices are sent to additional output ports which get
736 created on selection.
737 selection is done by specifying matrices comma separated indices in the
738 incomming stream. Ranges can be specified using the ':' or '-' character.
739 additional ports are created by using the ';' character.
740 """
741
742 - def __init__(self, name='SymSplit', **kw):
743 kw['name']=name
744 apply( NetworkNode.__init__, (self,), kw)
745
746 m=Numeric.identity(4).astype('f')
747 self.operator = SymSplit(m, "")
748 self.result = None
749
750 self.widgetDescr['entry'] = {
751 'class':'NEEntry', 'master':'node', 'width':12,
752 'labelCfg':{'text':'selector:'},
753 }
754
755 ip = self.inputPortsDescr
756 ip.append(datatype='instancemat(0)', required=True,
757 singleConnection=False, name='matrices')
758 ip.append(datatype='string', required=False, name='entry')
759
760 op = self.outputPortsDescr
761 op.append(datatype='instancemat(0)', name='outMatrices0')
762
763 code = """def doit(self, matrices=None, entry=None):
764 matrices = ToList(matrices)
765 self.operator.set(matrices=matrices, chars=entry)
766 self.result=self.operator(matrices,entry)
767 self.addRemovePorts(len(self.result))
768 args = {}
769 for i in range(len(self.result)):
770 var='outMatrices'+`i`
771 if len(self.result[i]) == 0:
772 portData = [Numeric.identity(4).astype('f')]
773 else: portData=self.result[i]
774 args[var]=list(portData)
775 apply(self.outputData, (), args)\n"""
776
777 if code: self.setFunction(code)
778
779
780
781
782 if self.result > 1:
783 for p in self.outputPorts:
784 p._modified = True
785 else:
786 for p in self.outputPorts:
787 p._modified = False
788
789
791 dynamicOPortsDescr=[]
792 if nb > len(self.outputPorts):
793 loop=nb-len(self.outputPorts)
794 for i in range(loop):
795 name="outMatrices"+`len(self.outputPorts)+i`
796 dynamicOPortsDescr.append({
797 'name': name, 'datatype':'instancemat'})
798 for kw in dynamicOPortsDescr:
799 ip = apply( self.addOutputPort, (), kw )
800 self.outputPortsDescr = self.outputPortsDescr + dynamicOPortsDescr
801
802 elif nb < len(self.outputPorts):
803 for i in range(len(self.outputPorts), nb, -1):
804 self.deletePort(self.outputPorts[i-1])
805
806 elif nb == len(self.outputPorts): return
807
808
810 """ inputs xyz coords, returns center of gravity """
811
812
813 - def __init__(self, name='Center of Mass', **kw):
814 kw['name']=name
815 apply( NetworkNode.__init__, (self,), kw)
816
817 self.operator = CenterOfMass(None)
818
819 code = """def doit(self, coords):
820 if coords and len(coords):
821 self.operator.set(coords=coords)
822 result=self.operator()
823 self.outputData(centerOfMass=result)\n"""
824
825 if code: self.setFunction(code)
826
827 ip = self.inputPortsDescr
828 ip.append(datatype='coordinates3D', name='coords')
829
830 op = self.outputPortsDescr
831 op.append(datatype='list', name='centerOfMass')
832
833
837
838
840 """Apply a rotation to an incomming stream of 4x4 matrices
841 The rotation is around the center of mass
842 If the identity check button is checked this node will multiply the incoming
843 matrices by the identity matrix and the rotation matrix, else only the
844 rotation matrix is applied.
845 The axis of rotation is controlled by a VectorGUI widget located in the
846 parameter panel"""
847
848 - def __init__(self, name='SymOrient', **kw):
849 kw['name']=name
850 apply( NetworkNode.__init__, (self,), kw)
851
852 self.operator = SymOrient( [1,0,0], 0, [0,0,0], 0 )
853
854 code = """def doit(self, matrices=None, centerOfMass=None, \
855 vector=None, angle=None, identity=None):
856 matrices = ToList(matrices)
857 if centerOfMass and len(centerOfMass):
858 self.operator.set(vector=vector, angle=angle,
859 center=centerOfMass, identity=identity)
860 result = self.operator(matrices)
861 self.outputData(outMatrices=result)\n"""
862
863 if code: self.setFunction(code)
864
865 self.widgetDescr['vector'] = {
866 'class':'NEVectorGUI', 'size':100,
867 'continuous':1,
868 'initialValue':[1.,0,0],
869
870 'labelGridCfg':{'columnspan':2},
871 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
872 'labelCfg':{'text':'rot. axis'},
873 }
874
875 self.widgetDescr['angle'] = {
876 'class':'NEDial', 'size':100,
877 'labelGridCfg':{'columnspan':2},
878 'widgetGridCfg':{'columnspan':2, 'labelSide':'top'},
879 'oneTurn':360, 'type':'float',
880 'labelCfg':{'text':'angle'},
881 }
882
883 self.widgetDescr['identity'] = {
884 'class':'NECheckButton',
885 'initialValue':0,
886 'labelCfg':{'text':'Identity'},
887 }
888
889 ip = self.inputPortsDescr
890 ip.append(datatype='instancemat(0)', required=False,
891 singleConnection=False, name='matrices')
892 ip.append(datatype='list', required=False, name='centerOfMass')
893 ip.append(datatype='None', required=False, name='vector')
894 ip.append(datatype='float', required=False, name='angle')
895 ip.append(datatype='int', required=False, name='identity')
896
897 op = self.outputPortsDescr
898 op.append(datatype='instancemat(0)', name='outMatrices')
899
900
901
903 """ inputs xyz coords, and matrices, returns transformed coords """
904
905
906 - def __init__(self, name='Apply Transf to Coords', **kw):
907 kw['name']=name
908 apply( NetworkNode.__init__, (self,), kw)
909
910 self.operator = ApplyTransfToCoords([0.,0,0],None)
911
912 code = """def doit(self, coords, matrices=None):
913 if coords and len(coords) and matrices and len(matrices):
914 matrices = ToList(matrices)
915 self.operator.set(coords=coords, matrices=matrices)
916 result=self.operator()
917 self.outputData(coords=result)\n"""
918
919 if code: self.setFunction(code)
920
921 ip = self.inputPortsDescr
922 ip.append(datatype='coordinates3D', name='coords')
923 ip.append(datatype='instancemat(0)', required=False,
924 singleConnection=False, name='matrices')
925
926 op = self.outputPortsDescr
927 op.append(datatype='coordinates3D', name='coords')
928
929
933
934
936 """ inputs coords and a point, returns the distances of the coords to
937 this point"""
938
939
940 - def __init__(self, name='DistanceToPoint', **kw):
941 kw['name']=name
942 apply( NetworkNode.__init__, (self,), kw)
943
944 code = """def doit(self, coords, point=(0,0,0)):
945 if len(coords) and len(coords):
946 diff = Numeric.array(coords) - Numeric.array(point)
947 diff = diff*diff
948 dist = Numeric.sqrt( Numeric.add.reduce(diff, 1) )
949 self.outputData(dist=dist)\n"""
950
951 if code: self.setFunction(code)
952
953 ip = self.inputPortsDescr
954 ip.append(datatype='coordinates3D', name='coords')
955 ip.append(datatype='None', required=False, name='point')
956
957 op = self.outputPortsDescr
958 op.append(datatype='None', name='dist')
959
963
964
966 """Apply a scale factor to inputs matrices (not required).
967 Outputs scaled matrices.
968
969 The scaling factor can be applied to x, y and or z, using the checkbutton
970 widgets bound to the node."""
971
972 - def __init__(self, name='Scale', **kw):
973 kw['name']=name
974 apply( NetworkNode.__init__, (self,), kw)
975
976 self.operator = SymScale()
977
978 code = """def doit(self, matrices=None, scaleFactor=None, scaleX=1, scaleY=1, scaleZ=1):
979 if scaleFactor is None:
980 return
981 if not matrices:
982 matrices = None
983
984 selection = [scaleX, scaleY, scaleZ]
985
986 result = self.operator(matrices, scaleFactor, selection=selection)
987 self.outputData(outMatrices=result)\n"""
988
989 if code: self.setFunction(code)
990
991 ip = self.inputPortsDescr
992 ip.append(datatype='instancemat(0)', required=False, name='matrices')
993 ip.append(datatype='float', required=False, name='scaleFactor')
994 ip.append(datatype='int', name='scaleX')
995 ip.append(datatype='int', name='scaleY')
996 ip.append(datatype='int', name='scaleZ')
997
998 op = self.outputPortsDescr
999 op.append(datatype='instancemat(0)', name='outMatrices')
1000
1001 self.widgetDescr['scaleX'] = {
1002 'class':'NECheckButton', 'master':'node',
1003 'labelGridCfg':{'sticky':'w', 'columnspan':2},
1004 'widgetGridCfg':{'sticky':'w'},
1005 'labelCfg':{'text':'Scale X'},
1006 'initialValue':1,
1007 }
1008 self.widgetDescr['scaleY'] = {
1009 'class':'NECheckButton', 'master':'node',
1010 'labelGridCfg':{'sticky':'w', 'columnspan':2},
1011 'widgetGridCfg':{'sticky':'w'},
1012 'labelCfg':{'text':'Scale Y'},
1013 'initialValue':1,
1014 }
1015 self.widgetDescr['scaleZ'] = {
1016 'class':'NECheckButton', 'master':'node',
1017 'labelGridCfg':{'sticky':'w', 'columnspan':2},
1018 'widgetGridCfg':{'sticky':'w'},
1019 'labelCfg':{'text':'Scale Z'},
1020 'initialValue':1,
1021 }
1022
1024 """Computes the distance between two (x,y,z) points"""
1025
1026 - def __init__(self, name='Dist2Points', **kw):
1027 kw['name']=name
1028 apply( NetworkNode.__init__, (self,), kw)
1029
1030 self.operator = DistanceBetweenTwoPoints()
1031
1032 ip = self.inputPortsDescr
1033 ip.append(datatype='list', name='point1')
1034 ip.append(datatype='list', name='point2')
1035
1036 op = self.outputPortsDescr
1037 op.append(datatype='float', name='distance')
1038
1039 code = """def doit(self, point1, point2):
1040 if point1 and point2:
1041 result = self.operator(point1, point2)
1042 self.outputData(distance=result)\n"""
1043
1044 if code: self.setFunction(code)
1045
1046
1048 """ inputs PDB file, parses MTRIXn records and returns a list of (4x4)
1049 matrices. MTRIXn is the default PDB standard, however not everybody seems
1050 to follow the standard, thus an optional keyword can be passed that
1051 describes the matrix records in this non-standard PDB file."""
1052
1053
1054 - def __init__(self, name='PDBtoMatrix', **kw):
1055 kw['name']=name
1056 apply( NetworkNode.__init__, (self,), kw)
1057
1058 self.operator = PDBtoMatrix()
1059
1060 code = """def doit(self, mol, keyword=None):
1061 if mol:
1062 if keyword is None or keyword == '' or keyword == []:
1063 keyword = 'MTRIX'
1064 result = self.operator.getMatrices(mol,keyword)
1065 if result:
1066 self.outputData(matrices=result)\n"""
1067
1068 if code: self.setFunction(code)
1069
1070 ip = self.inputPortsDescr
1071 ip.append(datatype='MoleculeSet', name='molecule')
1072 ip.append(datatype='string', required=False, name='keyword')
1073
1074 op = self.outputPortsDescr
1075 op.append(datatype='instancemat(0)', name='matrices')
1076
1077
1081
1082
1083
1084 from NetworkEditor.macros import MacroNode
1086
1087 - def __init__(self, constrkw={}, name='Icosahedral1', **kw):
1088 kw['name'] = name
1089 apply( MacroNode.__init__, (self,), kw)
1090
1097
1098
1100 from NetworkEditor.macros import MacroNode
1101 MacroNode.afterAddingToNetwork(self)
1102
1103 from symserv.VisionInterface.SymservNodes import symlib
1104
1105 node0 = self
1106 node2 = node0.macroNetwork.opNode
1107 node2.move(193, 356)
1108 from symserv.VisionInterface.SymservNodes import Sym5FoldNE
1109 node3 = Sym5FoldNE(constrkw = {}, name='5-fold', library=symlib)
1110 node0.macroNetwork.addNode(node3,220,76)
1111 node3.inputPorts[1].widget.set(
1112 [0.0, 0.52549288072191591, 0.85079799735929229],0)
1113 node3.inputPorts[2].widget.set([0.0, 0, 0],0)
1114 from symserv.VisionInterface.SymservNodes import Sym3FoldNE
1115 node4 = Sym3FoldNE(constrkw = {}, name='3-fold', library=symlib)
1116 node0.macroNetwork.addNode(node4,221,142)
1117 node4.inputPorts[1].widget.set(
1118 [0.57735026918962584, 0.57735026918962584, 0.57735026918962584],0)
1119 node4.inputPorts[2].widget.set([0.0, 0, 0],0)
1120 from symserv.VisionInterface.SymservNodes import Sym2FoldNE
1121 node5 = Sym2FoldNE(constrkw = {}, name='2-fold', library=symlib)
1122 node0.macroNetwork.addNode(node5,115,217)
1123 node5.inputPorts[1].widget.set([1.0, 0.0, 0.0],0)
1124 node5.inputPorts[2].widget.set([0.0, 0, 0],0)
1125 node5.inputPorts[3].widget.set(1,0)
1126 from symserv.VisionInterface.SymservNodes import Sym2FoldNE
1127 node6 = Sym2FoldNE(constrkw = {}, name='2-fold', library=symlib)
1128 node0.macroNetwork.addNode(node6,244,218)
1129 node6.inputPorts[1].widget.set([0.0, 0.0, 1.0],0)
1130 node6.inputPorts[2].widget.set([0.0, 0, 0],0)
1131 node6.inputPorts[3].widget.set(0,0)
1132 from symserv.VisionInterface.SymservNodes import Sym2FoldNE
1133 node7 = Sym2FoldNE(constrkw = {}, name='2-fold', library=symlib)
1134 node0.macroNetwork.addNode(node7,381,218)
1135 node7.inputPorts[1].widget.set([0.0, 1.0, 0.0],0)
1136 node7.inputPorts[2].widget.set([0.0, 0, 0],0)
1137 node7.inputPorts[3].widget.set(0,0)
1138 from symserv.VisionInterface.SymservNodes import SymMergeNE
1139 node8 = SymMergeNE(constrkw = {}, name='Merge', library=symlib)
1140 node0.macroNetwork.addNode(node8,233,288)
1141
1142
1143 if node4 is not None and node5 is not None:
1144 node0.macroNetwork.connectNodes(
1145 node4, node5, "outMatrices", "matrices", blocking=True)
1146 if node4 is not None and node6 is not None:
1147 node0.macroNetwork.connectNodes(
1148 node4, node6, "outMatrices", "matrices", blocking=True)
1149 if node4 is not None and node7 is not None:
1150 node0.macroNetwork.connectNodes(
1151 node4, node7, "outMatrices", "matrices", blocking=True)
1152 if node3 is not None and node4 is not None:
1153 node0.macroNetwork.connectNodes(
1154 node3, node4, "outMatrices", "matrices", blocking=True)
1155 if node5 is not None and node8 is not None:
1156 node0.macroNetwork.connectNodes(
1157 node5, node8, "outMatrices", "matrices", blocking=True)
1158 node2 = node0.macroNetwork.opNode
1159 if node8 is not None and node2 is not None:
1160 node0.macroNetwork.connectNodes(
1161 node8, node2, "outMatrices", "new", blocking=True)
1162 if node6 is not None and node8 is not None:
1163 node0.macroNetwork.connectNodes(
1164 node6, node8, "outMatrices", "matrices", blocking=True)
1165 if node7 is not None and node8 is not None:
1166 node0.macroNetwork.connectNodes(
1167 node7, node8, "outMatrices", "matrices", blocking=True)
1168
1169
1170 node2.inputPorts[1].configure(singleConnection=True)
1171
1172 node0.shrink()
1173
1174 node0.resetTags()
1175 node0.buildOriginalList()
1176
1177
1178
1179 from traceback import print_exc
1180 from NetworkEditor.macros import MacroNode
1182
1183 - def __init__(self, constrkw={}, name='IcosCage', **kw):
1184 kw['name'] = name
1185 apply( MacroNode.__init__, (self,), kw)
1186
1197
1199 from NetworkEditor.macros import MacroNode
1200 MacroNode.afterAddingToNetwork(self)
1201
1202 from symserv.VisionInterface.SymservNodes import symlib
1203 from Vision.StandardNodes import stdlib
1204
1205 node0 = self
1206 node1 = node0.macroNetwork.ipNode
1207 node1.move(176, 14)
1208 node2 = node0.macroNetwork.opNode
1209 node2.move(197, 334)
1210 from symserv.VisionInterface.SymservNodes import Sym3FoldNE
1211 node3 = Sym3FoldNE(constrkw = {}, name='3-fold', library=symlib)
1212 node0.macroNetwork.addNode(node3,347,40)
1213 node3.inputPorts[1].widget.set(
1214 [0.57735026918962584, 0.57735026918962584, 0.57735026918962584],0)
1215 node3.inputPorts[2].widget.set([0.0, 0, 0],0)
1216 from symserv.VisionInterface.SymservNodes import Sym2FoldNE
1217 node4 = Sym2FoldNE(constrkw = {}, name='2-fold', library=symlib)
1218 node0.macroNetwork.addNode(node4,270,105)
1219 node4.inputPorts[1].widget.set([1.0, 0.0, 0.0],0)
1220 node4.inputPorts[2].widget.set([0.0, 0, 0],0)
1221 node4.inputPorts[3].widget.set(1)
1222 from symserv.VisionInterface.SymservNodes import Sym2FoldNE
1223 node5 = Sym2FoldNE(constrkw = {}, name='2-fold', library=symlib)
1224 node0.macroNetwork.addNode(node5,347,105)
1225 node5.inputPorts[1].widget.set([0.0, 0.0, 1.0],0)
1226 node5.inputPorts[2].widget.set([0.0, 0, 0],0)
1227 node5.inputPorts[3].widget.set(0)
1228 from symserv.VisionInterface.SymservNodes import Sym2FoldNE
1229 node6 = Sym2FoldNE(constrkw = {}, name='2-fold', library=symlib)
1230 node0.macroNetwork.addNode(node6,427,105)
1231 node6.inputPorts[1].widget.set([0.0, 1.0, 0.0],0)
1232 node6.inputPorts[2].widget.set([0.0, 0, 0],0)
1233 node6.inputPorts[3].widget.set(0)
1234 from symserv.VisionInterface.SymservNodes import SymMergeNE
1235 node7 = SymMergeNE(constrkw = {}, name='Merge', library=symlib)
1236 node0.macroNetwork.addNode(node7,347,173)
1237 from symserv.VisionInterface.SymservNodes import ApplyTransfToCoordsNE
1238 node8 = ApplyTransfToCoordsNE(
1239 constrkw = {}, name='Apply Transf to Coords', library=symlib)
1240 node0.macroNetwork.addNode(node8,146,232)
1241 from Vision.StandardNodes import Eval
1242 node9 = Eval(constrkw = {}, name='[0.0, 0.525, 0....', library=stdlib)
1243 node0.macroNetwork.addNode(node9,14,36)
1244 node9.inputPorts[0].widget.set("[0.0, 0.525, 0.851]",0)
1245 from Vision.StandardNodes import Operator2
1246 node10 = Operator2(constrkw = {}, name='mul', library=stdlib)
1247 node0.macroNetwork.addNode(node10,103,113)
1248 apply(node10.inputPorts[1].configure, (), {'datatype': 'float'})
1249 apply(node10.outputPorts[0].configure, (), {'datatype': 'list'})
1250 node10.inputPorts[2].widget.set("mul",0)
1251 node10.inputPorts[3].widget.set(1,0)
1252 from Vision.StandardNodes import Eval
1253 node11 = Eval(constrkw = {}, name='[in1]', library=stdlib)
1254 node0.macroNetwork.addNode(node11,103,174)
1255 apply(node11.inputPorts[1].configure, (), {'datatype': 'list'})
1256 node11.inputPorts[0].widget.set("[in1]",0)
1257 from NetworkEditor.items import NetworkNode
1258 from Vision.StandardNodes import Generic
1259 node12 = Generic(constrkw = {}, name='faces', library=stdlib)
1260 node0.macroNetwork.addNode(node12,431,185)
1261 apply(node12.addOutputPort, (),
1262 {'datatype': 'faceIndices', 'name': 'indices'})
1263 code = """def doit(self):
1264 self.outputData(indices=[
1265 [10, 3, 8], [10, 8, 7], [10, 7, 11], [10, 11,9], [10, 9, 3],
1266 [1, 4, 2], [1, 2, 0], [1, 0, 6], [1, 6, 5], [1, 5, 4],
1267 [3, 5, 8], [8, 5, 6], [8, 6, 7], [7, 6, 0], [7, 0, 11],
1268 [11, 0, 2], [11, 2, 9], [9, 2, 4], [9, 4, 3], [3, 4, 5]
1269 ])
1270 """
1271 node12.configure(function=code)
1272 node13 = Generic(constrkw = {}, name='edges', library=stdlib)
1273 node0.macroNetwork.addNode(node13,506,214)
1274 apply(node13.addOutputPort, (),
1275 {'datatype': 'indice2(0)', 'name': 'indices'})
1276 code = """def doit(self):
1277 self.outputData(indices=[
1278 [0, 1], [1, 2], [0, 2], [0, 6], [6, 1], [0, 7], [7, 6],
1279 [0, 11], [2, 11], [9, 4], [9, 3], [3, 4], [4, 5], [3, 5],
1280 [9, 10], [3, 10], [3, 8], [5, 8], [8, 10], [10, 7], [8, 7],
1281 [10, 11], [7, 11], [11, 9], [9, 2], [2, 4], [4, 1], [1, 5],
1282 [5, 6], [6, 8] ])
1283 """
1284 node13.configure(function=code)
1285
1286
1287 if node3 is not None and node4 is not None:
1288 node0.macroNetwork.connectNodes(
1289 node3, node4, "outMatrices", "matrices", blocking=True)
1290 if node3 is not None and node5 is not None:
1291 node0.macroNetwork.connectNodes(
1292 node3, node5, "outMatrices", "matrices", blocking=True)
1293 if node3 is not None and node6 is not None:
1294 node0.macroNetwork.connectNodes(
1295 node3, node6, "outMatrices", "matrices", blocking=True)
1296 if node4 is not None and node7 is not None:
1297 node0.macroNetwork.connectNodes(
1298 node4, node7, "outMatrices", "matrices", blocking=True)
1299 if node5 is not None and node7 is not None:
1300 node0.macroNetwork.connectNodes(
1301 node5, node7, "outMatrices", "matrices", blocking=True)
1302 if node6 is not None and node7 is not None:
1303 node0.macroNetwork.connectNodes(
1304 node6, node7, "outMatrices", "matrices", blocking=True)
1305 if node9 is not None and node10 is not None:
1306 node0.macroNetwork.connectNodes(
1307 node9, node10, "result", "data1", blocking=True)
1308 if node10 is not None and node11 is not None:
1309 node0.macroNetwork.connectNodes(
1310 node10, node11, "result", "in1", blocking=True)
1311 if node11 is not None and node8 is not None:
1312 node0.macroNetwork.connectNodes(
1313 node11, node8, "result", "coords", blocking=True)
1314 if node1 is not None and node10 is not None:
1315 node0.macroNetwork.connectNodes(
1316 node1, node10, "new", "data2", blocking=True)
1317 if node8 is not None and node2 is not None:
1318 node0.macroNetwork.connectNodes(
1319 node8, node2, "coords", "new", blocking=True)
1320 if node7 is not None and node8 is not None:
1321 node0.macroNetwork.connectNodes(
1322 node7, node8, "outMatrices", "matrices", blocking=True)
1323 if node12 is not None and node2 is not None:
1324 node0.macroNetwork.connectNodes(
1325 node12, node2, "indices", "new", blocking=True)
1326 if node13 is not None and node2 is not None:
1327 node0.macroNetwork.connectNodes(
1328 node13, node2, "indices", "new", blocking=True)
1329
1330
1331 node2.inputPorts[1].configure(singleConnection=True)
1332 node2.inputPorts[2].configure(singleConnection=True)
1333 node2.inputPorts[3].configure(singleConnection=True)
1334
1335 node0.shrink()
1336
1337 node0.resetTags()
1338 node0.buildOriginalList()
1339
1340
1341
1342 from Vision.VPE import NodeLibrary
1343 symlib = NodeLibrary('SymServer', 'cyan')
1344
1345 symlib.addNode(SymHelixNE, 'Helix', 'Symmetries')
1346 symlib.addNode(SymRotNE, 'Rotate', 'Transformations')
1347 symlib.addNode(SymOrientNE, 'Orient', 'Transformations')
1348 symlib.addNode(SymTransNE, 'Translate', 'Transformations')
1349 symlib.addNode(SymTransXYZNE, 'Transl. XYZ', 'Transformations')
1350 symlib.addNode(SymScaleNE, 'Scale', 'Transformations')
1351 symlib.addNode(Identity, 'Identity', 'Transformations')
1352 symlib.addNode(AlignVectToVect, 'Vect2Vect', 'Transformations')
1353 symlib.addNode(SymTransposeNE, 'Transpose', 'Transformations')
1354 symlib.addNode(SymInverseNE, 'Inverse', 'Transformations')
1355
1356
1357 symlib.addNode(SymMultiplyNE, 'Multiply', 'Mapper')
1358 symlib.addNode(SymMergeNE, 'Merge', 'Mapper')
1359 symlib.addNode(SymNFoldNE, 'N-fold', 'Symmetries')
1360 symlib.addNode(Sym2FoldNE, '2-fold', 'Symmetries')
1361 symlib.addNode(Sym3FoldNE, '3-fold', 'Symmetries')
1362 symlib.addNode(Sym4FoldNE, '4-fold', 'Symmetries')
1363 symlib.addNode(Sym5FoldNE, '5-fold', 'Symmetries')
1364 symlib.addNode(Sym6FoldNE, '6-fold', 'Symmetries')
1365 symlib.addNode(SymSplitNE, 'Split', 'Filter')
1366 symlib.addNode(CoMassNE, 'Center of Mass', 'Mapper')
1367 symlib.addNode(ApplyTransfToCoordsNE,'Apply Transf to Coords','Mapper')
1368 symlib.addNode(DistanceToPoint,'DistanceToPoint','Mapper')
1369 symlib.addNode(Dist2Points,'Dist2Points','Mapper')
1370 symlib.addNode(PDBToMatrix,'PDBtoMatrix','Mapper')
1371
1372 symlib.addNode(Icos1,'Icosahedral1','Macros')
1373 symlib.addNode(IcosCage,'IcosCage','Macros')
1374
1375 symlib.addWidget(NEXYZVectGUI)
1376
1377 try:
1378 UserLibBuild.addTypes(symlib, 'MolKit.VisionInterface.MolKitTypes')
1379 except Exception, e:
1380 print "unable to addTypes from MolKit %s\n" % e
1381