<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Consolas}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
.MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">I am trying to convert Itkimage to Iplimage. I do not use the openCV bridge, but have wrote a function to do it the same way as said in openCV bridge. But orientation of the image is modified. Any pointer of what I have done wrong would
 be helpful. The code is shown as below:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">IplImage* ConvertItkToIplImage(
<span style="color:blue">const</span> ImageType* input )</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">{</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;
<span style="color:blue">const</span> <span style="color:blue">unsigned</span> <span style="color:blue">
int</span> numberOfChannels = 1;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;
<span style="color:blue">const</span> <span style="color:blue">int</span> depth = IPL_DEPTH_8U;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; IplImage* out;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;
<span style="color:blue">unsigned</span> <span style="color:blue">int</span> w = input-&gt;GetLargestPossibleRegion().GetSize()[0];</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;
<span style="color:blue">unsigned</span> <span style="color:blue">int</span> h = input-&gt;GetLargestPossibleRegion().GetSize()[1];</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; out = cvCreateImage(cvSize(w,h), IPL_DEPTH_8U, numberOfChannels);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;memcpy(out-&gt;imageData, input-&gt;GetBufferPointer(), out-&gt;imageSize);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;
<span style="color:blue">return</span> out;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">}</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;</span></p>
<p class="MsoNormal">Regards,</p>
<p class="MsoNormal">Ganesh</p>
<p class="MsoNormal">&nbsp;</p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified
 that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.<br>
</font>
</body>
</html>