[IGSTK-Users] Displaying spatial objects in 2D views

Patrick Cheng cheng at isis.georgetown.edu
Tue Mar 27 10:29:48 EDT 2007


Hi Sophie,

This is not a very convenient way to display an image, I have to use 
mouse to drag the image to the center every time after I loaded it.

If you read the thread on "image origin problem", I think jjina1028 had 
the same problem. You can take Luis's suggestion, or hack into the 
camera in View class and set the focus point to the image center.

We are considering refactoring the View class in the near future, we 
will cover your concern at that time.

Patrick

Sophie Blestel wrote:
> Hi,
> 
> So it isn't possible to represent a spatial objet on 2D views exept if 
> it is in the corner ?
> 
> 2007/3/26, Patrick Cheng <cheng at isis.georgetown.edu 
> <mailto:cheng at isis.georgetown.edu>>:
> 
>     Hi Sophie,
> 
>     Because the initial camera focus point is set to (0,0,0)
>     If your object is at location:
> 
>     transform.SetTranslation (100, 0.1, 1000);
> 
>     The object will appear at one of the four corners depending on the view
>     orientation(Axial, Coronal, and Sagittal). Because the camera will try
>     to accommodate everything in the window.
> 
>     I will try your code to see if there is any issue of the cone object.
> 
>     Patrick
> 
>     ---------- Original Message ----------------------------------
>     From: "Sophie Blestel" < sophie.blestel at gmail.com
>     <mailto:sophie.blestel at gmail.com>>
>     Date:  Mon, 26 Mar 2007 11:22:53 +0200
> 
>      >Hi,
>      >
>      >I try to display a cone in 3D and 2D views, with a location and
>     orientation
>      >given. But on the 2D views the cone remains in the origin (on the
>     right high
>      >corner ) (on the 3D views it is well represented).
>      >
>      >This is my code :
>      >
>      >First I declare and initialise the cone :
>      >    ConeType::Pointer m_Cone = ConeType::New();
>      >    ConeRepresentationType::Pointer m_ConeRepresentation     =
>      >ConeRepresentationType::New();
>      >
>      >    transform.SetTranslation (100, 0.1 , 1000);
>      >
>      >    m_Cone->RequestSetTransform( transform );
>      >    m_ConeRepresentation->RequestSetConeObject( m_Cone );
>      >
>      >
>      >I create my 4 views (Axial, Sagittal, Coronal and 3D) in a file
>     .FL as
>      >follows :
>      >    Fl_Box DisplaySagittal {
>      >          label {Display Sagittal}
>      >          xywh {550 0 380 330} box FLAT_BOX color 0 labelcolor 7
>      >          class {igstk::View2D}     }
>      >
>      >Then I set the orientation ok the 2D views :
>      >    DisplayAxial->RequestSetOrientation( View2D::Axial );
>      >    DisplaySagittal->RequestSetOrientation( View2D::Sagittal );
>      >    DisplayCoronal->RequestSetOrientation( View2D::Coronal );
>      >
>      >And I add the cone representation to the 2D and 3D views :
>      >    DisplayAxial->RequestAddObject( m_ConeRepresentation );   //
>     if I do
>      >m_ConeRepresentation->Copy() the cone disappears
>      >    DisplaySagittal->RequestAddObject( m_ConeRepresentation );
>      >    DisplayCoronal->RequestAddObject( m_ConeRepresentation );
>      >    Display3D->RequestAddObject( m_ConeRepresentation );
>      >
>      >For each view, I do :
>      >    DisplaySagittal->RequestResetCamera();
>      >    DisplaySagittal->Update();
>      >    DisplaySagittal->RequestEnableInteractions();
>      >    DisplaySagittal->RequestSetRefreshRate( 20 );
>      >    DisplaySagittal->RequestStart();
>      >
>      >And this is my loop :
>      >    while(m_tms->mainWindow->visible())
>      >    {
>      >        Fl::wait(0.05);
>      >        igstk::PulseGenerator::CheckTimeouts();
>      >        Fl::check();
>      >    }
>      >
>      >
>      >Thanks for helping me,
>      >
>      >Sophie
>      >
>      >
>      >
> 
> 



More information about the IGSTK-Users mailing list