Is it possible to change scalar field value?

Questions related to plugins development
Post Reply
Lucien
Posts: 37
Joined: Wed Jun 08, 2016 7:51 am

Is it possible to change scalar field value?

Post by Lucien »

Helle, is there a function to set scalar field value?
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is it possible to change scalar field value?

Post by daniel »

There's no option to change the scalar field value of a single point (at least with the graphical interface - it's of course possible with the code).

You can add a scalar field with a custom value for all points. And you can also save the cloud as an ASCII file, edit it and reload it.
Daniel, CloudCompare admin
Lucien
Posts: 37
Joined: Wed Jun 08, 2016 7:51 am

Re: Is it possible to change scalar field value?

Post by Lucien »

I wanted to modify the scalar value by ccGenericPointCloud::setPointScalarValue(index,scalar). But it crashed.
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is it possible to change scalar field value?

Post by daniel »

If you use the generic accessors, then first you have to make sure there's an active scalar field (as most of the cloud classes can handle multiple scalar fields, you have to set which one is the default one. You'll have to use the higher level class (ChunkedPointCloud? ccGenericPointCloud? ccPointCloud?) to do that. Generally with the 'setCurrentScalarField' method.

Then of course this scalar field must have as much values as the number of points (i.e. currentSize is at least as big as the cloud size). If it's empty you have to 'add' the values the first time (with addElement).
Daniel, CloudCompare admin
Lucien
Posts: 37
Joined: Wed Jun 08, 2016 7:51 am

Re: Is it possible to change scalar field value?

Post by Lucien »

I add a scalar field and set scalar values by a pushbutton.
Capture.PNG
Capture.PNG (16.21 KiB) Viewed 17056 times
The values are changed but histogram is disable.
Capture1.PNG
Capture1.PNG (50.18 KiB) Viewed 17056 times
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Is it possible to change scalar field value?

Post by daniel »

If you modify a scalar field, you must call 'computeMinAndMax' once all modifications are done (it updates the min and max values that are used by many tools and widgets).
Daniel, CloudCompare admin
Post Reply