@@ -387,7 +387,8 @@ def plot_interactive_3D(
387387
388388 - "detailed": show detailed morphology taking into account each segment's
389389 width
390- - "constant": show morphology, but use constant line widths
390+ - "constant": show morphology, but use "min_width" for line widths; the
391+ soma is made thicker to make it easy to see
391392 - "schematic": only plot each unbranched segment group as a straight
392393 line, not following each segment
393394 - "point": show all cells as points
@@ -900,9 +901,7 @@ def plot_interactive_3D(
900901 if not nogui :
901902 if pbar is not None :
902903 pbar .finish ()
903- create_mesh (
904- meshdata , plot_type , current_view , min_width , save_mesh_to = save_mesh_to
905- )
904+ create_mesh (meshdata , current_view , save_mesh_to = save_mesh_to )
906905 if pynml_in_jupyter :
907906 display (current_canvas )
908907 else :
@@ -994,10 +993,9 @@ def plot_3D_cell_morphology(
994993 :param plot_type: type of plot, one of:
995994
996995 - "detailed": show detailed morphology taking into account each segment's
997- width. This is not performant, because a new line is required for
998- each segment. To only be used for cells with small numbers of
999- segments
1000- - "constant": show morphology, but use constant line widths
996+ width.
997+ - "constant": show morphology, but use min_width for line widths; the
998+ soma is made 5 times thicker to make it easier to see.
1001999
10021000 This is only applicable for neuroml.Cell cells (ones with some
10031001 morphology)
@@ -1108,6 +1106,21 @@ def plot_3D_cell_morphology(
11081106 r1 = p .diameter / 2
11091107 r2 = d .diameter / 2
11101108
1109+ # ensure larger than provided minimum width
1110+ if r1 < min_width :
1111+ r1 = min_width
1112+ if r2 < min_width :
1113+ r2 = min_width
1114+
1115+ # if plot is a constant type, fix the widths
1116+ if plot_type == "constant" :
1117+ r1 = min_width
1118+ r2 = min_width
1119+ # let soma be thicker so that it can be easily made out
1120+ if seg .id in soma_segs :
1121+ r1 = r1 * 5
1122+ r2 = r2 * 5
1123+
11111124 segment_spec = {
11121125 "marker_size" : None ,
11131126 "marker_color" : None ,
@@ -1167,9 +1180,7 @@ def plot_3D_cell_morphology(
11671180 logger .debug (f"meshdata added: { meshdata [- 1 ]} " )
11681181
11691182 if not nogui :
1170- create_mesh (
1171- meshdata , plot_type , current_view , min_width , save_mesh_to = save_mesh_to
1172- )
1183+ create_mesh (meshdata , current_view , save_mesh_to = save_mesh_to )
11731184 if pynml_in_jupyter :
11741185 display (current_canvas )
11751186 else :
@@ -1184,7 +1195,7 @@ def plot_3D_schematic(
11841195 segment_groups : Optional [List [SegmentGroup ]] = None ,
11851196 offset : Optional [Tuple [float , float , float ]] = (0.0 , 0.0 , 0.0 ),
11861197 labels : bool = False ,
1187- width : float = 5 .0 ,
1198+ width : float = 1 .0 ,
11881199 verbose : bool = False ,
11891200 nogui : bool = False ,
11901201 title : str = "" ,
@@ -1254,7 +1265,7 @@ def plot_3D_schematic(
12541265 - "origin": automatically added at origin
12551266 - "bottom left": automatically added at bottom left
12561267
1257- :type axes_pos: [ float, float, float] or [ int, int, int] or None or str
1268+ :type axes_pos: ( float, float, float) or ( int, int, int) or None or str
12581269 :param theme: theme to use (light/dark)
12591270 :type theme: str
12601271 :param color: color to use for segment groups with some special values:
@@ -1268,10 +1279,6 @@ def plot_3D_schematic(
12681279 :param meshdata: dictionary used to store mesh related data for vispy
12691280 visualisation
12701281 :type meshdata: dict
1271- :param mesh_precision: what decimal places to use to group meshes into
1272- instances: more precision means more detail (meshes), means less
1273- performance (passed to :py:func:`round` and so may be negative)
1274- :type mesh_precision: int
12751282 :param upright: bool only applicable for single cells: Makes cells "upright"
12761283 (along Y axis) by calculating its PCA, rotating it so it is along the Y axis,
12771284 and transforming cell co-ordinates to align along the rotated first principal
@@ -1360,6 +1367,11 @@ def plot_3D_schematic(
13601367 (last_dist .x , last_dist .y , last_dist .z ),
13611368 )
13621369
1370+ seg_width = width
1371+
1372+ if first_seg .id in soma_segs and last_seg .id in soma_segs :
1373+ seg_width = width * 5
1374+
13631375 branch_color = color
13641376 if color is None :
13651377 branch_color = get_next_hex_color ()
@@ -1380,8 +1392,8 @@ def plot_3D_schematic(
13801392 if offset is not None :
13811393 meshdata .append (
13821394 (
1383- f" { first_prox . diameter / 2 } " ,
1384- f" { last_dist . diameter / 2 } " ,
1395+ seg_width ,
1396+ seg_width ,
13851397 f"{ length } " ,
13861398 first_prox ,
13871399 last_dist ,
@@ -1392,8 +1404,8 @@ def plot_3D_schematic(
13921404 else :
13931405 meshdata .append (
13941406 (
1395- f" { first_prox . diameter / 2 } " ,
1396- f" { last_dist . diameter / 2 } " ,
1407+ seg_width ,
1408+ seg_width ,
13971409 f"{ length } " ,
13981410 first_prox ,
13991411 last_dist ,
@@ -1402,9 +1414,7 @@ def plot_3D_schematic(
14021414 )
14031415
14041416 if not nogui :
1405- create_mesh (
1406- meshdata , "Detailed" , current_view , width , save_mesh_to = save_mesh_to
1407- )
1417+ create_mesh (meshdata , current_view , save_mesh_to = save_mesh_to )
14081418 if pynml_in_jupyter :
14091419 display (current_canvas )
14101420 else :
@@ -1561,9 +1571,7 @@ def create_mesh(
15611571 Optional [Tuple [float , float , float ]],
15621572 ]
15631573 ],
1564- plot_type : str ,
15651574 current_view : ViewBox ,
1566- min_width : float ,
15671575 save_mesh_to : Optional [str ],
15681576):
15691577 """Internal function to create a mesh from the mesh data
@@ -1572,12 +1580,8 @@ def create_mesh(
15721580
15731581 :param meshdata: meshdata to plot: list with:
15741582 [(r1, r2, length, prox, dist, color, offset)]
1575- :param plot_type: type of plot
1576- :type plot_type: str
15771583 :param current_view: vispy viewbox to use
15781584 :type current_view: ViewBox
1579- :param min_width: minimum width of tubes
1580- :type min_width: float
15811585 :param save_mesh_to: name of file to save mesh object to
15821586 :type save_mesh_to: str or None
15831587 """
@@ -1611,16 +1615,6 @@ def create_mesh(
16111615 if offset is None :
16121616 offset = (0.0 , 0.0 , 0.0 )
16131617
1614- # actual plotting bits
1615- if plot_type == "constant" :
1616- r1 = min_width
1617- r2 = min_width
1618-
1619- if r1 < min_width :
1620- r1 = min_width
1621- if r2 < min_width :
1622- r2 = min_width
1623-
16241618 seg_mesh = None
16251619 # 1: for points, we set the prox/dist to None since they only have
16261620 # positions.
0 commit comments