[IGSTK-Users] Polaris Out of Volume Event Handling

Jiwon Jamie Ryu jjamieryu at melab.snu.ac.kr
Tue Sep 27 03:03:38 EDT 2011


Dear Arefin and Patrick,

Thanks Patrick for the help! It got me started.

But I think my code does not go into the functions inside
igstkNDITracker.cxx.

I included the last the line, 241 at igstkNDITracker.cxx

 const unsigned long mflags = (CommandInterpreterType::NDI_TOOL_IN_PORT |
                                CommandInterpreterType::NDI_INITIALIZED |
                                CommandInterpreterType::NDI_ENABLED |
                               CommandInterpreterType::NDI_OUT_OF_VOLUME);

 and added this at line 272
if (m_ToolStatusContainer[inputItr->first] ==
CommandInterpreterType::NDI_OUT_OF_VOLUME)
 {
       igstkLogMacro(DEBUG, "igstk::NDITracker::InternalUpdateStatus: "<<
       "tool" << inputItr->first <<" is out of volume\n");
       this->ReportTrackingToolVisible(
trackerToolContainer[inputItr->first] );
       cout<<"NDI TRACKER OUT OF VOLUME \n;
 }

and I changed line 356 :
 m_CommandInterpreter->TX(CommandInterpreterType::NDI_XFORMS_AND_STATUS
to

m_CommandInterpreter->TX(CommandInterpreterType::NDI_INCLUDE_OUT_OF_VOLUME);

Hmm...
But Nothing prints out.

I really appreciate your help, but could you help me out one more time?
The event doesn't seem to run. Perhaps I should change igstkTracker class?
I assumed that when I run polarisExample (which is similar to how I coded),
the events go through igstkNDITracker.cxx.

How can I get the *position* out from  MISSING of Out Of Volume status?

And I am also wondering if calling TX is right thing to do.. Maybe,
i should call BX(int mode) instead?
Thanks so much.

Sincerely,
Jamie.


On Fri, Sep 23, 2011 at 1:51 AM, Cheng, Patrick <
PCheng at childrensnational.org> wrote:

>  Hi Arefin and Jamie,****
>
> ** **
>
> To give you a few pointers on how IGSTK handles the “Out of Volume”
> situation, look into ****
>
> ** **
>
> igstkNDITracker.cxx line 386 ****
>
> ** **
>
> where we check the status of each tool and store them in tag containers:**
> **
>
> m_ToolAbsentStatusContainer and m_ToolStatusContainer****
>
> ___________________________________________________________________****
>
>       const int tstatus = ****
>
>         m_CommandInterpreter->GetTXTransform(ph, transformRecorded);****
>
> ** **
>
>       const int absent = (tstatus != CommandInterpreterType::NDI_VALID);**
> **
>
>       const int status = m_CommandInterpreter->GetTXPortStatus(ph);****
>
> ** **
>
>       if (!absent)****
>
>         {****
>
>         for( unsigned int i = 0; i < 8; i++ )****
>
>           {****
>
>           transform[i] = transformRecorded[i];****
>
>           }****
>
>         }****
>
> ** **
>
>       m_ToolAbsentStatusContainer[inputItr->first] = absent;****
>
>       m_ToolStatusContainer[inputItr->first] = status;****
>
>       m_ToolTransformBuffer[inputItr->first] = transform;****
>
> ___________________________________________________________________****
>
> ** **
>
> Here is more details on the return of the GetTXTransform() and
> GetTXPortStatus(), which is define in****
>
> igstkNDICommandInterpreter.h****
>
> ** **
>
> Notice that NDI_OUT_OF_VOLUME  is returned by GetTXPortStatus(), and is
> stored in m_ToolStatusContainer****
>
> ___________________________________________________________________****
>
>   /** GetTXTransform() and general-purpose transform return values */****
>
>   typedef enum****
>
>     {****
>
>     NDI_UNOCCUPIED   = 0x00, /**< port unoccupied or no information */****
>
>     NDI_VALID        = 0x01, /**< transform has been returned */****
>
>     NDI_MISSING      = 0x02, /**< tool is out of view or otherwise missing
> */****
>
>     NDI_DISABLED     = 0x04, /**< port is disabled or tool was unplugged
> */****
>
>     } TXTransformType;****
>
> ** **
>
>   /** GetTXPortStatus() return value bits */****
>
>   typedef enum****
>
>     {****
>
>     NDI_TOOL_IN_PORT          = 0x0001,****
>
>     NDI_SWITCH_1_ON           = 0x0002,****
>
>     NDI_SWITCH_2_ON           = 0x0004,****
>
>     NDI_SWITCH_3_ON           = 0x0008,****
>
>     NDI_INITIALIZED           = 0x0010,****
>
>     NDI_ENABLED               = 0x0020,****
>
>     NDI_OUT_OF_VOLUME         = 0x0040,****
>
>     NDI_PARTIALLY_IN_VOLUME   = 0x0080,****
>
>     NDI_DISTURBANCE_DETECTED  = 0x0200,****
>
>     NDI_SIGNAL_TOO_SMALL      = 0x0400,****
>
>     NDI_SIGNAL_TOO_BIG        = 0x0800,****
>
>     NDI_PROCESSING_EXCEPTION  = 0x1000,****
>
>     NDI_PORT_HARDWARE_FAILURE = 0x2000,****
>
>     } TXPortStatusType;****
>
> ___________________________________________________________________****
>
> ** **
>
> Here is where IGSTK checks the status and decide what to do:****
>
> ** **
>
> igstkNDITracker.cxx line 259****
>
> ___________________________________________________________________****
>
> // only report tools that are in view****
>
>     if (m_ToolAbsentStatusContainer[inputItr->first])****
>
>       {****
>
>       // there should be a method to set that the tool is not in view****
>
>       igstkLogMacro( DEBUG, "igstk::NDITracker::InternalUpdateStatus: " <<
> ****
>
>                      "tool " << inputItr->first << " is not in view\n");**
> **
>
> ** **
>
>       // report to the tracker tool that the tracker is not available ****
>
>       this->ReportTrackingToolNotAvailable( ****
>
>         trackerToolContainer[inputItr->first] );****
>
> ** **
>
>       ++inputItr;****
>
>       continue;****
>
>       }****
>
> __________________________________________________________________****
>
> ** **
>
> If you want to generate an OUT_OF_VOLUME event, you can do so here by
> checking ****
>
>     if (m_ToolStatusContainer[inputItr->first] ==
> CommandInterpreterType::NDI_OUT_OF_VOLUME)****
>
>       {****
>
>       // Throw an event or continue reporting invalid transform****
>
>       }****
>
> ** **
>
> I hope this helps,****
>
> ** **
>
> Patrick****
>
> ** **
>
> ** **
>
> *From:* igstk-users-bounces at public.kitware.com [mailto:
> igstk-users-bounces at public.kitware.com] *On Behalf Of *Arefin Shamsil
> *Sent:* Wednesday, September 21, 2011 10:56 PM
> *To:* Jiwon Jamie Ryu
> *Cc:* igstk-users at public.kitware.com; Patrick Cheng
> *Subject:* Re: [IGSTK-Users] Polaris Out of Volume Event Handling****
>
> ** **
>
> Hi Jamie,
>
> Can you tell me which program are your using to generate this log file? Is
> it one of the example provided in the IGSTK package?
>
> Arefin****
>
> On Wed, Sep 21, 2011 at 8:12 PM, Jiwon Jamie Ryu <
> jjamieryu at melab.snu.ac.kr> wrote:****
>
>
> Dear Arefin, ****
>
>  ****
>
> Thanks for helping me out. ****
>
> I get a error message like this: ****
>
> (for more information, I attached logFile) ****
>
>  ****
>
> 24602600819.35323  :    (INFO) 108. command[12] TX:0001031A\x0D
> 24602600819.371243  :    (INFO) 108. receive[107]
> 0201MISSING0000003100000086\x0A02+09374+00100-00057-03479-009692-000349-142149+002360000003100000086\x0A00008AA9\x0D
> ****
>
> From this, I want to change MISSING to position from a marker. ****
>
> Then, somehow, I think I need to change the command, and I am having
> difficulty with that. ****
>
> Thanks. ****
>
> Jamie. ****
>
>  ****
>
> On Wed, Sep 21, 2011 at 8:20 PM, Arefin Shamsil <marefin at uwo.ca> wrote:***
> *
>
> Hi Jiwon,
>
> I actually have the very same question. Can you kindly tell me how do you
> get the OOV error? I will try to work out your problem (since I am having
> the same problem) if I could know from you how you get that OOV error.
>
> Thanks & Regards
> Arefin ****
>
>
>
> On 21/09/11, *Jiwon Jamie Ryu *<jjamieryu at melab.snu.ac.kr> wrote: ****
>
> Hi all!****
>
> ** **
>
> I have question about event handling in igstk. ****
>
> I understand that igstkMacro works as user input, and that input goes into
> the event handling to state machine. ****
>
> And when the state moves to another state, I get the event . ****
>
> ** **
>
> Based on this, ****
>
> I want to get marker position when my polaris tracker shows OOV (out of
> volume). ****
>
> So I need to modify the igstkTracker code ( I think) to release marker
> position when the event says OOV error, instead of throwing error event. *
> ***
>
> I think that code is inside the TrackerUpdateStatusEvent in igstkTracker.h.
> ****
>
> But I don't know how to access to the event code. ****
>
> ** **
>
> Where can I find the code that throws events ? ****
>
> ** **
>
> Thank you very much. ****
>
> ** **
>
> Jamie Ryu. ****
>
> ** **
>
> ** **
>
> -- ****
>
> *-----------------------------------------------------------------*****
>
> * Jiwon Jamie Ryu *****
>
>  ****
>
> * PhD Candidate*****
>
>  Dept. Bioengineering
>  Seoul National University ****
>
>  TEL:    +82 10 8868 3678
>  Office: +82 2 2072 3128****
>
> *-------------------------------------------------------*-------------****
>
> ** **
>
>
>
>
> -- ****
>
> *-----------------------------------------------------------------*****
>
> * Jiwon Jamie Ryu *****
>
>  ****
>
> * PhD Candidate*****
>
>  Dept. Bioengineering
>  Seoul National University ****
>
>  TEL:    +82 10 8868 3678
>  Office: +82 2 2072 3128****
>
> *-------------------------------------------------------*-------------****
>
> ** **
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-users****
>
>
>
>
> --
> Arefin M. Shamsil
> Bachelor of Engineering (Electrical & Biomedical) - McMaster 2010
> Masters of Engineering Science - 2012
> Medical Science Building (M-114)
> The University of Western Ontario, London, ON****
>



-- 
*-----------------------------------------------------------------*
* Jiwon Jamie Ryu**
*
**
**
* PhD Candidate*
 Dept. Bioengineering
 Seoul National University
 TEL:    +82 10 8868 3678
 Office: +82 2 2072 3128
*-------------------------------------------------------*-------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-users/attachments/20110927/7fed20cd/attachment.html>


More information about the IGSTK-Users mailing list