Convert VTK-m-Contour output to vtkPolyData

Im trying to convert my contour output back to a vtkPolyData object and I’m having trouble to figure out the correct parameters for the fromvtkm::Convert method.

Here’s my code:

#include <vtkmlib/ImageDataConverter.h>
#include <vtkmlib/PolyDataConverter.h>

void execute() {
    //reader is a meta image reader which is successfully used in a VTK pipeline.
	vtkm::cont::DataSet dataSet = tovtkm::Convert(reader->GetOutput(), tovtkm::FieldsFlag::PointsAndCells);

    vtkm::filter::Contour contour;
	contour.SetActiveField("MetaImage");
	contour.SetNumberOfIsoValues(2);
    // scalar range is calculated as the dataset is read
	contour.SetIsoValue(0, scalarRange[0] + 50);
	contour.SetIsoValue(1, scalarRange[1] - 50);

	dataSet.PrintSummary(std::cout);
	vtkm::cont::DataSet outData = contour.Execute(dataSet);
	outData.PrintSummary(std::cout);

	vtkNew<vtkPolyData> polyData;
	vtkDataSet* dataSet; // not sure how this should be fed or where it should come from

    // following line fails
	if (fromvtkm::Convert(outData, polyData, dataSet)) {
		vtkNew<vtkPolyDataMapper> polyMapper;
		polyMapper->SetInputData(polyData);
		polyMapper->Update();

		this->leftActor = vtkSmartPointer<vtkActor>::New();
		this->leftActor->SetMapper(polyMapper);

		this->leftRenderer->AddActor(this->rightActor);
		this->leftActor->SetPosition(0, 0, 0);
		this->leftRenderer->ResetCamera();
	}
}

Output of the PrintSummary before contour:

DataSet:
  CoordSystems[1]
    Coordinate System    coords assoc= Points valueType=class vtkm::Vec<float,3> storageType=struct vtkm::cont::StorageTagUniformPoints 5461344 values occupying 65536128 bytes [(0,0,0) (1,0,0) (2,0,0) ... (298,323,55) (299,323,55) (300,323,55)]
  CellSet
  StructuredCellSet:
   UniformConnectivity<3> pointDim[301 324 56]
  Fields[1]
   MetaImage assoc= Points valueType=unsigned char storageType=struct vtkm::cont::StorageTagBasic 5461344 values occupying 5461344 bytes [0 0 0 ... 0 0 10]

And after countour:

DataSet:
  CoordSystems[1]
    Coordinate System    coordinates assoc= Points valueType=class vtkm::Vec<float,3> storageType=struct vtkm::cont::StorageTagBasic 159072 values occupying 1908864 bytes [(204,32,1) (205,32,1) (206,32,1) ... (161,137,42) (160,137,42) (161,137,42)]
  CellSet
   CellSetSingleType: Type=5
   CellPointIds:
     Shapes: valueType=unsigned char storageType=struct vtkm::cont::StorageTagConstant 318212 values occupying 318212 bytes [5 5 5 ... 5 5 5]
     Connectivity: valueType=__int64 storageType=struct vtkm::cont::StorageTagBasic 954636 values occupying 7637088 bytes [0 342 309 ... 159067 159071 159069]
     Offsets: valueType=__int64 storageType=struct vtkm::cont::StorageTagCounting 318213 values occupying 2545704 bytes [0 3 6 ... 954630 954633 954636]
   PointCellIds:
     Not Allocated
  Fields[1]
   MetaImage assoc= Points valueType=unsigned char storageType=struct vtkm::cont::StorageTagBasic 159072 values occupying 159072 bytes [0 0 0 ... 239 214 239]

The exception is thrown in the if-evaluation in method fromvtkm::Convert:

Run-Time Check Failure #3 - The variable 'dataSet' is being used without being initialized.

Obviously im not feeding the right parameters, but what is actually needed?
Parameter const vtkm::cont::DataSet& voutput is the VTK-m output.
Parameter vtkPolyData* output is the Polydata object to be filled.
Parameter vtkDataSet* input no idea. Should this be the cell set?

I can’t find proper documentation telling me what to do here.

Thankful for any help provided.

Best regards,
David

Fixed the problem. Found out that the third parameter must be the original input before Converting to vtkm.

How is the parameter supposed to be filled when the data set was imported with vtkm?