Did you try running Examples/GUI/Tcl/ImagePlaneWidget.tcl . It does pretty much what you are trying to do.<br><br>Also note that the widget itself has a lookup table that it can pass the data through. This is much more efficient than what you are trying, since it does the window-level mapping just on the intersected slice, instead of the whole volume as you are performing.<br>
<br>--<br>karthik<br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 11:07 PM, Héber de Padua Sousa <span dir="ltr">&lt;<a href="mailto:hebersousa@gmail.com">hebersousa@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It is possible showing <span style="font-family: arial,sans-serif; font-size: 13px; border-collapse: collapse;">slice&#39;s grayscale texture instead just white color?</span><br><br><div class="gmail_quote">

2010/9/14 Héber de Padua Sousa <span dir="ltr">&lt;<a href="mailto:hebersousa@gmail.com" target="_blank">hebersousa@gmail.com</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Hi!<div>I need help, please!<div>I&#39;m working with vtkImagePlaneWidget, but the image is not showing on the plane.</div><div>Where the plane intersect the volume It shows the color white Instead slice&#39;s grayscale texture.</div>



<div>What is the problem?</div><div>thanks</div><div>this is the code:</div><div><br></div><div><div> #include &quot;vtkImageData.h&quot;</div><div> #include &quot;vtkImageViewer2.h&quot;</div><div> #include &quot;vtkRenderWindowInteractor.h&quot;</div>



<div> #include &quot;vtkDICOMImageReader.h&quot;</div><div> #include &quot;vtkVolumeRayCastMapper.h&quot;</div><div>#include &quot;vtkRenderWindowInteractor.h&quot;</div><div><br></div><div> #include &quot;vtkVolumeTextureMapper2D.h&quot;</div>



<div> #include &quot;vtkVolumeTextureMapper3D.h&quot;</div><div>#include &quot;vtkVolumeProperty.h&quot;</div><div>#include &quot;vtkColorTransferFunction.h&quot;</div><div>#include &quot;vtkPiecewiseFunction.h&quot;</div>



<div>#include &lt;vtkImageShiftScale.h&gt;</div><div>#include &quot;vtkVolumeRayCastMIPFunction.h&quot;</div><div>#include &quot;vtkVolumeRayCastCompositeFunction.h&quot;</div><div>#include &quot;vtkCamera.h&quot;</div><div>



#include &quot;vtkImagePlaneWidget.h&quot;</div><div>#include &quot;vtkSmartPointer.h&quot;</div><div>#include &quot;vtkLookupTable.h&quot;</div><div><br></div><div> #include &quot;vtkRenderer.h&quot;</div><div>#include &quot;vtkRenderWindow.h&quot;</div>



<div><br></div><div>int main()</div><div><span style="white-space: pre-wrap;">        </span>{</div><div><br></div><div><span style="white-space: pre-wrap;">        </span>vtkDICOMImageReader *reader = vtkDICOMImageReader :: New();</div>

<div><span style="white-space: pre-wrap;">        </span>  reader-&gt; SetDirectoryName(&quot;C:/volumes/PulmaoExtraido/25fatias&quot;);</div><div><span style="white-space: pre-wrap;">        </span>  </div>
<div><span style="white-space: pre-wrap;">        </span>  reader-&gt;Update();</div><div>  </div><div><span style="white-space: pre-wrap;">        </span>  <span style="white-space: pre-wrap;">        </span>  double range[2];</div>
<div>         (reader-&gt;GetOutput())-&gt;GetScalarRange(range);</div><div><br></div><div><span style="white-space: pre-wrap;">        </span>    double shiftValue = 0;</div><div><span style="white-space: pre-wrap;">                </span>if(range[0] &lt; 0) shiftValue =(-1)*range[0];</div>



<div><span style="white-space: pre-wrap;">                </span>vtkImageShiftScale *shiftScale = vtkImageShiftScale::New();</div><div><span style="white-space: pre-wrap;">                </span>shiftScale-&gt;SetInput(reader-&gt;GetOutput());</div>

<div><span style="white-space: pre-wrap;">                </span>shiftScale-&gt;SetScale(1);</div><div><span style="white-space: pre-wrap;">                </span>shiftScale-&gt;SetShift(shiftValue);</div><div><span style="white-space: pre-wrap;">                </span>shiftScale-&gt;ClampOverflowOn();</div>



<div><span style="white-space: pre-wrap;">                </span>shiftScale-&gt;SetOutputScalarTypeToUnsignedShort();</div><div><br></div><div><br></div><div><span style="white-space: pre-wrap;">        </span>vtkRenderer *aRenderer = vtkRenderer::New();</div>



<div><br></div><div><span style="white-space: pre-wrap;">        </span>vtkRenderWindow *renWin = vtkRenderWindow::New();</div><div><span style="white-space: pre-wrap;">        </span>renWin-&gt;AddRenderer(aRenderer);</div>
<div><br></div><div><span style="white-space: pre-wrap;">        </span>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</div><div><span style="white-space: pre-wrap;">        </span>iren-&gt;SetRenderWindow(renWin);</div>



<div><br></div><div>vtkLookupTable* table1 = vtkLookupTable::New();</div><div>table1-&gt;SetNumberOfTableValues(256);</div><div>table1-&gt;Build();</div><div>double r=0;</div><div>double g=0;</div><div>double b=0;</div><div>



int indice;</div><div>table1-&gt;SetTableValue(0,r/255,g/255,b/255,1.0);</div><div>for(int i=1;i&lt;256;i++) {</div><div><br></div><div>     r++;</div><div>     g++;</div><div>     b++;</div><div>     indice=i;</div><div>



     table1-&gt;SetTableValue(indice,r/255,g/255,b/255,1.0);</div><div>}</div><div>table1-&gt;SetTableRange(0,1000);</div><div>table1-&gt;SetAlphaRange(1.0,1.0);</div><div><br></div><div><span style="white-space: pre-wrap;">        </span>vtkImagePlaneWidget *widget = vtkImagePlaneWidget::New();</div>



<div><span style="white-space: pre-wrap;">        </span>widget-&gt;SetLookupTable(table1);</div><div><span style="white-space: pre-wrap;">        </span>widget-&gt;SetInteractor(iren);</div><div><span style="white-space: pre-wrap;">        </span>widget-&gt;TextureVisibilityOn();</div>



<div><span style="white-space: pre-wrap;">        </span>widget-&gt;EnabledOn();</div><div><span style="white-space: pre-wrap;">        </span>widget-&gt;SetInput(shiftScale-&gt;GetOutput());</div><div><span style="white-space: pre-wrap;">        </span>widget-&gt;SetPlaneOrientationToZAxes();</div>



<div><span style="white-space: pre-wrap;">        </span>widget-&gt;PlaceWidget (0, 200, 0, 200, 0, 25);</div><div><br></div><div>  <span style="white-space: pre-wrap;">        </span> aRenderer-&gt;SetBackground(0,0.3,0.3);</div>
<div><br></div><div><span style="white-space: pre-wrap;">        </span>iren-&gt;Initialize();</div><div><span style="white-space: pre-wrap;">        </span>iren-&gt;Start();</div><div><br></div><div><span style="white-space: pre-wrap;">        </span>reader-&gt;Delete();</div>



<div><span style="white-space: pre-wrap;">        </span>aRenderer-&gt;Delete();</div><div><span style="white-space: pre-wrap;">        </span>renWin-&gt;Delete();</div><div><span style="white-space: pre-wrap;">        </span>iren-&gt;Delete();</div>



<div>return 0;</div><div>}</div></div><div><br>
</div></div>
</blockquote></div></div></div><br><br>
<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>