<div dir="ltr">I am not very familiar with reslice filters but a quick look at your code tells me that it may be wrong to replace reslice-&gt;SetInput() with reslice-&gt;SetInformationInput(). Those are not same inputs. Did you try SetInputData() instead? By the way, did you look at the migration guide?<div>

<br></div><div><a href="http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide">http://www.vtk.org/Wiki/VTK/VTK_6_Migration_Guide</a><br></div><div><br></div><div style>Best,</div><div style>-berk</div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Wed, Apr 3, 2013 at 4:15 PM, Boxer, Aaron <span dir="ltr">&lt;<a href="mailto:Aaron.Boxer@uhn.ca" target="_blank">Aaron.Boxer@uhn.ca</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">







<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Thanks, Bill.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">The situation is a bit complicated, because the old code was actually C# code, using the ActiViz wrapper.<u></u><u></u></span></p>


<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Also, unlike the usual examples, I am not reading data in from disk, but passing it  from memory.<u></u><u></u></span></p>


<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">I’ve done some modifications since my first post; below  is what I have come up with so far.<u></u><u></u></span></p>


<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">This code crashes on rendering with memory access violation.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">One change I made is that I had to remove the UpdateInformation call on the vtkImageData object, because it<u></u><u></u></span></p>


<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">no longer exists.  <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Aaron<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      
<span style="color:green">////////////////////////////////////</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">   
<span style="color:green">//create VTK volume</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">    _vtkVolume = vtkImageData::New();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">    _vtkVolume-&gt;SetDimensions(dim[0],dim[1],dim[2]);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">    _vtkVolume-&gt;SetOrigin(origin[0],origin[1],origin[2]);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">    _vtkVolume-&gt;SetSpacing(spacing[0],spacing[1],spacing[2]);<u></u><u></u></span></p><div class="im">
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">              vtkSmartPointer&lt;vtkShortArray&gt; dataArray = vtkShortArray::New();<u></u><u></u></span></p>
</div><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">              dataArray-&gt;SetArray((<span style="color:blue">short</span> *)data, size, 1);<u></u><u></u></span></p>

<div class="im">
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">        _vtkVolume-&gt;GetPointData()-&gt;SetScalars(dataArray);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">  
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">   
<span style="color:green">// This call is necessary to ensure vtkImageData data&#39;s info is correct (e-&gt;g-&gt; updates WholeExtent values)</span><u></u><u></u></span></p>
</div><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">  
<span style="color:green">// _vtkVolume-&gt;UpdateInformation();</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">   
<span style="color:green">//////////////////////////////////////////////////////////////////////////////////////////////////////////////</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">     
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">   
<span style="color:green">//////////////////////////////////////////////</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">   
<span style="color:green">// create vtk image reslice object</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">     reslice = vtkImageSlabReslice::New();<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">                    
<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      
<span style="color:green">//VtkHelper-&gt;RegisterVtkErrorEvents(_reslicer);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">  
<span style="color:green">// reslice-&gt;SetInput(_vtkVolume);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">    reslice-&gt;SetInformationInput(_vtkVolume);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      
<span style="color:green">// Must instruct reslicer to output 2D images</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">       reslice-&gt;SetOutputDimensionality(2);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      
<span style="color:green">// Use the volume&#39;s padding value for all pixels that are outside the volume</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">       reslice-&gt;SetBackgroundLevel(paddingValue);<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      
<span style="color:green">// This ensures VTK obeys the real spacing, results in all VTK slices being isotropic-&gt;</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">      
<span style="color:green">//     Effective spacing is the minimum of these three-&gt;</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas">       reslice-&gt;SetOutputSpacing(spacing[0],spacing[1],spacing[2]);<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u> <u></u></span></p>
<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;"> Bill Lorensen [mailto:<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>]
<br>
<b>Sent:</b> Wednesday, April 03, 2013 3:56 PM<br>
<b>To:</b> Boxer, Aaron<br>
<b>Cc:</b> <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>
<b>Subject:</b> Re: [vtkusers] SetScalarType refactor<u></u><u></u></span></p>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Aaron,<br>
<br>
What did you code look like ijn VTK5.x?<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">This is how you would typically do things in VTK6:<br>
vtkSmartPointer&lt;vtkImageData&gt; image = vtkSmartPointer&lt;vtkImageData&gt;::New();<br>
 image-&gt;SetDimensions(10, 10, 10);<br>
<br>
#if VTK_MAJOR_VERSION &lt;= 5<br>
  image-&gt;SetNumberOfScalarComponents(1);<br>
  image-&gt;SetScalarTypeToUnsignedChar();<br>
  image-&gt;AllocateScalars();<br>
#else<br>
  image-&gt;AllocateScalars(VTK_UNSIGNED_CHAR,1);<br>
#endif<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Wed, Apr 3, 2013 at 3:08 PM, Boxer, Aaron &lt;<a href="mailto:Aaron.Boxer@uhn.ca" target="_blank">Aaron.Boxer@uhn.ca</a>&gt; wrote:<u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Hello,<u></u><u></u></p>
<p class="MsoNormal">I am porting some code to the master branch.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I am passing an existing data set into vtk for rendering.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Since my data set could be either unsigned short or simply short,
<u></u><u></u></p>
<p class="MsoNormal">the code used to call SetScalarType on the vtkImageData object.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I see that this has been removed.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">My question:  will the following code work, or do I need to worry about<u></u><u></u></p>
<p class="MsoNormal">data types:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">   _vtkVolume = vtkImageData::New();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    _vtkVolume-&gt;SetDimensions(volume-&gt;ArrayDimensions-&gt;Width, volume-&gt;ArrayDimensions-&gt;Height, volume-&gt;ArrayDimensions-&gt;Depth);</span><u></u><u></u></p>


<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    _vtkVolume-&gt;SetOrigin(volume-&gt;Origin-&gt;X, volume-&gt;Origin-&gt;Y, volume-&gt;Origin-&gt;Z);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    _vtkVolume-&gt;SetSpacing(volume-&gt;VoxelSpacing-&gt;X, volume-&gt;VoxelSpacing-&gt;Y, volume-&gt;VoxelSpacing-&gt;Z);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    <span style="color:blue">
if</span> (!volume-&gt;IsSigned())</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    {</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">            vtkSmartPointer&lt;vtkUnsignedShortArray&gt; dataArray = vtkUnsignedShortArray::New();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">            dataArray-&gt;SetArray(volume-&gt;PinnedAddress, volume-&gt;VolumeDataUInt16-&gt;Length, 1);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">             _vtkVolume-&gt;GetPointData()-&gt;SetScalars(dataArray);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    }</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    <span style="color:blue">
else</span></span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    {</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">            vtkSmartPointer&lt;vtkShortArray&gt; dataArray = vtkShortArray::New();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">            dataArray-&gt;SetArray(volume-&gt;PinnedAddress, volume-&gt;VolumeDataInt16-&gt;Length, 1);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">           _vtkVolume-&gt;GetPointData()-&gt;SetScalars(dataArray);</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    }</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    <span style="color:green">
// This call is necessary to ensure vtkImageData data&#39;s info is correct (e-&gt;g-&gt; updates WholeExtent values)</span></span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">    _vtkVolume-&gt;UpdateInformation();</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">Thanks!</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:&quot;Courier New&quot;">Aaron</span><u></u><u></u></p>
<p class="MsoNormal" style="text-autospace:none">
<span style="font-family:&quot;Courier New&quot;"> </span><u></u><u></u></p>
</div>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;"><br>
This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient.
<br>
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited.
<br>
If you have received this e-mail in error, please contact the sender and delete all copies.
<br>
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.</span><u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><u></u><u></u></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Unpaid intern in BillsBasement at noware dot com<u></u><u></u></p>
</div>
</div>
</div></div></div><div><div class="h5">
<font face="monospace"><br>
This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. <br>
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. <br>
If you have received this e-mail in error, please contact the sender and delete all copies. <br>
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.</font></div></div></div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>