[IGSTK-Users] Displaying spatial objects in 2D views
Sophie Blestel
sophie.blestel at gmail.com
Mon Mar 26 05:22:53 EDT 2007
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20070326/4f9aa414/attachment-0001.html>
More information about the IGSTK-Users
mailing list