If you already have a binary labelmap then setting a reference image geometry will have no effect.

One option is to create closed surface representation, delete the binary labelmap representation, then create binary labelmap representation (it will be generated from the closed surface representation, using the reference image geometry).

Another option is to resample the labelmap representation as it is done here. I’ll add this code as a method to the vtkSlicerSegmentationGeometryLogic class to make it more easily accessible from Python.

take two (n>1 actually but lets take 2 for simplicity) same patient CT, obtained at different days, segment a structure in one of them.
Purpose: obtain the volume evolution in time of the structure.

Option 1:
Segment the same structure in the second CT.
Advantage: Each segmentation has the geometry of the respective time CT
Disadvantage: Not scalable for many time points and many structures

Option 2:
Segment in the first CT; Elastic transform the second; measure
Advantage: Easily scalable
Disadvantage: The volume does not change in time because the original segmentation is not recalculated for the geometry of the rest of the time points

Option 3:
Segment in the first CT; get the elastic transformation without modifying the second; get the inverse of that transformation and apply to the respective segmentation; measure
Advantage: Easily scalable
Disadvantage: The volume does not change in time because the original segmentation is not recalculated for the geometry of the rest of the time points

I tried to do options 2 and 3 without success, because the lines above doesn’t produce the same result as the option 1 (I can live with some % difference due to difference in segmentation, but not more than 20% as showed).
Doing the master geometry change manually does the trick in both 2 and 3 as showed. So I need to reproduce this programatically.

Do you mean that you use Segment Statistics to compute the volume, but the transform is only taken into account if you harden it?

In recent Slicer Preview Releases, you can use vtkSlicerSegmentationGeometryLogic::ResampleLabelmapsInSegmentationNode method to resample the labelmap. However, in recent Slicer Preview Releases, Segment Statistics module already hardens any transforms on a copy of the segmentation node, so the volume computation should be correct.