<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:6637995;
        mso-list-type:hybrid;
        mso-list-template-ids:2130446702 201785359 201785369 201785371 201785359 201785369 201785371 201785359 201785369 201785371;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1
        {mso-list-id:1797024773;
        mso-list-type:hybrid;
        mso-list-template-ids:-1242937046 201785359 201785369 201785371 201785359 201785369 201785371 201785359 201785369 201785371;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=DE-AT link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>Hi itkusers,<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-GB>I have cylinder which can be oriented in any
angle in 3D space. I calculate the direction of cylinder using hessian and
eigen value analysis.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>My goal is to draw the intensity profile of
the plane perpendicular to the cylinder direction. The size of the plane is 30
x 30 with the current<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Point (point for which the hessian is
calculate) as center. <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>My pipeline is as follows: Read image ->
cast image to float -> calculate second derivatives ->create hessian
matrix ->calculate eigen values and vector.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>So now i have one vector showing the
direction of cylinder (called normal) and the other two orthogonal to it
(called ortho_1 and ortho_2). Till this point <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>I am clear. <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>As my goal is to extract the plane which is
formed by ortho_1 and ortho_2 and of size 30x30, i decided to do the following:<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span
lang=EN-GB><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>
</span></span></span><![endif]><span lang=EN-GB>to align the plane create by
ortho_1 and ortho_2 parallel to z axis - rotate the image using versor
transform and align to z direction. I referred to versorrigidtransform example
in itkguide.<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span
lang=EN-GB><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>
</span></span></span><![endif]><span lang=EN-GB>Translate the point to be in
first slice.<o:p></o:p></span></p>
<p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l1 level1 lfo1'><![if !supportLists]><span
lang=EN-GB><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>
</span></span></span><![endif]><span lang=EN-GB>Select a region in the first
slice and write the gray values as csv. <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>I am stuck in rotation step. My rotation is
not performing as expected. I think something is missing, don’t know
where or what ? I have pasted my code below.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>If anyone thinks that this idea is a over
kill for my goal, other ideas is also welcomed.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";color:blue'>int</span><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'> main(<span
style='color:blue'>int</span> argc, <span style='color:blue'>char</span>* argv
[] )<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//image input filenames<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>const</span> <span style='color:blue'>char</span> *
inputFilename = <span style='color:#A31515'>"C:/LIBS/SW_Development/GradientAnalysis/testdata/itkVirtual-SingleFibresInXY-r3.mhd"</span>;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//declare pixeltype and dimension<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> <span style='color:blue'>double</span>
InputPixelType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> <span style='color:blue'>float</span>
CastPixelType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> <span style='color:blue'>int</span>
CCPixelType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:blue'>typedef</span><span
style='font-size:10.0pt;font-family:"Courier New"'>
itk::SymmetricSecondRankTensor< <span style='color:blue'>float</span>,
Dimension > T_PixelType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>typedef</span>
itk::Vector< VectorPixelType, Dimension > EV_PixelType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:green'>//declare image type<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>typedef</span>
itk::Image< InputPixelType, Dimension > InputImageType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>typedef</span>
itk::Image< CastPixelType, Dimension > CastImageType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> </span><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New";color:blue'>typedef</span><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> itk::Image<
CCPixelType, Dimension > CCImageType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> CCImageType::IndexType CCIndexType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//set image reader filter parameters<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::ImageFileReader< InputImageType
> ReaderType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> ReaderType::Pointer
reader_1 = ReaderType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> reader_1->SetFileName(
inputFilename );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> reader_1->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//set cast filter parameters to int as the derivative can
be positive and negative<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::CastImageFilter< InputImageType,
CastImageType > CastType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastType::Pointer
castfilter = CastType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> castfilter->SetInput(
reader_1->GetOutput() ); <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> castfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create derivative<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span>
itk::DerivativeImageFilter<CastImageType,CastImageType>
DerivativeFilterType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create First derivative in X direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DXfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXfilter->SetInput(castfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXfilter->SetDirection(0);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create second derivative in XX direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DXXfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXXfilter->SetInput(DXfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXXfilter->SetDirection(0);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXXfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXXfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create second derivative in XY direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DXYfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXYfilter->SetInput(DXfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXYfilter->SetDirection(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXYfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXYfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create second derivative in XZ direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DXZfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXZfilter->SetInput(DXfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXZfilter->SetDirection(2);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXZfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXZfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create first derivative in Y direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DYfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYfilter->SetInput(castfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYfilter->SetDirection(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create second derivative in YY direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DYYfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYYfilter->SetInput(DYfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYYfilter->SetDirection(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYYfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYYfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create second derivative in YZ direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DYZfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYZfilter->SetInput(DYfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYZfilter->SetDirection(2);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYZfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYZfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create first derivative in Z direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DZfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZfilter->SetInput(castfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZfilter->SetDirection(2);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//create second derivative in ZZ direction<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DerivativeFilterType::Pointer
DZZfilter = DerivativeFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZZfilter->SetInput(DZfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZZfilter->SetDirection(2);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZZfilter->SetOrder(1);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZZfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>//set eigen
analysis<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> <span style='color:blue'>typedef</span>
itk::SymmetricEigenAnalysis < T_PixelType, VectorPixelType, EV_PixelType
> EigAnalysisType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> EigAnalysisType eig;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> eig.SetDimension( Dimension );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> </span><span lang=EN-GB style='font-size:10.0pt;
font-family:"Courier New"'>eig.SetOrderEigenMagnitudes( <span style='color:
blue'>true</span> );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//derivative image iterator<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::ImageRegionIterator
<CastImageType> CastImageIteratorType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
DXXIter(DXXfilter->GetOutput(),
DXXfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
DXYIter(DXYfilter->GetOutput(),
DXYfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
DXZIter(DXZfilter->GetOutput(),
DXZfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
DYYIter(DYYfilter->GetOutput(),
DYYfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
DYZIter(DYZfilter->GetOutput(),
DYZfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
DZZIter(DZZfilter->GetOutput(), DZZfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageIteratorType
InIter(castfilter->GetOutput(),
castfilter->GetOutput()->GetLargestPossibleRegion());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> std::multimap<CCPixelType,CCIndexType>::iterator
it;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span>
itk::ResampleImageFilter<CastImageType,CastImageType> ResampleFilterType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> ResampleFilterType::Pointer
rfilter = ResampleFilterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:blue'>InIter.GoToBegin();</span><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-indent:35.4pt;text-autospace:none'><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New";color:blue'>While (
!InIter.IsAtEnd() )</span><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> {<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> IndexType
currentindex = InIter.GetIndex();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//initialise the variables<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> T_PixelType
hess_matrix;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> VectorPixelType
eigen_values;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> EV_PixelType
eigen_vectors;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//set index for various iterators<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXXIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXYIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DXZIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYYIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DYZIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> DZZIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CCIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> InIter.SetIndex(currentindex);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//upload the hessian matrix from different second
derivative<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> hess_matrix[0]
= DXXIter.Get();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> hess_matrix[1]
= DXYIter.Get();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> hess_matrix[2]
= DXZIter.Get();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> hess_matrix[3]
= DYYIter.Get();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> hess_matrix[4]
= DYZIter.Get();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> hess_matrix[5]
= DZZIter.Get();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//calculate the eigen values of the hessian matrix<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> eig.ComputeEigenValuesAndVectors(
hess_matrix, eigen_values, eigen_vectors );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>///get the eigen vectors<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> VectorPixelType
normal, ortho_1, ortho_2;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> normal =
eigen_vectors[0]; <span style='color:green'>//direction of the fiber<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> ortho_1 =
eigen_vectors[1]; <span style='color:green'>//one the orthogonal axis<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> ortho_2 =
eigen_vectors[2]; <span style='color:green'>//other orthogonal axis<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";color:green'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>double</span> AdotB = normal[2] ;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>double</span> ModA_ModB = sqrt(pow(normal[0],2) +
pow(normal[1],2) + pow(normal[2],2));<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>double</span> theta = acos( AdotB / ModA_ModB ) ;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>double</span> angle = sin ( theta / 2 );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::VersorTransform <<span
style='color:blue'>double</span>> TransformType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> TransformType::Pointer
transform = TransformType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> TransformType::VersorType VersorType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> TransformType::AxisType AxisType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> TransformType::CenterType CenterType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> AxisType
axis;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> axis[0]=
normal[0];<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> axis[1]=
normal[1];<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> axis[2]=
normal[2];<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> VersorType
rotation;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> rotation.Set(axis,
angle);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> transform->SetRotation(rotation);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CenterType
center;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> center[0]
= normal[0];<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> center[1]
= normal[1];<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> center[2]
= normal[2];<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> transform->SetCenter(center);<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span>
itk::LinearInterpolateImageFunction<CastImageType, <span style='color:blue'>double</span>
> InterpolatorType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> InterpolatorType::Pointer
interpolator = InterpolatorType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> CastImageType::SizeType
imgSize;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> imgSize =
ccfilter->GetOutput()->GetBufferedRegion().GetSize();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> rfilter->SetTransform(
transform );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> rfilter->SetInterpolator(
interpolator );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> rfilter->SetSize(
imgSize );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> rfilter->SetInput(
castfilter->GetOutput() );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> rfilter->Update();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> }<span
style='color:green'>//if<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> }<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:green'>//set image writer parameters<o:p></o:p></span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>const</span> <span style='color:blue'>char</span> *
outputFilename = <span style='color:#A31515'>"C:/LIBS/SW_Development/GradientAnalysis/testdata/itkVirtual-SingleFibresInXY-r3-MAE-resampletest.mhd"</span>;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>typedef</span> itk::ImageFileWriter< CastImageType >
WriterType;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> WriterType::Pointer
writer = WriterType::New();<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> writer->SetFileName(
outputFilename );<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> writer->SetInput(rfilter->GetOutput());<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>try</span> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> { <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> writer->Update();
<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> } <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>catch</span>( itk::ExceptionObject & err ) <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> { <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> std::cerr
<< <span style='color:#A31515'>"ExceptionObject caught !"</span>
<< std::endl; <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'>std::cerr << err
<< std::endl; <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'> </span><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";color:blue'>return</span><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'> EXIT_FAILURE;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> } <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> <span
style='color:blue'>return</span> EXIT_SUCCESS;<o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>}<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Any help will be appreciated.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Thank you,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Regards,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Kana Arunachalam Kannappan<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Research Associate<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>FH OÖ Forschungs & Entwicklungs GmbH<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>Stelzhamer Strasse 23,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB>4600 Wels,<o:p></o:p></span></p>
<p class=MsoNormal>Austria.<o:p></o:p></p>
<p class=MsoNormal>Phone: +43 (0)7242 72811 -4420<o:p></o:p></p>
<p class=MsoNormal>kana.arunachalam@fh-wels.at<o:p></o:p></p>
<p class=MsoNormal>www.fh-ooe.at; www.3dct.at<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>