How to import a transfer function exported from ParaView into VTK?

Dear all,

here is how I import a ParaView exported transfer function into VTK:

class transfer_function
{
public:
  explicit transfer_function  (const std::string& filepath)
  {
    std::ifstream   file_stream(filepath);
    vtkJson::Reader reader;
    vtkJson::Value  root;
    reader.parse(file_stream, root);

    std::vector<double> points    ;
    std::vector<double> rgb_points;
    for (auto& iteratee : root["Points"   ]) points    .push_back(iteratee.asFloat());
    for (auto& iteratee : root["RGBPoints"]) rgb_points.push_back(iteratee.asFloat());
    opacity_function->FillFromDataPointer(points    .size(), points    .data());
    color_function  ->FillFromDataPointer(rgb_points.size(), rgb_points.data());
    color_function  ->SetColorSpace      (root["ColorSpace"].asInt());
  }
  transfer_function           (const transfer_function&  that) = default;
  transfer_function           (      transfer_function&& temp) = default;
 ~transfer_function           ()                               = default;
  transfer_function& operator=(const transfer_function&  that) = default;
  transfer_function& operator=(      transfer_function&& temp) = default; 

  vtkSmartPointer<vtkPiecewiseFunction>     opacity_function = vtkSmartPointer<vtkPiecewiseFunction>    ::New();
  vtkSmartPointer<vtkColorTransferFunction> color_function   = vtkSmartPointer<vtkColorTransferFunction>::New();
};

I then load up an unstructured volume exported from ParaView and set its color and opacity transfer functions.

  ug_volume->GetProperty()->SetColor        (transfer_function.color_function  );
  ug_volume->GetProperty()->SetScalarOpacity(transfer_function.opacity_function);

Which makes the volume completely disappear. If I remove these two lines, the volume renders and is semi-transparent gray, meaning the default transfer function works.

Any ideas on what I’m doing wrong?