//------------------------------------------------------------------------------
vvImageContour::vvImageContour()
//------------------------------------------------------------------------------
vvImageContour::vvImageContour()
mTSlice = -1;
mSlice = 0;
mHiddenImageIsUsed = false;
mDisplayModeIsPreserveMemory = true;
SetPreserveMemoryModeEnabled(true);
mPreviousOrientation = -1;
mTSlice = -1;
mSlice = 0;
mHiddenImageIsUsed = false;
mDisplayModeIsPreserveMemory = true;
SetPreserveMemoryModeEnabled(true);
mPreviousOrientation = -1;
//------------------------------------------------------------------------------
vvImageContour::~vvImageContour()
//------------------------------------------------------------------------------
vvImageContour::~vvImageContour()
mSquaresActorList.clear();
}
//------------------------------------------------------------------------------
mSquaresActorList.clear();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvImageContour::RemoveActors()
//------------------------------------------------------------------------------
void vvImageContour::RemoveActors()
//------------------------------------------------------------------------------
void vvImageContour::SetSlicer(vvSlicer * slicer)
//------------------------------------------------------------------------------
void vvImageContour::SetSlicer(vvSlicer * slicer)
mSlicer = slicer;
// Create an actor for each time slice
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
mSlicer = slicer;
// Create an actor for each time slice
for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
//------------------------------------------------------------------------------
void vvImageContour::SetImage(vvImage::Pointer image)
//------------------------------------------------------------------------------
void vvImageContour::SetImage(vvImage::Pointer image)
for (unsigned int numImage = 0; numImage < image->GetVTKImages().size(); numImage++) {
#if VTK_MAJOR_VERSION <= 5
mClipperList[numImage]->SetInput(image->GetVTKImages()[numImage]);
for (unsigned int numImage = 0; numImage < image->GetVTKImages().size(); numImage++) {
#if VTK_MAJOR_VERSION <= 5
mClipperList[numImage]->SetInput(image->GetVTKImages()[numImage]);
//------------------------------------------------------------------------------
void vvImageContour::SetPreserveMemoryModeEnabled(bool b)
//------------------------------------------------------------------------------
void vvImageContour::SetPreserveMemoryModeEnabled(bool b)
// FastCache mode work only if threshold is always the same
if (mDisplayModeIsPreserveMemory == b) return;
mDisplayModeIsPreserveMemory = b;
// FastCache mode work only if threshold is always the same
if (mDisplayModeIsPreserveMemory == b) return;
mDisplayModeIsPreserveMemory = b;
//------------------------------------------------------------------------------
void vvImageContour::SetColor(double r, double g, double b)
//------------------------------------------------------------------------------
void vvImageContour::SetColor(double r, double g, double b)
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetColor(r,g,b);
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetColor(r,g,b);
//------------------------------------------------------------------------------
void vvImageContour::SetLineWidth(double w)
//------------------------------------------------------------------------------
void vvImageContour::SetLineWidth(double w)
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetLineWidth(w);
}
for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
mSquaresActorList[i]->GetProperty()->SetLineWidth(w);
}
//------------------------------------------------------------------------------
void vvImageContour::HideActors()
//------------------------------------------------------------------------------
void vvImageContour::HideActors()
//------------------------------------------------------------------------------
void vvImageContour::ShowActors()
//------------------------------------------------------------------------------
void vvImageContour::ShowActors()
//------------------------------------------------------------------------------
void vvImageContour::SetDepth(double d)
//------------------------------------------------------------------------------
void vvImageContour::SetDepth(double d)
mDepth = d;
// Move the actor to be visible
double position[3] = {0, 0, 0};
mDepth = d;
// Move the actor to be visible
double position[3] = {0, 0, 0};
//------------------------------------------------------------------------------
void vvImageContour::Update(double value)
//------------------------------------------------------------------------------
void vvImageContour::Update(double value)
//------------------------------------------------------------------------------
void vvImageContour::UpdateWithPreserveMemoryMode()
//------------------------------------------------------------------------------
void vvImageContour::UpdateWithPreserveMemoryMode()
// Only change actor visibility if tslice change
mPreviousTslice = mTSlice;
mTSlice = mSlicer->GetTSlice();
// Only change actor visibility if tslice change
mPreviousTslice = mTSlice;
mTSlice = mSlicer->GetTSlice();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvImageContour::InitializeCacheMode()
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void vvImageContour::InitializeCacheMode()
clitkExceptionMacro("TODO : not implemented yet");
mPreviousSlice = mPreviousOrientation = 0;
int dim = mSlicer->GetImage()->GetNumberOfDimensions();
clitkExceptionMacro("TODO : not implemented yet");
mPreviousSlice = mPreviousOrientation = 0;
int dim = mSlicer->GetImage()->GetNumberOfDimensions();
//------------------------------------------------------------------------------
int vvImageContour::ComputeCurrentOrientation()
//------------------------------------------------------------------------------
int vvImageContour::ComputeCurrentOrientation()
//------------------------------------------------------------------------------
void vvImageContour::UpdateWithFastCacheMode()
//------------------------------------------------------------------------------
void vvImageContour::UpdateWithFastCacheMode()
//------------------------------------------------------------------------------
void vvImageContour::CreateNewActor(int numImage)
//------------------------------------------------------------------------------
void vvImageContour::CreateNewActor(int numImage)
vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
vtkSmartPointer<vtkActor> squaresActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::New();
squaresMapper->ScalarVisibilityOff();
squaresActor->SetMapper(squaresMapper);
squaresActor->GetProperty()->SetColor(1.0,0,0);
squaresMapper->ScalarVisibilityOff();
squaresActor->SetMapper(squaresMapper);
squaresActor->GetProperty()->SetColor(1.0,0,0);
squaresActor->SetPickable(0);
squaresActor->VisibilityOff();
mSlicer->GetRenderer()->AddActor(squaresActor);
squaresActor->SetPickable(0);
squaresActor->VisibilityOff();
mSlicer->GetRenderer()->AddActor(squaresActor);
vtkMarchingSquares * squares,
vtkImageClip * clipper,
double threshold, int orientation, int slice)
vtkMarchingSquares * squares,
vtkImageClip * clipper,
double threshold, int orientation, int slice)
// Set parameter for the MarchigSquare
squares->SetValue(0, threshold);
// Set parameter for the MarchigSquare
squares->SetValue(0, threshold);