@@ -32,6 +32,10 @@ class Array(Freezable):
32
32
The name of each axis. If not provided, the axis names
33
33
are given names ["c1", "c2", "c3", ...]
34
34
35
+ units (``Optional[Iterable[str]]``):
36
+
37
+ The units of each spatial dimension.
38
+
35
39
chunk_shape (`tuple`, optional):
36
40
37
41
The size of a chunk of the underlying data container in voxels.
@@ -67,13 +71,15 @@ def __init__(
67
71
self .offset = (
68
72
Coordinate (offset ) if offset is not None else (0 ,) * len (data .shape )
69
73
)
70
- self .axis_names = (
71
- tuple (axis_names )
72
- if axis_names is not None
73
- else tuple ("d{i}" for i in range (len (data .shape )))
74
- )
74
+ # assign default axis names, if not given
75
+ if axis_names is None :
76
+ channel_names = [f"c{ i } ^" for i in range (self .channel_dims )]
77
+ spatial_names = [f"d{ i } " for i in range (self .spatial_dims )]
78
+ axis_names = channel_names + spatial_names
79
+ self .axis_names = tuple (axis_names )
80
+ # assign unknown unit to each spatial dim, if not given
75
81
self .units = (
76
- tuple (units ) if units is not None else ("voxels " ,) * self .voxel_size . dims
82
+ tuple (units ) if units is not None else ("" ,) * self .spatial_dims
77
83
)
78
84
self .chunk_shape = Coordinate (chunk_shape ) if chunk_shape is not None else None
79
85
self ._source_data = data
@@ -109,6 +115,10 @@ def dims(self):
109
115
def channel_dims (self ):
110
116
return self .dims - self .voxel_size .dims
111
117
118
+ @property
119
+ def spatial_dims (self ):
120
+ return self .voxel_size .dims
121
+
112
122
@property
113
123
def shape (self ):
114
124
"""Get the shape in voxels of this array,
0 commit comments