[Insight-developers] Exceptions and ResetPipeline

Miller, James V (Research) millerjv@crd.ge.com
Fri, 16 May 2003 13:54:18 -0400


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C31BD4.2C3FED36
Content-Type: text/plain;
	charset="iso-8859-1"

I moved a line of code in ProcessObject that cause one test to fail, so I
thought I would pass along this information.
 
ProcessObject has an ivar m_Updating that keeps track of whether a given
instance is in the process of updating.  This flag is used to protect the
pipeline from recursive updates.  A VTK user notices a problem with VTK when
Update() occurred
during a ProgressEvent.  In VTK (and ITK), the above flag was being cleared
too soon.  Following the suggestion for how to fix in this VTK, I moved the
clearing of this flag down a few lines in the code.
 
This caused the itkFastMarchingExtensionImageFilterTest to fail.  It turns
out this test intentially forces the pipeline to throw an exception.  This
exercises the exception code.  The test catches the exception and continues
to use the pipeline.  However, when a ProcessObject throws an exception, the
flag mentioned above is not cleared and the subsequent calls to Update()
will fail because the pipeline thinks it is already in the process of
updating.
 
The fix is rather simple.  If you catch an exception from a pipeline, you
need to call ResetPipeline() on the tails of the pipeline (the call is
propagated up the pipeline).  This will clear this flag and allow the
pipeline to function normally again.
 
 

Jim Miller 
_____________________________________
Visualization & Computer Vision
GE Research
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301

millerjv@research.ge.com <mailto:millerjv@research.ge.com> 

james.miller@research.ge.com
(518) 387-4005, Dial Comm: 8*833-4005, 
Cell: (518) 505-7065, Fax: (518) 387-6981 

 

------_=_NextPart_001_01C31BD4.2C3FED36
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=502314617-16052003>I moved a line of 
code in ProcessObject that cause one test to fail, so I thought I would pass 
along this information.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=502314617-16052003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=502314617-16052003>ProcessObject has an 
ivar m_Updating that keeps track of whether a given instance is in the process 
of updating.&nbsp; This flag is used to protect the pipeline from recursive 
updates.&nbsp; A VTK user notices a problem with VTK when Update() 
occurred</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=502314617-16052003>during a 
ProgressEvent.&nbsp; In VTK (and ITK), the above flag was being cleared too 
soon.&nbsp; Following the suggestion for how to fix in this VTK, I moved the 
clearing of this flag down a few lines in the code.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=502314617-16052003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=502314617-16052003>This caused the 
itkFastMarchingExtensionImageFilterTest to fail.&nbsp; It turns out this test 
intentially forces the pipeline to throw an exception.&nbsp; This exercises the 
exception code.&nbsp; The test catches the exception and continues to use the 
pipeline.&nbsp; However, when a ProcessObject throws an exception, the flag 
mentioned above is not cleared and the subsequent calls to Update() will fail 
because the pipeline thinks it is already in the process of 
updating.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=502314617-16052003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=502314617-16052003>The fix is rather 
simple.&nbsp; If you catch an exception from a pipeline, you need to call 
ResetPipeline() on the tails of the pipeline (the call is propagated up the 
pipeline).&nbsp; This will clear this flag and allow the pipeline to function 
normally again.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>
<P style="MARGIN: 0in 0in 0pt"><B><SPAN 
style="COLOR: navy; FONT-FAMILY: 'Comic Sans MS'">Jim Miller</SPAN></B> 
<BR><B><I><SPAN 
style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: Arial">_____________________________________</SPAN></I></B><BR><EM><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Visualization &amp; 
Computer Vision</SPAN></EM><I><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial"><BR><EM>GE 
Research</EM><BR><EM>Bldg. KW, Room C218B</EM><BR><EM>P.O. Box 8, Schenectady NY 
12301</EM><BR><BR></SPAN></I><EM><U><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: blue"><A 
href="mailto:millerjv@research.ge.com">millerjv@research.ge.com</A></SPAN></U></EM></P>
<P style="MARGIN: 0in 0in 0pt"><EM><U><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: blue">james.miller@research.ge.com</SPAN></U></EM><BR><I><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">(518) 387-4005, Dial 
Comm: 8*833-4005, </SPAN></I><BR><I><SPAN 
style="FONT-SIZE: 7.5pt; COLOR: black; FONT-FAMILY: Arial">Cell: (518) 505-7065, 
Fax: (518) 387-6981</SPAN></I> </P></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------_=_NextPart_001_01C31BD4.2C3FED36--