Hi Szymon,
If you are referring to cloud_map topic (>=Kinetic version), the cloud is generated from local occupancy grids saved in graph's nodes. The grids are generated from
here. The cloud is actually created
here. To get the cloud of the node masked, you can filter the depth image prior to send it to rtabmap node.
To have more control of the 3D reconstruction from RGB/D data. You may subscribe to MapData topic and reconstruct the point cloud on your side. This will be similar to
MapCloudDisplay plugin in RVIZ or the point cloud shown in rtabmapviz. You may look at the MapCloudDisplay code to see how the map is regenerated from raw RGB-D data.
cheers,
Mathieu