[vtkusers] Read data from Callback function

David Doria daviddoria at gmail.com
Tue May 28 09:20:27 EDT 2013


On Thu, May 23, 2013 at 4:59 PM, Massinissa Bandou
<Massinissa.Bandou at usherbrooke.ca> wrote:
> Hi David,
>
> This code is compiling if you run it you can see that it doesn't fill the
> matrix well while picking with "P".
>
> Is there any norme how to display code on vtkmaillist?
> thx for your advice and help!!

First a few comments:

1) I'm not sure if you can disable "html mode" when sending to the
mailing list, but this code:

  std::cout << "Pos :

seems to come through as:

  std::cout&lt;&lt;&quot;Pos :

2) Inside vtkMyCallback, this:

vtkMyCallback::vtkMyCallback(){SelectedActor = NULL;}

should just be

vtkMyCallback(){SelectedActor = NULL;}

(I get an "Extra qualification" error).

3) If you are using "using namespace std;", then you do not need to
use "std::vector" - you can simply use "vector".

4) To fix the warning "No current renderer on the interactor style" I
saw when pressing 'p' to pick, I added:

renderWindowInteractor->GetInteractorStyle()->SetCurrentRenderer(renderer);

and the necessary

#include <vtkInteractorStyle.h>

Now onto the real question. I'm not sure what you mean by "doesn't
fill the matrix well". I see that you are creating an ImgRegistration
object in main, and another one in vtkMyCallback. Did you mean to have
one of them be a pointer to the other? Otherwise, it seems to be doing
exactly what you are telling it to.

David



More information about the vtkusers mailing list