It is possible showing <span class="Apple-style-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">hebersousa@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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><br><br>