[Insight-users] Question About DeformableMesh3dFilter

zhao yong qiang zhao-yq at cs.sjtu.edu.cn
Fri, 12 Mar 2004 19:54:33 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0001_01C4086B.D6F686E0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi all,

     I wrote the following code:

 

   m_stiff[0] = 0.00001;

   m_stiff[1] = 0.04;

   m_scale[0] = 1;

   m_scale[1] = 1;

   m_scale[2] = 1;

 

m_BinaryMask3DMeshSource->SetBinaryImage(m_CastImageFilter->GetOutput())
;

m_BinaryMask3DMeshSource->SetObjectValue(200); 

 

m_GradientMapFilter->SetInput(gradientMagnitudeFilter->GetOutput());

m_GradientMapFilter->SetSigma(1.0);

m_GradientMapFilter->Update();

 

m_DeformableMesh3DFilter->SetStiffness(m_stiff);

m_DeformableMesh3DFilter->SetTimeStep(0.2);

m_DeformableMesh3DFilter->SetStepThreshold(10);

m_DeformableMesh3DFilter->SetScale(m_scale);

m_DeformableMesh3DFilter->SetGradientMagnitude(0.8);

 

m_DeformableMesh3DFilter->SetGradient(m_GradientMapFilter->GetOutput());

m_DeformableMesh3DFilter->SetInput(m_BinaryMask3DMeshSource->GetOutput()
);

 

try

{

        m_DeformableMesh3DFilter->Update();//At this point, access
violation 

}

catch(itk::ExceptionObject & excep) 

{

        std::cerr << "Exception Caught!"<<std::endl;

}

 

I use try/catch, but I can not catch the exception, just access
violation when m_DeformableMesh3Dfilter->Update()..

Can some give me a hand?

Thanks a lot!!!

Regards, 
                          Zhao Yongqiang
                          Dept. of Computer Science & Engineering
                          Shanghai JiaoTong University
                          Shanghai, China
                          zhao-yq at cs.sjtu.edu.cn

 


------=_NextPart_000_0001_01C4086B.D6F686E0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
  at font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
 at font-face
	{font-family:SimSun;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:justify;
	text-justify:inter-ideograph;
	font-size:10.5pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{font-family:Arial;
	color:windowtext;}
 /* Page Definitions */
  at page Section1
	{size:595.3pt 841.9pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	layout-grid:15.6pt;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DZH-CN link=3Dblue vlink=3Dpurple =
style=3D'text-justify-trim:punctuation'>

<div class=3DSection1 style=3D'layout-grid:15.6pt'>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>Hi
all,</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;&nbsp;&nbsp;
I wrote the following code:</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;
m_stiff[0] =3D 0.00001;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;
m_stiff[1] =3D 0.04;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;
m_scale[0] =3D 1;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;
m_scale[1] =3D 1;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;
m_scale[2] =3D 1;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_BinaryMask3DMeshSource-&gt=
;SetBinaryImage(m_CastImageFilter-&gt;GetOutput());</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_BinaryMask3DMeshSource-&gt=
;SetObjectValue(200);
</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_GradientMapFilter-&gt;SetI=
nput(gradientMagnitudeFilter-&gt;GetOutput());</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_GradientMapFilter-&gt;SetS=
igma(1.0);</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_GradientMapFilter-&gt;Upda=
te();</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetStiffness(m_stiff);</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetTimeStep(0.2);</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetStepThreshold(10);</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetScale(m_scale);</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetGradientMagnitude(0.8);</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetGradient(m_GradientMapFilter-&gt;GetOutput());</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>m_DeformableMesh3DFilter-&gt=
;SetInput(m_BinaryMask3DMeshSource-&gt;GetOutput());</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>try</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>{</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;
m_DeformableMesh3DFilter-&gt;Update();//At this point, access violation =
</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>}</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>catch(itk::ExceptionObject
&amp; excep) </span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>{</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;
std::cerr &lt;&lt; &quot;Exception =
Caught!&quot;&lt;&lt;std::endl;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>}</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>&nbsp;</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>I
use try/catch, but I can not catch the exception, just access violation =
when
m_DeformableMesh3Dfilter-&gt;Update()..</span></font></p>

<p class=3DMsoNormal align=3Dleft =
style=3D'text-align:left;text-autospace:none'><font
size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:9.0pt;font-family:SimSun'>Can
some give me a hand?</span></font></p>

<p class=3DMsoNormal><font size=3D1 face=3D&#23435;&#20307;><span =
style=3D'font-size:
9.0pt;font-family:SimSun'>Thanks a lot!!!</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
lang=3DEN-US
style=3D'font-size:10.0pt'>Regards, <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;
Zhao Yongqiang<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;
Dept. of Computer Science &amp; Engineering<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;
</span></font><font size=3D2><span lang=3DEN-US =
style=3D'font-size:10.0pt'>Shanghai</span></font><font
 size=3D2><span lang=3DEN-US style=3D'font-size:10.0pt'> =
</span></font><font size=3D2><span
  lang=3DEN-US style=3D'font-size:10.0pt'>JiaoTong</span></font><font =
size=3D2><span
 lang=3DEN-US style=3D'font-size:10.0pt'> </span></font><font =
size=3D2><span
  lang=3DEN-US style=3D'font-size:10.0pt'>University</span></font><font =
size=3D2><span
lang=3DEN-US style=3D'font-size:10.0pt'><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;
</span></font><font size=3D2><span lang=3DEN-US =
style=3D'font-size:10.0pt'>Shanghai</span></font><font
 size=3D2><span lang=3DEN-US style=3D'font-size:10.0pt'>, =
</span></font><font size=3D2><span
  lang=3DEN-US style=3D'font-size:10.0pt'>China</span></font><font =
size=3D2><span
lang=3DEN-US style=3D'font-size:10.0pt'><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;
<a =
href=3D"mailto:zhao-yq at cs.sjtu.edu.cn">zhao-yq at cs.sjtu.edu.cn</a></span><=
/font></p>

<p class=3DMsoNormal><font size=3D2 face=3D"Times New Roman"><span =
lang=3DEN-US>&nbsp;</span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0001_01C4086B.D6F686E0--