Algo for multiple annotations, with and without parent

Dear ImFusion Support,

I would like to create a custom algorithm within a plugin that works on one pointCloud in .ply format and multiple .ts recorded tracking streams. This is my createCompatible function

 bool RegistrationAlgorithm::createCompatible(const DataList& data, Algorithm** a) {
        if (data.size() == 2){       
            auto centerlines = data.getPointClouds();
            std::vector<TrackingStream *> trackingStreams = data.getTrackingStreams();
            if(centerlines.size()==1 && trackingStreams.size()>=1){
                if(a)
                    *a = new RegistrationAlgorithm(centerlines[0],trackingStreams);
                return true;
            } 
        }
        return false;
    }

The problem is that even if I select all of them in the GUI (both from the Data and from Global Annotation) and then click right, data never has a size > 1. I have also tested this with multiple tracking streams and that works.

Would you please help me in this matter?

Thank you!

Best,
Miruna

I am afraid this is a current limitation of our user interface concept: it is not possible to open an algorithm from the context menu with several items from the Data list on top of elements from the Annotation list.

This is because the way it works is that, when you right click on the Annotation list, the DataList given to the algorithms is the set of all selected point clouds, plus each point cloud’s parent (if it has one).

We are trying to think of the best way to solve this issue. In the meantime, there are some hacky workarounds:

  • One option is to can load the data and create the algorithm via a .iws workspace file. There you can manually specify the list of inputs as you wish:
        <property name="MyAlgorithm">
            <param name="execute">0</param>
            <param name="inputUids">"myPointCloudUID" "myTracking1UID" "myTracking2UID"</param>
        </property>

If you don’t execute it, the Suite should leave its controller open.

  • Another option is to duplicate the point cloud, assign one tracking stream as the parent of the first copy of the point cloud, and the second tracking stream as the parent of the second copy of the point cloud. That means that you can select the two point clouds and open the algorithm (since both parents will then be added to the data list). Of course that means that you need to slightly edit your createCompatible function to accept 2 points clouds but ignore the second one.

Hi Raphael,

Thank you for your answer!
For me, the first option would be more suitable, since I would like the algo to work with more than 2 tracking streams. Related to this approach I have some questions:

  1. How can we create the .iws file? Would something like this suffice?
<!--ImFusion Suite, 23.02.2022-->
<propertyfile version="1.1">
    <param name="workspaceVersion">16</param>
    <property name="MyAlgorithm">
           <param name="execute">0</param>
           <param name="inputUids">"myPointCloudUID" "myTracking1UID" "myTracking2UID"</param>
    </property>
</propertyfile>
  1. By “myPointCloudUID” or “myTracking1UID” you mean the uid (e.g data0, data1) that is given in consecutive order to the data we load?
  2. What would be the workflow? Do we first load the data with drag and drop, then load the .iws workspace file. Then we can click right and the algorithm would appear?
  3. How would I need to change the create compatible function?

Is there a documentation about how these workspace file work exactly after you load them? I m not sure I understand that.

Regarding the second approach:
How can we assign one tracking stream as the parent of a point cloud in the GUI?

Thanks again,
Miruna

If you go with this first approach, the loading of the data would need to also happen from the workspace file so that a inputUid can be assigned to each data (probably something data0, data1, etc by default), and you could then refer to them in the <param name="inputUids"> element of your algorithm configuration.
It might be easier to load the data manually in the Suite, and then either:

  • save the workspace file as Replay, and open it with a text editor in order to add your algorithm with the correct inputUids
  • use the workspace editor in the Suite (View>Workspace Editor) to add your algorithm with the correct input.

Note: Most of the workspace functionalities (i.e loading data and running algorithms) can also be done via the Python console, just have a look at the Python doc included in the installer.

Regarding your question with the second suggestion: you should just have to right click on the point cloud and “Move to”> select the data… but now that I am trying it I realize that for some reason, it is not possible to select tracking streams, so I guess that workaround is not possible after all.

Hi Raphael,

Thank you so much! Loading the data manually, then executing from the workspace editor works perfectly for me even for more than 2 tracking streams.

Have a nice day!

Cheers,
Miruna