Hi Tangi,
NavigationDataTransformFilter
(http://docs.mitk.org/nightly-qt4/classmitk_1_1NavigationDataTransformFilter.html)
is probably what you are looking for.
Best regards,
Jochen
Von: Tangi Meyer [mailto:[email protected]]
Gesendet: Montag, 30. November 2009 11:46
An: mitk-users
Betreff: Re: [mitk-users] How to add a constant rotation on IGT inputs from a
NDI Polaris?
Dear All,
I'm visualising a 3D object which position is controlled by an NDI tool.
However, the real world axis and the 3D world axis do not match so basically, I
need to either:
- add a permanent transform to the data node so that the PI/2 rotation is
applied after the tracking data collection but before rendering the object,
- add a step in the IGT pipeline where I rotate the Tracking data ...
What is the best solution and is there a sample code somewhere?
I looked into the mitkGeometry3DTest but there is only an example of rotation
applied to the geometry3D and it is bypassed when the IGT pipeline is activated.
Best regards,
Tangi
-------------------------------------
Tangi MEYER
Virtual and Augmented Reality
System and Software Engineer
Leuvensesteenweg 325
B-1932 Zaventem - Belgium
Telephone: +32 (0) 2 721 54 84
Fax: +32 (0) 2 721 54 44
-------------------------------------
----- Original Message -----
From: "Tangi Meyer" <[email protected]>
To: "mitk-users" <[email protected]>
Sent: Tuesday, 24 November, 2009 08:54:19 GMT +00:00 GMT Britain, Ireland,
Portugal
Subject: Re: [mitk-users] [CAMDASS] Camera viewport control and other IGT stuff.
Dear All,
Following my last email:
It seems there is a contradiction between those two methods from the
CameraVisualization class regarding the typing of the element in the
PropertyList.
void mitk::CameraVisualization::SetParameters( const mitk::PropertyList* p )
{
if (p == NULL)
return;
mitk::Vector3D doP;
if
(p->GetPropertyValue<mitk::Vector3D>("CameraVisualization_DirectionOfProjectionInToolCoordinates",
doP) == true) // search for DirectionOfProjectionInToolCoordinates parameter
this->SetDirectionOfProjectionInToolCoordinates(doP); // apply if found;
mitk::Vector3D vUp;
if
(p->GetPropertyValue<mitk::Vector3D>("CameraVisualization_ViewUpInToolCoordinates",
vUp) == true) // search for ViewUpInToolCoordinates parameter
this->SetViewUpInToolCoordinates(vUp); // apply if found;
float fL;
if (p->GetPropertyValue<float>("CameraVisualization_FocalLength", fL) ==
true) // search for FocalLength parameter
this->SetFocalLength(fL); // apply if found;
float vA;
if (p->GetPropertyValue<float>("CameraVisualization_ViewAngle", vA) == true)
// search for ViewAngle parameter
this->SetFocalLength(vA); // apply if found;
}
mitk::PropertyList::ConstPointer mitk::CameraVisualization::GetParameters()
const
{
mitk::PropertyList::Pointer p = mitk::PropertyList::New();
p->SetProperty("CameraVisualization_DirectionOfProjectionInToolCoordinates",
mitk::Vector3DProperty::New(this->GetDirectionOfProjectionInToolCoordinates()));
// store DirectionOfProjectionInToolCoordinates parameter
p->SetProperty("CameraVisualization_ViewUpInToolCoordinates",
mitk::Vector3DProperty::New(this->GetViewUpInToolCoordinates())); // store
ViewUpInToolCoordinates parameter
p->SetProperty("CameraVisualization_FocalLength",
mitk::Vector3DProperty::New(this->GetFocalLength())); // store FocalLength
parameter
p->SetProperty("CameraVisualization_ViewAngle",
mitk::Vector3DProperty::New(this->GetViewAngle())); // store ViewAngle
parameter
return mitk::PropertyList::ConstPointer(p);
}
Or Am I missing something?
When in my code I build my property list using FloatProperty, I get better
results.
p->SetProperty("CameraVisualization_DirectionOfProjectionInToolCoordinates",
mitk::Vector3DProperty::New(lookAtVector)); // store
DirectionOfProjectionInToolCoordinates parameter
p->SetProperty("CameraVisualization_ViewUpInToolCoordinates",
mitk::Vector3DProperty::New(lookUpVector)); // store ViewUpInToolCoordinates
parameter
p->SetProperty("CameraVisualization_FocalLength",
mitk::FloatProperty::New(10)); // store FocalLength parameter
p->SetProperty("CameraVisualization_ViewAngle",
mitk::FloatProperty::New(45)); // store ViewAngle parameter
So when I build a cone and define a new position for my camera (and then I
reset my render window), I can see the 3 slice panes with apparently the right
scaling and a correct point of vue. But I still cannot see my cone and the
error message regarding the mapper is still there.
Do you have any idea?
Best regards,
Tangi
-------------------------------------
Tangi MEYER
Virtual and Augmented Reality
System and Software Engineer
Leuvensesteenweg 325
B-1932 Zaventem - Belgium
Telephone: +32 (0) 2 721 54 84
Fax: +32 (0) 2 721 54 44
-------------------------------------
----- Original Message -----
From: "Tangi Meyer" <[email protected]>
To: "mitk-users" <[email protected]>, "Neuhaus Jochen"
<[email protected]>
Sent: Thursday, 19 November, 2009 16:39:17 GMT +00:00 GMT Britain, Ireland,
Portugal
Subject: Re: [mitk-users] [CAMDASS] Camera viewport control and other IGT stuff.
Hi Jochen,
Thanks for your quick answer.
I used the right button click to Global Reinit my scene. But it only force the
display of the black slice into the 3D renderer.
What is strange is that I get the following error message:
ERROR: In ..\..\Rendering\vtkPolyDataMapper.cxx, line 61
vtkPainterPolyDataMapper (121EE7B8): Mapper has no input.
ERROR: In ..\..\Rendering\vtkPolyDataMapper.cxx, line 61
vtkPainterPolyDataMapper (121F35A0): Mapper has no input.
ERROR: In ..\..\Filtering\vtkDemandDrivenPipeline.cxx, line 803
vtkStreamingDemandDrivenPipeline (121E8658): Input for connection index 0 on
input port index 0 for algorithm vtkCutter(121D7AF0) is NULL, but a vtkDataSet
is required.
ERROR: In ..\..\Filtering\vtkDemandDrivenPipeline.cxx, line 803
vtkStreamingDemandDrivenPipeline (121EB008): Input for connection index 0 on
input port index 0 for algorithm vtkCutter(121E2060) is NULL, but a vtkDataSet
is required.
My interpretation is that the node insertion of the geometry has not been
linked with the vtk mapper ... I'm trying to get a better understanding of VTK
rendering principles ...
The strange fact is that even with a simple vtk file (lungs.vtk) I have the
same issue.
I also tried to control the camera through the following code (from
mitkCameraVisualization.cpp) :
mitk::CameraVisualization::Pointer myFilter =
mitk::CameraVisualization::New();
mitk::PropertyList::Pointer p = mitk::PropertyList::New();
mitk::Vector3D lookAtVector;
mitk::FillVector3D(lookAtVector,0,0.,-800.);
mitk::Vector3D lookUpVector;
mitk::FillVector3D(lookUpVector,1.,0.,0.);
//mitk::FillVector3D(offset2, -1.2, 3.45, -6.789);
p->SetProperty("CameraVisualization_DirectionOfProjectionInToolCoordinates",
mitk::Vector3DProperty::New(lookAtVector)); // store
DirectionOfProjectionInToolCoordinates parameter
p->SetProperty("CameraVisualization_ViewUpInToolCoordinates",
mitk::Vector3DProperty::New(lookUpVector)); // store ViewUpInToolCoordinates
parameter
p->SetProperty("CameraVisualization_FocalLength",
mitk::Vector3DProperty::New(10)); // store FocalLength parameter
p->SetProperty("CameraVisualization_ViewAngle",
mitk::Vector3DProperty::New(45)); // store ViewAngle parameter
myFilter->SetParameters(p);
// set renderer
myFilter->SetRenderer(mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow()));
//Update filter
myFilter->Update();
But it does not seem to change anything.
Thank you for your support.
Tangi
-------------------------------------
Tangi MEYER
Virtual and Augmented Reality
System and Software Engineer
Leuvensesteenweg 325
B-1932 Zaventem - Belgium
Telephone: +32 (0) 2 721 54 84
Fax: +32 (0) 2 721 54 44
-------------------------------------
----- Original Message -----
From: "Neuhaus Jochen" <[email protected]>
To: "Tangi Meyer" <[email protected]>,
"[email protected]" <[email protected]>
Sent: Thursday, 19 November, 2009 13:32:42 GMT +00:00 GMT Britain, Ireland,
Portugal
Subject: AW: [mitk-users] [CAMDASS] Camera viewport control and other IGT stuff.
Hi Tangi,
If you haven’t already loaded a dataset, the renderer probably doesn’t have a
correct view geometry. Just rightclick a node in the datamanager and select
“Global Reinit”. This should reset the views so that the global bounding box
includes all existing objects at their current positions. You can get the same
by calling
mitk::RenderingManager::GetInstance()->InitializeViews(myDataStorage->ComputeBoundingGeometry3D(myDataStorage
->GetAll())); // reset render window geometry to include all objects
Best Regards,
Jochen
Von: Tangi Meyer [mailto:[email protected]]
Gesendet: Donnerstag, 19. November 2009 14:13
An: [email protected]
Betreff: [mitk-users] [CAMDASS] Camera viewport control and other IGT stuff.
Dear MITK users,
I'm trying to use IGT with our Polaris Spectra Passive Toolkit.
The IGT example module is used as a basis. So I've rebuilt a plugin which uses
most of the original IGT example plugin (I removed all recording and plotting).
My primary goal is to track and visualize the NDI rigid bodies into the 3D
window from the standard view.
So I reused code parts from the IGT tutorial and IGT testing.
Basically:
Draw a cone associated to my NDI device
mitk::Cone::Pointer cone = mitk::Cone::New(); //instantiate a
new cone
float scale[] = {100.0, 100.0, 100.0};
cone->GetGeometry()->SetSpacing(scale); //scale it a
little that so we can see something
mitk::DataTreeNode::Pointer node = mitk::DataTreeNode::New(); //generate a
new node to store the cone into
//the DataStorage.
node->SetData(cone); //The data of that node is our
cone.
node->SetName("My tracked object"); //The node has additional
properties like a name
node->SetColor(1.0, 0.0, 0.0); //or the color. Here we make it
red.
this->GetDefaultDataStorage()->Add(node); //After adding the Node with
the cone in it to the
//DataStorage, MITK will show the cone in the
//render windows.
//For updating the render windows we use another filter of the MITK-IGT
pipeline concept. The
//NavigationDataObjectVisualizationFilter needs as input a NavigationData and
a
//PolyData. In our case the input is the source and the PolyData our cone.
//First we create a new filter for the visualization update.
m_Visualizer = mitk::NavigationDataObjectVisualizationFilter::New();
m_Visualizer->SetInput(0, m_Source->GetOutput(0)); //Then we connect
to the pipeline.
m_Visualizer->SetBaseData(0, cone); //After that we have to assign the cone
to the input
Try to position the viewport camera as the NDI reference camera (in the middle
of the NDI IR cameras) so that my tracked object is in the field of view.
mitk::CameraVisualization::Pointer myFilter =
mitk::CameraVisualization::New();
//mitk::GlobalInteraction::GetInstance()->Initialize("global");
// Define position for the navigation data
mitk::NavigationData::PositionType position;
position[0] = 0;
position[1] = 0;
position[2] = 0;
// Define orientation for the navigation data
mitk::NavigationData::OrientationType orientation;
orientation[0] = 0;
orientation[1] = 0;
orientation[2] = 0;
orientation[3] = 1;
// set parameters of navigation data
mitk::NavigationData::Pointer nd1 = mitk::NavigationData::New();
nd1->SetPosition(position);
nd1->SetOrientation(orientation);
myFilter->SetInput(nd1);
// set renderer
myFilter->SetRenderer(mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow()));
//Update filter
myFilter->Update();
In order to make it simple, all this code is in the OnTestNavigation() method
of the plugin.
I did try to adapt my camera orientation but nothing is visible. Two objects
appear in the datamanager: My tracked Object and MyInstrument 0.
It is probably obvious so I'm digging in the documentation but any help is
appreciated.
Thanks.
Tangi
-------------------------------------
Tangi MEYER
Virtual and Augmented Reality
System and Software Engineer
Leuvensesteenweg 325
B-1932 Zaventem - Belgium
Telephone: +32 (0) 2 721 54 84
Fax: +32 (0) 2 721 54 44
-------------------------------------
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with Crystal
Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users