[vtkusers] Res: vtkSeedWidget
Wagner Sales
wsalles2003 at yahoo.com.br
Mon Aug 11 18:32:03 EDT 2008
Hi,
I'm on the same problem (using vtkSeedWidget and points does not disappear after slice change), and after a lot of google search, this message appears ( :) ). But I have some questions:
From Karthik: What is the output display bounds of the result of vtkImageReslice. I
presume you are passing it through to vtkImageActor. If the display
bounds, as you scroll through slices do change, the seeds should
appear and disappear automatically.
Since the ImageActor doesn't have a SetBounds() method and ImageReslice doesn't have a GetBounds() method, how to do this? .
Another question:
When I call a the following on my callback, on Execute(vtkObject*, unsigned long, void*) method:
if( event == vtkCommand::PlacePointEvent)
{
std::cout << "A point are placed!"<< std::endl;
cout << "Point placed, total of:" << this->SeedRepresentation->GetNumberOfSeeds() << "\n";
double vc[3];
double wc[3];
this->SeedRepresentation->GetSeedWorldPosition(this->SeedRepresentation->GetNumberOfSeeds() - 1, vc);
this->SeedRepresentation->GetSeedDisplayPosition(this->SeedRepresentation->GetNumberOfSeeds() - 1, wc);
std::cout << "Printing the word coordinate: " << vc[0] << ", " << vc[1] << ", " << vc[2] << std::endl;
std::cout << "Printing the display coordinate: " << wc[0] << ", " << wc[1] << ", " << wc[2] << std::endl;
}
The output never show a valid Z value. If are in display coordinate, are every times 0 ( which I think are correct, since I'm are using a 2D viewer ).
But and in world coordinate? My access of this value of course are wrong. Can someone help me with these?
Sorry by the newbie question and thanks in advance,
Wagner Sales
----- Mensagem original ----
De: Ken Urish <ken.urish at gmail.com>
Para: Karthik Krishnan <karthik.krishnan at kitware.com>; vtkusers at vtk.org
Enviadas: Terça-feira, 29 de Abril de 2008 13:44:07
Assunto: Re: [vtkusers] vtkSeedWidget
Karthik
Yes I am passing vtkImageReslice through an actor.
No, I am not declaring any bounds on the reslice. I am using the
example based off the ImageReslice test file. I assume I should set
the bounds in the Reslice callback (below). Could you offer me what
command to use? I dont see object that looks like it will set bounds?
I really appreciate your help with this, I was up most of last night
trying to power through it.
Thanks, Ken
//------------------------------------------------------------------------------
// IMAGE RESLICE CALLBACK
// The mouse motion callback, to turn "Slicing" on and off
//-------------------------------------------------------------------------------
class vtkImageInteractionCallback : public vtkCommand
{
public:
static vtkImageInteractionCallback *New() {
return new vtkImageInteractionCallback; };
vtkImageInteractionCallback() {
this->Slicing = 0;
this->ImageReslice = 0;
this->Interactor = 0; };
void SetImageReslice(vtkImageReslice *reslice) {
this->ImageReslice = reslice; };
vtkImageReslice *GetImageReslice() {
return this->ImageReslice; };
void SetInteractor(vtkRenderWindowInteractor *interactor) {
this->Interactor = interactor; };
vtkRenderWindowInteractor *GetInteractor() {
return this->Interactor; };
virtual void Execute(vtkObject *, unsigned long event, void *)
{
vtkRenderWindowInteractor *interactor = this->GetInteractor();
int lastPos[2];
interactor->GetLastEventPosition(lastPos);
int currPos[2];
interactor->GetEventPosition(currPos);
if (event == vtkCommand::LeftButtonPressEvent)
{
this->Slicing = 1;
}
else if (event == vtkCommand::LeftButtonReleaseEvent)
{
this->Slicing = 0;
}
else if (event == vtkCommand::MouseMoveEvent)
{
if (this->Slicing)
{
vtkImageReslice *reslice = this->ImageReslice;
// Increment slice position by deltaY of mouse
int deltaY = (lastPos[1] - currPos[1]);
reslice->GetOutput()->UpdateInformation();
double sliceSpacing = reslice->GetOutput()->GetSpacing()[2];
vtkMatrix4x4 *matrix = reslice->GetResliceAxes();
// move the center point that we are slicing through
double point[4];
double center[4];
point[0] = 0.0;
point[1] = 0.0;
point[2] = sliceSpacing * deltaY;
point[3] = 1.0;
std::cout<<point[2]<<std::endl;
matrix->MultiplyPoint(point, center);
matrix->SetElement(0, 3, center[0]);
matrix->SetElement(1, 3, center[1]);
matrix->SetElement(2, 3, center[2]);
interactor->Render();
}
else
{
vtkInteractorStyle *style = vtkInteractorStyle::SafeDownCast(
interactor->GetInteractorStyle());
if (style)
{
style->OnMouseMove();
}
}
}
};
On Tue, Apr 29, 2008 at 8:31 AM, Karthik Krishnan
<karthik.krishnan at kitware.com> wrote:
> The Seed widget uses a vtkHandleWidget internally for each seed, with
> the default representation being the 3D vtkPointHandleRepresentation3D
> class. The resulting primitives exist in world coordinates (and not on
> the overlay plane). So they should disappear when you move to the next
> slice.
>
> What is the output display bounds of the result of vtkImageReslice. I
> presume you are passing it through to vtkImageActor. If the display
> bounds, as you scroll through slices do change, the seeds should
> appear and disappear automatically.
>
> HTH
> --
> karthik
>
>
>
> On Tue, Apr 29, 2008 at 9:30 AM, Ken Urish <ken.urish at gmail.com> wrote:
> > Hey all,
> >
> > Im using vtkSeedWidget on a 3D image that I am viewing through
> > ImageReslice. When I place my seed points on a 2D slice, how can I
> > have the seed points disappear when I move to the next slice? Im
> > moving through ~100 slices and I dont want them building up. Is this
> > even possible? I appreciate the help.
> >
> > Thanks
> > --Ken--
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
>
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080811/ea62cd4f/attachment.htm>
More information about the vtkusers
mailing list