Skip to content

Commit

Permalink
aspect ratio for point cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
Slautin committed Jan 3, 2025
1 parent af45177 commit 95a711c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions sidpy/viz/dataset_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,14 @@ def verify_dataset(self):
return True

def set_image(self, quantity, **kwargs):
self.axes[0].imshow(self.image.T, extent=self.extent, **kwargs)
_aspect = abs((self.real_extent[3] - self.real_extent[2]) / (self.real_extent[1] - self.real_extent[0]))
if _aspect > 5:
print(f'Attention: Non-square pixel size. Real y/x aspect ration: {round(_aspect,2)}')
_aspect = 5
elif _aspect < 0.2:
print(f'Attention: Non-square pixel size. Real y/x aspect ration: {round(_aspect,2)}')
_aspect = 0.2
self.axes[0].imshow(self.image.T, extent=self.extent, aspect=_aspect, **kwargs)
self.axes[0].set_xticks(np.linspace(self.extent[0], self.extent[1], 5),)
self.axes[0].set_xticklabels(np.round(np.linspace(self.extent[0], self.extent[1], 5),1))

Expand Down Expand Up @@ -1311,6 +1318,7 @@ def _mask_image(self):
in point_cloud attribute')

# minimal image size in 50x50px or equal to the number of point for dimensions

im_size = max(50, coord.shape[0])

_x0, _x1 = np.min(coord, axis=0)[0], np.max(coord, axis=0)[0]
Expand Down Expand Up @@ -2334,7 +2342,6 @@ def _update(self, ev=None):
leg.get_frame().set_linewidth(0.0)
self.fig.canvas.draw_idle()
self.fig.tight_layout()


class MultiImageStackVisualizer(object):
"""
Expand Down

0 comments on commit 95a711c

Please sign in to comment.