PlusToolkit / PlusLib

Software library for data acquisition, pre-processing, and calibration for navigated image-guided interventions.
http://www.plustoolkit.org
Other
130 stars 102 forks source link

Reference tracking using NDI Polaris Vega ST returns global coordinates #1111

Open Mil228 opened 10 months ago

Mil228 commented 10 months ago

Hi all,

I have been struggling with an issue for quite a while and cannot seem to fix it myself. I am in need of your help! While using my config file in fCal, I seem to be able to connect to a Philips Epiq Ultrasound machine through DNL services and to a NDI Polaris Vega ST Optical tracker. My desired output would be an MHA file containing the transformation matrix from tool 449 (id='Geometry') to tool 339 (id='Reference'). I set my ToolReferenceFrame to 'Reference' and changed a few options but the tracking results in the MHA file () are still in global ('OpticalTracker') coordinates instead of relative tracked to the slightly moving 'Reference' tool. What am I doing wrong? Do I need to change the xml config completely? Note that I am not using any PlusOpenIGTLink output, I just need to be able to press record and save the relative tracking data to a MHA file. I also do not need the ImageToGeometry transform as I import my tracking data as well as the DNL data into Matlab and perform the transformations there. But the realtive tracking data is essential for this. Please, is there anyone that could help me? I would very much appreciate it!!

example_mha.txt example_config.txt

adamrankin commented 10 months ago

You have both a tool and a ToolReferenceFrame both named "Reference". Change your ToolReferenceFrame to "Tracker"

"OpticalTracker" is not a known coordinate system. After fixing the above, the transforms you can send are:

GeometryToReference
ReferenceToGeometry
GeometryToTracker
TrackerToGeometry

Is there a warning somewhere in your log?

Mil228 commented 10 months ago

Hi!

Thanks for the tip, will try your suggestion! The transforms are not send to the MHA file, correct? Do you know how I can send these transform to this output file? I tried adding the transforms in the ‘PlusOpenIGTLinkServer’ tag but didn’t see them in the MHA that’s why I ask. The only warning I could find for now is the ‘ReferenceToReference’ is not defined but this did not seem like a big problem to me?

Cheers!

adamrankin commented 10 months ago

I would check your log for warnings telling you it's not recording tracking due to a configuration error. I'd try fixing that and I bet they'll show up in your recordings

Mil228 commented 10 months ago

My log file gives me this (after changing the ToolReferenceFrame to Tracker):

|DEBUG|1101.454000| Application configuration file 'P:/PlusApp-2.8.0.20191105-Win64/bin/PlusConfig.xml' saved| in P:\workspace2\PlusLib\src\PlusCommon\vtkPlusConfig.cxx(536) |DEBUG|1101.471000| Device set configuration is read from file: C:\Users\s137228\Documents\OneDrive - TU Eindhoven\Config files\MEDUSA_test7.xml| in P:\workspace2\PlusLib\src\PlusCommon\vtkPlusConfig.cxx(249) |DEBUG|1101.473000| Device set configuration file contents: | in P:\workspace2\PlusLib\src\PlusCommon\vtkPlusConfig.cxx(252) |INFO|1101.476000| Connect to devices| in P:\workspace2\PlusApp\fCal\Toolboxes\QConfigurationToolbox.cxx(158) |DEBUG|1101.514000| StartupDelaySec: 1.000000| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDataCollector.cxx(108) |DEBUG|1101.516000| AveragedItemsForFiltering is not defined in source element "GeometryToTracker". Using default value: 20| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDataSource.cxx(401) |DEBUG|1101.518000| AveragedItemsForFiltering is not defined in source element "ReferenceToTracker". Using default value: 20| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDataSource.cxx(401) |INFO|1101.519000| OpticalTracker: Local time offset: -40ms| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDevice.cxx(1098) |WARNING|1101.520000| DnlDevice: ToolReferenceFrame is undefined. Default "(undefined)" will be used.| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDevice.cxx(958) |DEBUG|1101.547000| AveragedItemsForFiltering is not defined in source element "DnlFrameToDnlDevice". Using default value: 20| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDataSource.cxx(401) |INFO|1101.547000| DnlDevice: Local time offset: -40ms| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDevice.cxx(1098) |DEBUG|1101.548000| TrackedVideoDevice: Unable to find acquisition rate in device element when it is required, using default 50| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDevice.cxx(1050) |DEBUG|1101.548000| TrackedVideoDevice: Local time offset was not defined in device configuration| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDevice.cxx(1103) |DEBUG|1101.548000| OpticalTracker: vtkPlusDevice::Connect: OpticalTracker| in P:\workspace2\PlusLib\src\PlusDataCollection\vtkPlusDevice.cxx(1226) |DEBUG|1102.574000| NDI Command:INIT| in P:\workspace2\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(246) |DEBUG|1102.721000| NDI Reply: OKAY| in P:\workspace2\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(276) |DEBUG|1102.722000| NDI Command:PHSR:01| in P:\workspace2\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(246) |DEBUG|1102.724000| NDI Reply: 00| in P:\workspace2\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(276) |DEBUG|1102.725000| NDI Command:PHRQ:*****1****| in P:\workspace2\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(246) |DEBUG|1102.728000| NDI Reply: 01| in P:\workspace2\PlusLib\src\PlusDataCollection\NDICAPITracking\vtkPlusNDITracker.cxx(276)

It shows that for example “AveragedItemsForFiltering is not defined in source element "ReferenceToTracker". “ is not given, where could I add this? I tried multiple places within the config file but no luck yet. Furthermore, it shows that it will compute the GeometryToTRacker and ReferenceToTracker but why not the desired GeometryToReference?

adamrankin commented 10 months ago

You can change AveragedItemsForFiltering but it's not necessary. I would reduce your log level to INFO to make it easier to read and to filter out the unimportant entries.

I don't see where it says it won't compute GeometryToReference

Mil228 commented 10 months ago

Thank you, I will change it to info! Regarding the ‘GeometryToReference’, My .MHA file only returns “GeometryToTracker” and “ReferenceToTracker”, where can I add a tag in the config XML to also have my “GeometryToReference” returned? I am also fine with just the latter being returned and not having the global coordinates. I really need those relative positions for my tracking pipeline!

From: Adam Rankin @.> Sent: Wednesday, 13 September 2023 16:10 To: PlusToolkit/PlusLib @.> Cc: Gillissen, Milan @.>; Author @.> Subject: Re: [PlusToolkit/PlusLib] Reference tracking using NDI Polaris Vega ST returns global coordinates (Issue #1111)

You can change AveragedItemsForFiltering but it's not necessary. I would reduce your log level to INFO to make it easier to read and to filter out the unimportant entries.

I don't see where it says it won't compute GeometryToReference

— Reply to this email directly, view it on GitHubhttps://github.com/PlusToolkit/PlusLib/issues/1111#issuecomment-1717710818, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTZ2VFRB6SCXR65JAJPHFLX2G5CDANCNFSM6AAAAAA4UQMEBI. You are receiving this because you authored the thread.Message ID: @.**@.>>

adamrankin commented 10 months ago

In the <TransformNames> tag you choose which transforms to send to a client.

Mil228 commented 10 months ago

I have put the desired Transforms in the TransformNames tag as you can see here:

<PlusOpenIGTLinkServer MaxNumberOfIgtlMessagesToSend="1" MaxTimeSpentWithProcessingMs="50" ListeningPort="18944" SendValidTransformsOnly="TRUE" OutputChannelId="TrackerStream" >

But when I press Record in the Capturing tab of fCal, the recorded .MHA file (the output file generated by recording) only contains GeometryToTracker and ReferenceToTracker. What am I doing wrong?

adamrankin commented 10 months ago

Are there any warnings or errors in the log for that run?

Mil228 commented 10 months ago

No, not on this part at least. I got some rendering warnings/errors but that is because I am not trying to render anything and did not include that in the config file. I only want the GeometryToReference to appear in my capturing output. I have been looking at the file format here:

http://perk-software.cs.queensu.ca/plus/doc/nightly/user/FileSequenceFile.html

But haven't found what I have been looking for... Is there no transform that I can id in the device or somewhere to get this transformation to appear in my MHA (sequence output) file?

From: Adam Rankin @.> Sent: Wednesday, 13 September 2023 20:54 To: PlusToolkit/PlusLib @.> Cc: Gillissen, Milan @.>; Author @.> Subject: Re: [PlusToolkit/PlusLib] Reference tracking using NDI Polaris Vega ST returns global coordinates (Issue #1111)

Are there any warnings or errors in the log for that run?

- Reply to this email directly, view it on GitHubhttps://github.com/PlusToolkit/PlusLib/issues/1111#issuecomment-1718152799, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTZ2VGTBN5U24BTQLBV5CTX2H6MDANCNFSM6AAAAAA4UQMEBI. You are receiving this because you authored the thread.Message ID: @.**@.>>

adamrankin commented 7 months ago

I had not noticed you were using fCal. What channel have you selected when you choose to record?

Mil228 commented 7 months ago

Sorry for not closing this thread earlier, but I have found the solution by using this: http://perk-software.cs.queensu.ca/plus/doc/nightly/user/ApplicationEditSequenceFile.html

I will close the thread now!

From: Adam Rankin @.> Sent: Monday, 20 November 2023 15:23 To: PlusToolkit/PlusLib @.> Cc: Gillissen, Milan @.>; Author @.> Subject: Re: [PlusToolkit/PlusLib] Reference tracking using NDI Polaris Vega ST returns global coordinates (Issue #1111)

I had not noticed you were using fCal. What channel have you selected when you choose to record?

— Reply to this email directly, view it on GitHubhttps://github.com/PlusToolkit/PlusLib/issues/1111#issuecomment-1819161006, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALTZ2VFRC7JYTYXCBAJQLHDYFNRVLAVCNFSM6AAAAAA4UQMEBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJZGE3DCMBQGY. You are receiving this because you authored the thread.Message ID: @.**@.>>