+ orientation = orientation/2;
+ return orientation;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvImageContour::UpdateWithFastCacheMode() {
+clitkExceptionMacro("TODO : not implemented yet");
+
+ // Compute orientation
+ int orientation = ComputeCurrentOrientation();
+
+ if ((mPreviousSlice == mSlice) && (mPreviousOrientation == orientation)) return;
+
+ vtkActor * actor = mListOfCachedContourActors[orientation][mSlice];
+ if (actor != NULL) {
+ mListOfCachedContourActors[orientation][mSlice]->VisibilityOn();
+ } else {
+ CreateNewActor(0);
+ //SR: commented out, this code is never reached anyway
+ //UpdateActor(mSquaresActor, mSquares, mClipper, mValue, orientation, mSlice);
+ //mListOfCachedContourActors[orientation][mSlice] = mSquaresActor;
+ //mSquaresActor->VisibilityOn();
+ }
+
+ if (mListOfCachedContourActors[mPreviousOrientation][mPreviousSlice] != NULL)
+ mListOfCachedContourActors[mPreviousOrientation][mPreviousSlice]->VisibilityOff();
+ mPreviousSlice = mSlice;
+ mPreviousOrientation = orientation;
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+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)
+ clipper->SetInput(mHiddenImage->GetVTKImages()[0]);
+ else
+ clipper->SetInput(mSlicer->GetImage()->GetVTKImages()[numImage]);
+ squares->SetInput(clipper->GetOutput());
+ squaresMapper->SetInput(squares->GetOutput());
+ squaresMapper->ScalarVisibilityOff();
+ squaresActor->SetMapper(squaresMapper);
+ squaresActor->GetProperty()->SetColor(1.0,0,0);
+ 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);
+}
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+void vvImageContour::UpdateActor(vtkActor * actor,
+ vtkPolyDataMapper * mapper,
+ vtkMarchingSquares * squares,
+ vtkImageClip * clipper,
+ double threshold, int orientation, int slice) {