<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
@font-face
        {font-family:Consolas}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        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}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif"}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
span.EmailStyle18
        {font-family:"Calibri","sans-serif";
        color:#1F497D}
span.EmailStyle19
        {font-family:"Calibri","sans-serif";
        color:#1F497D}
span.BalloonTextChar
        {font-family:"Tahoma","sans-serif"}
.MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span></p>
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt; font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt; font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Raviteja, Allaparthi
<br>
<b>Sent:</b> Thursday, October 18, 2012 4:58 PM<br>
<b>To:</b> vtkusers@vtk.org<br>
<b>Subject:</b> FW: problem in combining two mhd images </span></p>
</div>
</div>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;</span></p>
<div>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt; font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt; font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Raviteja, Allaparthi
<br>
<b>Sent:</b> Thursday, October 18, 2012 4:39 PM<br>
<b>To:</b> 'vtkusers@vtk.org'<br>
<b>Subject:</b> problem in combining two mhd images </span></p>
</div>
</div>
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal">I am new to VTK and I have a problem in combining two &#8220;mhd&#8221; images . The code and the error are as follows.</p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">&lt;vtkMetaImageReader.h&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">&lt;vtkImageData.h&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">&lt;vtkSmartPointer.h&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">&lt;vtkImageViewer2.h&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">&lt;vtkImageBlend.h&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">#include</span><span style="font-size:9.5pt; font-family:Consolas">
<span style="color:#A31515">&lt;string&gt;</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas; color:blue">int</span><span style="font-size:9.5pt; font-family:Consolas"> main (
<span style="color:blue">int</span> argc, <span style="color:blue">char</span>* argv[] )</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 style="color:green">// Parse input arguments</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;
<span style="color:blue">if</span> ( argc != 3 )</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; {</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt;
<span style="color:#A31515">&quot;Usage: &quot;</span> &lt;&lt; argv[0]</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt;
<span style="color:#A31515">&quot; Input1Filename Input2Filename&quot;</span> &lt;&lt; std::endl;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp;
<span style="color:blue">return</span> EXIT_FAILURE;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; }</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;&nbsp;std::string input1Filename = argv[1];</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; std::string input2Filename = argv[2];</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;<span style="color:green">// Read the images</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; vtkSmartPointer&lt;vtkMetaImageReader&gt; MetaImageReader1 =</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkMetaImageReader&gt;::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">MetaImageReader1-&gt;SetFileName ( input1Filename.c_str() );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;vtkSmartPointer&lt;vtkMetaImageReader&gt; MetaImageReader2 =</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkMetaImageReader&gt;::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">MetaImageReader2-&gt;SetFileName ( input2Filename.c_str() );</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;<span style="color:green">// Combine the images (blend takes multiple connections on the 0th input port)</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; vtkSmartPointer&lt;vtkImageBlend&gt; blend =</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkImageBlend&gt;::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; blend-&gt;AddInputConnection(MetaImageReader1-&gt;GetOutputPort());</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; blend-&gt;AddInputConnection(MetaImageReader2-&gt;GetOutputPort());</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; blend-&gt;SetOpacity(0,.5);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; blend-&gt;SetOpacity(1,.5);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;<span style="color:green">// Display the result</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; renderWindowInteractor =</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;vtkSmartPointer&lt;vtkImageViewer2&gt; imageViewer =</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkImageViewer2&gt;::New();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; imageViewer-&gt;SetInputConnection(blend-&gt;GetOutputPort());</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; imageViewer-&gt;SetupInteractor(renderWindowInteractor);</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; imageViewer-&gt;GetRenderer()-&gt;ResetCamera();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; imageViewer-&gt;GetRenderer()-&gt;SetBackground(1,0,0);
<span style="color:green">//red</span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp;renderWindowInteractor-&gt;Initialize();</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">&nbsp; renderWindowInteractor-&gt;Start();</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> EXIT_SUCCESS;</span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt; font-family:Consolas">}</span></p>
<p class="MsoNormal">ERROR: In C:\VTK-5.10.0\VTK\Imaging\vtkImageBlend.cxx, line 913</p>
<p class="MsoNormal">VTKImageBlend[00B6FD18]:Execute:input1 ScalarType [11],must match output ScalarType [5]</p>
<p class="MsoNormal">How do I resolve the above error? &nbsp;I am attaching the two input &#8220;mhd&#8221; files. Could Someone Please help me out.</p>
<p class="MsoNormal">Thank you.</p>
<p class="MsoNormal">Regards,</p>
<p class="MsoNormal">Ravi Teja.</p>
<p class="MsoNormal">&nbsp;</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>