[Insight-users] Problem in obtaining world position with vtkSeedWidget
Karthik Krishnan
karthik.krishnan at kitware.com
Wed Jan 12 01:03:36 EST 2011
The default representation for the individual handles created by
vtkSeedRepresentation is a 2D rep (vtkPointHandleRepresentation2D). It
does not have a notion of Z coordinate since its rendered on the
overlay plane. If you want 3D seeds, change the default handle
representation to an instance of vtkPointHandleRepresentation3Dvia :
vtkSeedRepresentation::SetHandleRepresentation
On 1/11/11, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:
> Dear Users,
>
>
>
> I am trying to get world position by
> SeedRepresentation->GetSeedWorldPosition(I, pos). But comparing with other
> software, I got the wrong value in z coordinate. The values of x and y
> coordinates are correct. I would appreciate if anyone can point me in the
> right direction.
>
>
>
> Thanks,
>
> Yang
>
>
>
> 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 << "Point placed, total of: "
>
> << this->SeedRepresentation->GetNumberOfSeeds() << std::endl;
>
> }
>
> if(event == vtkCommand::InteractionEvent)
>
> {
>
> if(calldata)
>
> {
>
> std::cout << "Interacting with seed : "
>
> << *(static_cast< int * >(calldata)) << std::endl;
>
> }
>
> }
>
>
>
> std::cout << "List of seeds (Display coordinates):" << std::endl;
>
>
>
> for(vtkIdType i = 0; i < this->SeedRepresentation->GetNumberOfSeeds();
> i++)
>
> {
>
> double pos[3];
>
> this->SeedRepresentation->GetSeedWorldPosition(i, pos);
>
> std::cout << "(" << pos[0] << " " << pos[1] << " " << pos[2] << ")"
> << std::endl;
>
> }
>
>
>
> }
>
>
>
> void SetRepresentation(vtkSmartPointer<vtkSeedRepresentation> rep)
> {this->SeedRepresentation = rep;}
>
> private:
>
> vtkSmartPointer<vtkSeedRepresentation> SeedRepresentation;
>
> };
>
>
More information about the Insight-users
mailing list