File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -215,19 +215,18 @@ def _assign_axes(
215
215
216
216
# For non-linear scales, use EnumeratedAxis
217
217
try :
218
- EnumeratedAxis = sj .jimport ("net.imagej.axis.EnumeratedAxis" )
218
+ if not linear :
219
+ j_coords = [jc .Double (x ) for x in coords_arr ]
220
+ axes [ax_num ] = jc .EnumeratedAxis (ax_type , sj .to_java (j_coords ))
221
+ continue
219
222
except (JException , TypeError ):
220
- EnumeratedAxis = None
221
- # If we can use EnumeratedAxis for a nonlinear scale, then use it
222
- if not linear and EnumeratedAxis :
223
- j_coords = [jc .Double (x ) for x in coords_arr ]
224
- axes [ax_num ] = EnumeratedAxis (ax_type , sj .to_java (j_coords ))
225
- # Otherwise, use DefaultLinearAxis
226
- else :
227
- DefaultLinearAxis = sj .jimport ("net.imagej.axis.DefaultLinearAxis" )
223
+ # We don't have EnumeratedAxis available - use DefaultLinearAxis
224
+ pass
225
+ # For linear scales, use DefaultLinearAxis
226
+ finally :
228
227
scale = coords_arr [1 ] - coords_arr [0 ] if len (coords_arr ) > 1 else 1
229
228
origin = coords_arr [0 ] if len (coords_arr ) > 0 else 0
230
- axes [ax_num ] = DefaultLinearAxis (
229
+ axes [ax_num ] = jc . DefaultLinearAxis (
231
230
ax_type , jc .Double (scale ), jc .Double (origin )
232
231
)
233
232
You can’t perform that action at this time.
0 commit comments