zixinyang9109 / LiverMatch

Learning Feature Descriptors for Pre- and Intra-operative Point Cloud Matching for Laparoscopic Liver Registration
MIT License
10 stars 1 forks source link

How to deform the preoperative point cloud to synthesize the intraoperative point cloud? #1

Closed RitianYu closed 1 year ago

RitianYu commented 1 year ago

I have a problem in deforming the source point clouds to get the target point cloud. I didn't find the part about simulating intraoperative point cloud in your programme. Can you show the specific code for generating intraoperative point cloud from the intraoperative point cloud to me? I will appreciate it if you can help me.

zixinyang9109 commented 1 year ago

Hello,you can find the code in the datasets/liver.py

RitianYu commented 1 year ago

I have read the code in the datasets/liver.py, but I find that you use tgt_pcd = entry['t_pc']/f_scale full_tgt_pcd = entry['t_pc_full']/f_scale What is entry['t_pc'] and what is entry['t_pc_full']? I think maybe you read the target point clouds directly from a specific file which you have stored the intraoperative point cloud after simualtion.

RitianYu commented 1 year ago
 def entry2data(self, index, scale=100.0, get_full=False):
        name = self.root_path+self.entries[index]

        with np.load(name, allow_pickle=True) as entry:
            # get transformation
            if 'max_dist' in entry.files:
                max_dist = entry['max_dist']
                f_scale = scale/max_dist
            else:
                f_scale = scale

            rot = entry['rot']
            trans = entry['trans']/f_scale
            s2t_flow = entry['s2t_flow']/f_scale
            src_pcd = entry['s_pc']/f_scale
            tgt_pcd = entry['t_pc']/f_scale
            full_tgt_pcd = entry['t_pc_full']/f_scale
            correspondences = entry['correspondences'] # from simulation
            if 'f_mask' in entry.files:
                f_mask = entry['f_mask']  # anterior face

        # if you want to search corr
        # tsfm = to_tsfm(rot, trans)
        # correspondences = get_correspondences(to_o3d_pcd(src_pcd), to_o3d_pcd(tgt_pcd), tsfm, self.overlap_radius)

        if get_full:
            return full_tgt_pcd, src_pcd, tgt_pcd
        else:
            return rot, trans, s2t_flow, src_pcd, tgt_pcd, correspondences, f_mask, scale

This is the function I think used for getting the intraoperative point cloud from the preoperative point cloud.

zixinyang9109 commented 1 year ago

Please use the deformation simulation in V2Snet to get the deformed source point cloud.

Then you can do random rigid transformation, crop and adding noise. This part is included in the part.

RitianYu commented 1 year ago

Ok,thanks a lot.

RitianYu commented 1 year ago

By the way, when I use the deformation simulation in V2Snet with my own dataset, do I need to adjust the hyperparameters of the simulation function? I tried to use the parameters consistent with those in V2Snet's source code, but the simulation deformation failed.

RitianYu commented 1 year ago

If I need to adjust some hyperparameters of the simulation function in V2Snet, could you tell me which hyperparameters are important and needed to change to fit my own dataset. For example, which hyperparameters are related to the deformation amplitude?

zixinyang9109 commented 1 year ago

Increasing the zero boundary area size will make the simulation more stable (less failure case). Increasing the force will increase the deformation amplitude.