Hi all,
When I add the mesh or point cloud generated in the following code to the Data List, it doesn’t get shown on the GUI. The label map I add (self.mask
) works fine.
@imfusion.Algorithm.action(display_name="To Mesh")
def extract_meshes(self):
if hasattr(self, 'vessel_mask_path') and self.vessel_mask_path != Path("") and os.path.exists(self.vessel_mask_path):
self.mask = imfusion.load(str(self.vessel_mask_path))
self.mask[0].modality = imfusion.Data.Modality.LABEL
print('Loaded label!')
# self.imageset_out.add(self.mask)
else:
print(f'Failed to load label! {self.vessel_mask_path}')
return imfusion.Algorithm.Status.ERROR
mesh = imfusion.execute_algorithm('Seg.LabelToMesh', self.mask)
pcds = imfusion.execute_algorithm('Base.MeshToPointCloud', mesh)
print(pcds)
pcd = imfusion.execute_algorithm('Base.CombinePointClouds', pcds)
print(pcd)
# imfusion.app.execute_algorithm('Mesh.MeshDistance', mesh)
imfusion.app.data_model.add(pcd)
imfusion.app.data_model.add(self.mask)
return imfusion.Algorithm.Status.SUCCESS
When I replaced imfusion.execute_algorithm
with imfusion.app.execute_algorithm
, I got a warning:
Could not dereference all input data while recording algorithm Base.CombinePointClouds
and still nothing was added to the data list.
Just to add a bit of context, the final goal would be to load the GT segmentation, and run mesh distance algorithm to compare it with the output of the segmentation network (which we get after calling compute).
First, can you please tell this code should add the merged point cloud to the data list, or if I should do anything differently? and second, considering the final goal, can I do it without adding the PCD or meshes to the data list?
Best,
Farid