- mMesh=mesh;
-
- mMarching=vtkMarchingSquares::New();
- mTimeSlice=time_slice;
- if (static_cast<unsigned int>(time_slice)<mMesh->GetNumberOfMeshes())
- mMarching->SetInput(mMesh->GetMask(time_slice));
- else
- mMarching->SetInput(mMesh->GetMask(0));
- mMarching->SetValue(0,0.5);
- //mMarching->Update();
-
- mMapper=vtkPolyDataMapper::New();
- mMapper->SetInput(mMarching->GetOutput());
- //The following line allows to display the contour over the image
- //(http://www.nabble.com/What-happens-when-two-actors-are-at-the-same-depth--td23175458.html)
- vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
- mActor=vtkActor::New();
- mActor->SetMapper(mMapper);
- mActor->SetPickable(false);
- mActor->GetProperty()->EdgeVisibilityOn();
- mActor->GetProperty()->SetEdgeColor(mMesh->r,mMesh->g,mMesh->b);
- mActor->GetProperty()->SetLineWidth(2.);
+ mMesh=mesh;
+
+ mMarching=vtkMarchingSquares::New();
+ mTimeSlice=time_slice;
+ if (static_cast<unsigned int>(time_slice)<mMesh->GetNumberOfMeshes()) {
+#if VTK_MAJOR_VERSION <= 5
+ mMarching->SetInput(mMesh->GetMask(time_slice));
+#else
+ mMarching->SetInputData(mMesh->GetMask(time_slice));
+#endif
+ } else {
+#if VTK_MAJOR_VERSION <= 5
+ mMarching->SetInput(mMesh->GetMask(0));
+#else
+ mMarching->SetInputData(mMesh->GetMask(0));
+#endif
+ }
+ mMarching->SetValue(0,0.5);
+ //mMarching->Update();
+
+ mMapper=vtkPolyDataMapper::New();
+#if VTK_MAJOR_VERSION <= 5
+ mMapper->SetInput(mMarching->GetOutput());
+#else
+ mMapper->SetInputConnection(mMarching->GetOutputPort());
+#endif
+ //The following line allows to display the contour over the image
+ //(http://www.nabble.com/What-happens-when-two-actors-are-at-the-same-depth--td23175458.html)
+ vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
+ mActor=vtkActor::New();
+ mActor->SetMapper(mMapper);
+ mActor->SetPickable(false);
+ mActor->GetProperty()->EdgeVisibilityOn();
+ mActor->GetProperty()->SetEdgeColor(mMesh->r,mMesh->g,mMesh->b);
+ mActor->GetProperty()->SetLineWidth(2.);
+ mActor->GetProperty()->SetOpacity(0.995); //in order to get VTK to turn on the alpha-blending in OpenGL