@@ -18,17 +18,17 @@ def set_position(self, position):
1818 Parameters
1919 ----------
2020 position : list of three floats
21+ (ap, ml, dv) coordinates in um
2122
2223 Examples
2324 --------
24- >>>p1.set_position([5.2,5.7,0.33 ]) # set a particle to Bregma, in CCF space
25+ >>>p1.set_position([5200,5700,330 ]) # set a particle to Bregma, in CCF space
2526 """
2627 if self .in_unity == False :
2728 raise Exception ("Particle does not exist in Unity, call create method first." )
2829
29- position = utils .sanitize_vector3 (position )
30- self .position = position
31- client .sio .emit ('SetParticlePos' , {self .id : position })
30+ self .position = utils .sanitize_vector3 (position )
31+ client .sio .emit ('SetParticlePos' , {self .id : [self .position [0 ]/ 1000 , self .position [1 ]/ 1000 , self .position [2 ]/ 1000 ]})
3232
3333 def set_size (self , size ):
3434 """Set the size of a particle
@@ -150,11 +150,11 @@ def set_positions(particles_list, positions_list):
150150 ----------
151151 particles_list : list of Particle
152152 positions_list : list of list of three floats
153- list of positions of neurons
153+ list of positions of neurons (ap, ml, dv) in um
154154
155155 Examples
156156 --------
157- >>> urchin.particles.set_positions([p1,p2,p3], [[1,1,1],[2,2,2],[3,3,3] ])
157+ >>> urchin.particles.set_positions([p1,p2,p3], [[1000,1000,1000],...,... ])
158158 """
159159 particles_list = utils .sanitize_list (particles_list )
160160 positions_list = utils .sanitize_list (positions_list )
@@ -163,7 +163,8 @@ def set_positions(particles_list, positions_list):
163163 for i in range (len (particles_list )):
164164 neuron = particles_list [i ]
165165 if neuron .in_unity :
166- neuron_positions [neuron .id ] = utils .sanitize_vector3 (positions_list [i ])
166+ pos = utils .sanitize_vector3 (positions_list [i ])
167+ neuron_positions [neuron .id ] = [pos [0 ]/ 1000 , pos [1 ]/ 1000 , pos [2 ]/ 1000 ]
167168 else :
168169 warnings .warn (f"Particle with id { neuron .id } does not exist in Unity, call create method first." )
169170 client .sio .emit ('SetParticlePos' , neuron_positions )
@@ -217,36 +218,6 @@ def set_colors(particles_list, colors_list):
217218 warnings .warn (f"Particle with id { neuron .id } does not exist in Unity, call create method first." )
218219 client .sio .emit ('SetParticleColor' , neurons_colors )
219220
220- # def set_shapes(neurons_list, shapes_list):
221- # """Set neuron shapes
222-
223- # Options are
224- # - 'sphere' (default)
225- # - 'cube' better performance when rendering tens of thousands of neurons
226-
227- # Parameters
228- # ----------
229- # neurons_list : list of neuron objects
230- # list of neurons being reshaped
231- # shapes : list of string
232- # list of shapes of neurons
233-
234- # Examples
235- # --------
236- # >>> urchin.neurons.set_shapes([p1,n2,n3], ['sphere','cube','sphere'])
237- # """
238- # neurons_list = utils.sanitize_list(neurons_list)
239- # shapes_list = utils.sanitize_list(shapes_list)
240-
241- # neurons_shapes = {}
242- # for i in range(len(neurons_list)):
243- # neuron = neurons_list[i]
244- # if neuron.in_unity:
245- # neurons_shapes[neuron.id] = shapes_list[i]
246- # else:
247- # warnings.warn(f"Neuron with id {neuron.id} does not exist in Unity, call create method first.")
248- # client.sio.emit('SetParticleShape', neurons_shapes)
249-
250221def set_material (material_name ):
251222 """Change the material used to render neurons
252223
0 commit comments