Forum

Author Topic: Export Select Specific Point Cloud in multiples Chunks on multiples .psx  (Read 315 times)

mrv2020

  • Newbie
  • *
  • Posts: 20
    • View Profile
Hi,

I have been using a script that works perfectly for defining shapes and exporting pointclouds through the shape label.

Due to the size of some dense clouds I had to run the 'filter dense cloud' to reduce and stay for a future consultation with the original cloud.

At this moment, I am encountering a certain difficulty.

The script needs to be run for the active dense cloud in each of the chunks, which leads to a manual process of activating the chunk and the cloud.

The projects are composed of multiple situations.
1. A psz file with a single chunk and a single point cloud.
2. A psz file with several chunks and one or more point cloud.

To solve this I noticed that in version 1.4.0 DenseCloud.label was added, so I started to differentiate the point clouds by the respective labels "original" and "reduced1" "reduced2" "reduced'n '" in each chunk.

At the moment of running the code I can't get DenseCloud.label to work, as well as the script to run regardless of the amount of chunks and pointclouds.

I tried to use cloud.key but it didn't work very well, because sometimes more than one type of filtering is done and it loses its order.

Code: [Select]
label = shape.label

chunk.exportPoints(path + "/" + label + "/PointCloud/" + label + "_MDT.LAZ", source_data=Metashape.DenseCloudData , format=Metashape.PointsFormatLAZ, classes = [ Metashape.PointClass.Ground] )

best regards,

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 12742
    • View Profile
Hello mrv2020,

To modify the label of the active dense cloud in the chunk:
Code: [Select]
chunk.dense_cloud.label = "Dense Cloud - Reduced " + str(chunk.dense_cloud.key)
Best regards,
Alexey Pasumansky,
Agisoft LLC

mrv2020

  • Newbie
  • *
  • Posts: 20
    • View Profile
Hi Alexey,

Very good! Worked perfectly! Thank you so much again!

best regards,

mrv2020

  • Newbie
  • *
  • Posts: 20
    • View Profile
Hi Alexey,

And how to call and activate the dense cloud through its nominal label?

Best,

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 12742
    • View Profile
Hello mrv2020,

You need to create some custom function, for example:
Code: [Select]
def set_active_cloud_by_label(chunk, label):
    for dense_cloud in chunk.dense_clouds:
        if dense_cloud.label == label:
            chunk.dense_cloud = dense_cloud
            return 1
   return 0
Best regards,
Alexey Pasumansky,
Agisoft LLC