class vtkSeedCallback : public vtkCommand
{
public:
static vtkSeedCallback *New()
{
return new vtkSeedCallback;
}
vtkSeedCallback() {}
virtual void Execute(vtkObject*, unsigned long event, void *calldata)
{
if (event == vtkCommand::PlacePointEvent)
{
std::cout << "Placing point..." << std::endl;
std::cout << "There are now " << this->SeedRepresentation->GetNumberOfSeeds() << " seeds." << std::endl;
for(unsigned int seedId = 0; seedId < this->SeedRepresentation->GetNumberOfSeeds(); seedId++)
{
double pos[3];
this->SeedRepresentation->GetSeedWorldPosition(0, pos);
std::cout << "Seed " << seedId << " : (" << pos[0] << " " << pos[1] << " " << pos[2] << ")" << std::endl;
seed_pos[0] = pos[0];seed_pos[1] = pos[1];seed_pos[2] = pos[2];
}
return;
}
if (event == vtkCommand::InteractionEvent)
{
std::cout << "Interaction..." << std::endl;
if (calldata)
{
double pos[3];
this->SeedRepresentation->GetSeedWorldPosition(0, pos);
std::cout << "Moved to (" << pos[0] << " " << pos[1] << " " << pos[2] << ")" << std::endl;
}
return;
}
}
void SetRepresentation(vtkSmartPointer<vtkSeedRepresentation> rep)
{
this->SeedRepresentation = rep;
}
void SetWidget(vtkSmartPointer<vtkSeedWidget> widget)
{
this->SeedWidget = widget;
}
private:
vtkSeedRepresentation* SeedRepresentation;
vtkSeedWidget* SeedWidget;
public:
int seed_pos[3];
};
{
public:
static vtkSeedCallback *New()
{
return new vtkSeedCallback;
}
vtkSeedCallback() {}
virtual void Execute(vtkObject*, unsigned long event, void *calldata)
{
if (event == vtkCommand::PlacePointEvent)
{
std::cout << "Placing point..." << std::endl;
std::cout << "There are now " << this->SeedRepresentation->GetNumberOfSeeds() << " seeds." << std::endl;
for(unsigned int seedId = 0; seedId < this->SeedRepresentation->GetNumberOfSeeds(); seedId++)
{
double pos[3];
this->SeedRepresentation->GetSeedWorldPosition(0, pos);
std::cout << "Seed " << seedId << " : (" << pos[0] << " " << pos[1] << " " << pos[2] << ")" << std::endl;
seed_pos[0] = pos[0];seed_pos[1] = pos[1];seed_pos[2] = pos[2];
}
return;
}
if (event == vtkCommand::InteractionEvent)
{
std::cout << "Interaction..." << std::endl;
if (calldata)
{
double pos[3];
this->SeedRepresentation->GetSeedWorldPosition(0, pos);
std::cout << "Moved to (" << pos[0] << " " << pos[1] << " " << pos[2] << ")" << std::endl;
}
return;
}
}
void SetRepresentation(vtkSmartPointer<vtkSeedRepresentation> rep)
{
this->SeedRepresentation = rep;
}
void SetWidget(vtkSmartPointer<vtkSeedWidget> widget)
{
this->SeedWidget = widget;
}
private:
vtkSeedRepresentation* SeedRepresentation;
vtkSeedWidget* SeedWidget;
public:
int seed_pos[3];
};