<div dir="ltr"><div><div><div>Hi Abdelkhalek,<br></div>ITK does not involve any Graphical User Interface, and thus, user interaction does not fit in ITK's framework.<br></div><br>The issue (and the code) you describe are related to VTK.<br><br>I am sure that you will be able to find useful examples concerning this on VTK's wiki [1].<br><br></div>HTH,<br>JON HAITZ<br><br><br>[1] <a href="http://www.vtk.org/Wiki/VTK/Examples">http://www.vtk.org/Wiki/VTK/Examples</a><br><div><div><div><div><div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><table style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium" align="center" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><br></td></tr></tbody></table><div><div dir="ltr"></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On 7 April 2016 at 22:34, Abdelkhalek Bakkari <span dir="ltr"><<a href="mailto:bakkari.abdelkhalek@hotmail.fr" target="_blank">bakkari.abdelkhalek@hotmail.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<div><div dir="ltr"><font face="Times New Roman,sans-serif" color="#000000" size="3">Hi !</font><div><font face="Times New Roman,sans-serif" color="#000000" size="3"><br></font></div><div><font face="Times New Roman, sans-serif" size="3"><font color="#000000">I would like to interact the button of my keyboard in order to modify the position of a 3D object (translation) using up or down or left or right buttons.<br></font><br>I created the following piece of code but it does not give results :</font></div><div><font face="Times New Roman, sans-serif" size="3">------------------------------------------------------------------------------------------------------------</font></div><div><div style="margin:10px 8px"><div><div style="direction:ltr;line-height:1.28;overflow:hidden;padding:0px"><div style="min-height:26px;margin-left:36px"><span style="line-height:20.48px;white-space:pre-wrap;background-color:rgb(254,254,254)"><font face="Times New Roman, sans-serif" size="3">class KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera
{      
  public:
    static KeyPressInteractorStyle* New();
    vtkTypeMacro(KeyPressInteractorStyle, vtkInteractorStyleTrackballCamera);
   

    virtual void OnKeyPress() 
    {
                double handpos[3]={8.0,2.0, 0.0};
      // Get the keypress
      vtkRenderWindowInteractor *rwi = this->Interactor;
         // vtkRenderer *rend=new(vtkRenderer);
      std::string key = rwi->GetKeySym();
 
      // Output the key that was pressed
      std::cout << "Pressed " << key << std::endl;
 
      // Handle an arrow key
     if(key == "Up")
        { 
                
        std::cout << "The up arrow was pressed." << std::endl;
                
//      act->SetPosition(handpos[0]+1, handpos[1], handpos[2]);
            myTrans->Translate(handpos[0]+1, handpos[1], handpos[2]);        
                handpos[0]++;
            act->SetPosition(handpos[0], handpos[1], handpos[2]);

                renderer->Render();
                renderWindow->Render();
        }
          
      // Handle a "normal" key
      if(key == "Down")
        {
        std::cout << "The a key was pressed." << std::endl;
                handpos[0]++;
                        act->SetPosition(handpos[0], handpos[1], handpos[2]);
                renderer->Render();
                        renderWindow->Render();
        }
           // Handle a "normal" key
      if(key == "Right")
        {
        std::cout << "The Right key was pressed." << std::endl;
                handpos[2]++;
                        act->SetPosition(handpos[0], handpos[1], handpos[2]);
                renderer->Render();
                renderWindow->Render();
                        

        }
          if(key== "Left")
          {
                  std::cout << "The left key was pressed." << std::endl;
                  handpos[2]++;
                act->SetPosition(handpos[0], handpos[1], handpos[2]);
                renderer->Render();
                renderWindow->Render();
          }
      // Forward events
      vtkInteractorStyleTrackballCamera::OnKeyPress();
    }
 
};</font></span></div><div style="margin-left:36px"></div></div></div></div><div style="margin:10px 8px 3px"><div style="line-height:16px;background-color:rgb(237,238,241)"><font face="Times New Roman, sans-serif" size="3"><br></font></div></div>------------------------------------------------------------------------------------------------------------------</div><div><br></div><div>Best regards, </div><span class=""><font color="#888888"><div><br></div><div><br><font face="Garamond" size="3">Abdelkhalek Bakkari</font><div><span style="line-height:14px"><font face="Garamond" size="3">Ph.D candidate in Computer Science</font></span></div><div><span style="line-height:20.8267px;background-color:rgb(255,255,255)"><font face="Garamond" size="3">Institute of Applied Computer Science</font></span></div><div><span style="line-height:18.4px"><font face="Garamond" size="3">Lodz University of Technology, Poland</font></span></div><div><span style="line-height:18.4px"><font face="Garamond" size="3"><br></font></span></div><div><br></div></div>                                     </font></span></div></div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br>_______________________________________________<br>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/mailman/listinfo/community" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/community</a><br>
<br></blockquote></div><br></div></div></div></div></div></div></div>