Skip to content

Commit

Permalink
Merge pull request #55 from ch-sa/ch-sa/fix-path
Browse files Browse the repository at this point in the history
Use Path in dialogs and drop nan points
  • Loading branch information
ch-sa authored Jan 23, 2022
2 parents 0be71e4 + 8b261a9 commit 21f6ad6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion labelCloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.0"
__version__ = "0.7.1"
5 changes: 4 additions & 1 deletion labelCloud/control/pcd_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ def load_pointcloud(self, path_to_pointcloud: str) -> PointCloud:
points = bin_pcd.reshape((-1, 4))[
:, 0:3
] # Reshape and drop reflection values
points = points[~np.isnan(points).any(axis=1)] # drop rows with nan
self.current_o3d_pcd = o3d.geometry.PointCloud(
o3d.utility.Vector3dVector(points)
)
else: # Load point cloud with open3d
self.current_o3d_pcd = o3d.io.read_point_cloud(str(path_to_pointcloud))
self.current_o3d_pcd = o3d.io.read_point_cloud(
str(path_to_pointcloud), remove_nan_points=True
)

tmp_pcd = PointCloud(path_to_pointcloud)
tmp_pcd.points = np.asarray(self.current_o3d_pcd.points).astype(
Expand Down
4 changes: 1 addition & 3 deletions labelCloud/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
f_handler.setLevel(logging.DEBUG) # TODO: Filter colors

# Create formatters and add it to handlers
f_handler.setFormatter(
logging.Formatter("%(asctime)s - %(levelname)-8s: %(message)s [%(name)s]")
)
f_handler.setFormatter(logging.Formatter("%(asctime)s - %(levelname)-8s: %(message)s"))


logging.basicConfig(
Expand Down
22 changes: 14 additions & 8 deletions labelCloud/view/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,14 @@ def update_mode_status(self, mode: str) -> None:
self.mode_status.setText(text)

def change_pointcloud_folder(self) -> None:
path_to_folder = QFileDialog.getExistingDirectory(
self,
"Change Point Cloud Folder",
directory=config.get("FILE", "pointcloud_folder"),
path_to_folder = Path(
QFileDialog.getExistingDirectory(
self,
"Change Point Cloud Folder",
directory=config.get("FILE", "pointcloud_folder"),
)
)
if not path_to_folder or path_to_folder.isspace():
if not path_to_folder.is_dir():
logging.warning("Please specify a valid folder path.")
else:
self.controller.pcd_manager.pcd_folder = path_to_folder
Expand All @@ -599,10 +601,14 @@ def change_pointcloud_folder(self) -> None:
logging.info("Changed point cloud folder to %s!" % path_to_folder)

def change_label_folder(self) -> None:
path_to_folder = QFileDialog.getExistingDirectory(
self, "Change Label Folder", directory=config.get("FILE", "label_folder")
path_to_folder = Path(
QFileDialog.getExistingDirectory(
self,
"Change Label Folder",
directory=config.get("FILE", "label_folder"),
)
)
if not path_to_folder or path_to_folder.isspace():
if not path_to_folder.is_dir():
logging.warning("Please specify a valid folder path.")
else:
self.controller.pcd_manager.label_manager.label_folder = path_to_folder
Expand Down

0 comments on commit 21f6ad6

Please sign in to comment.