Program: bbtk
Module: $RCSfile: bbvtkImagePlanes.cxx,v $
Language: C++
- Date: $Date: 2008/10/08 14:46:44 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2008/10/14 08:53:14 $
+ Version: $Revision: 1.8 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void ImagePlanes::bbUserConstructor()
{
- Init();
+ planeWidgetX = planeWidgetY = planeWidgetZ = 0;
bbSetInputIn(0);
std::vector<double> vect;
vect.push_back(512);
void ImagePlanes::bbUserCopyConstructor()
{
- Init();
+ planeWidgetX = planeWidgetY = planeWidgetZ = 0;
}
void ImagePlanes::Init()
{
-
+ if (planeWidgetX != 0) return;
// The shared picker enables us to use 3 planes at one time
// and gets the picking order right
vtkCellPicker* picker = vtkCellPicker::New();
picker->SetTolerance(0.005);
- // The 3 image plane widgets are used to probe the dataset.
+ // The 3 image plane widgets
planeWidgetX = vtkImagePlaneWidget::New();
planeWidgetX->DisplayTextOn();
planeWidgetX->SetPicker(picker);
prop2->SetColor(1, 1, 0);
planeWidgetY->SetLookupTable(planeWidgetX->GetLookupTable());
- // for the z-slice, turn off texture interpolation:
- // interpolation is now nearest neighbour, to demonstrate
- // cross-hair cursor snapping to pixel centers
planeWidgetZ = vtkImagePlaneWidget::New();
planeWidgetZ->DisplayTextOn();
planeWidgetZ->SetPicker(picker);
bbSetOutputPlaneZ(planeWidgetZ);
picker->UnRegister(NULL);
- // planeWidgetX->Register(NULL);
- // planeWidgetY->Register(NULL);
- // planeWidgetZ->Register(NULL);
}
//---------------------------------------------------------------------
void ImagePlanes::bbUserDestructor()
{
- //planeWidgetX->UnRegister(NULL);//Delete();
- //planeWidgetY->UnRegister(NULL);//Delete();
- //planeWidgetZ->UnRegister(NULL);//Delete();
- planeWidgetX->Delete();
- planeWidgetY->Delete();
- planeWidgetZ->Delete();
+
+ if (planeWidgetX) planeWidgetX->UnRegister(NULL);
+ if (planeWidgetY) planeWidgetY->UnRegister(NULL);
+ if (planeWidgetZ) planeWidgetZ->UnRegister(NULL);
+
}
//---------------------------------------------------------------------
{
if (bbGetInputIn()!=0)
{
+ Init();
+
int xMin, xMax, yMin, yMax, zMin, zMax;
bbGetInputIn()->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax);