-void vvImageContour::CreateNewActor(vtkActor ** actor,
- vtkMarchingSquares ** squares,
- vtkImageClip ** clipper,
- int numImage) {
- vtkActor * mSquaresActor = (*actor = vtkActor::New());
- vtkImageClip * mClipper = (*clipper = vtkImageClip::New());
- vtkMarchingSquares * mSquares = (*squares = vtkMarchingSquares::New());
- vtkPolyDataMapper * mSquaresMapper = vtkPolyDataMapper::New();
-
- if (mHiddenImageIsUsed)
- mClipper->SetInput(mHiddenImage->GetVTKImages()[0]);
- else
- mClipper->SetInput(mSlicer->GetImage()->GetVTKImages()[numImage]);
- mSquares->SetInput(mClipper->GetOutput());
- mSquaresMapper->SetInput(mSquares->GetOutput());
- mSquaresMapper->ScalarVisibilityOff();
- mSquaresActor->SetMapper(mSquaresMapper);
- mSquaresActor->GetProperty()->SetColor(1.0,0,0);
- mSquaresActor->SetPickable(0);
- mSquaresActor->VisibilityOff();
- mSlicer->GetRenderer()->AddActor(mSquaresActor);
+void vvImageContour::CreateNewActor(int numImage)
+{
+ vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
+ vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
+ vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
+ vtkSmartPointer<vtkPolyDataMapper> squaresMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
+
+ if (mHiddenImageIsUsed) {
+#if VTK_MAJOR_VERSION <= 5
+ clipper->SetInput(mHiddenImage->GetVTKImages()[0]);
+#else
+ clipper->SetInputData(mHiddenImage->GetVTKImages()[0]);
+#endif
+ } else {
+#if VTK_MAJOR_VERSION <= 5
+ clipper->SetInput(mSlicer->GetImage()->GetVTKImages()[numImage]);
+#else
+ clipper->SetInputData(mSlicer->GetImage()->GetVTKImages()[numImage]);
+#endif
+ }
+#if VTK_MAJOR_VERSION <= 5
+ squares->SetInput(clipper->GetOutput());
+ squaresMapper->SetInput(squares->GetOutput());
+#else
+ squares->SetInputConnection(clipper->GetOutputPort(0));
+ squaresMapper->SetInputConnection(squares->GetOutputPort(0));
+#endif
+ squaresMapper->ScalarVisibilityOff();
+ squaresActor->SetMapper(squaresMapper);
+ squaresActor->GetProperty()->SetColor(1.0,0,0);
+ squaresActor->GetProperty()->SetOpacity(0.995); //in order to get VTK to turn on the alpha-blending in OpenGL
+ squaresActor->SetPickable(0);
+ squaresActor->VisibilityOff();
+ mSlicer->GetRenderer()->AddActor(squaresActor);
+
+ mSquaresActorList.push_back(squaresActor);
+ mClipperList.push_back(clipper);
+ mSquaresList.push_back(squares);
+ mSquaresMapperList.push_back(squaresMapper);