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 class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkDICOMImageReader *reader = vtkDICOMImageReader :: New();</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>  reader-&gt; SetDirectoryName(&quot;C:/volumes/PulmaoExtraido/25fatias&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  </div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>  reader-&gt;Update();</div><div>  </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  <span class="Apple-tab-span" style="white-space:pre">        </span>  double range[2];</div>

<div>         (reader-&gt;GetOutput())-&gt;GetScalarRange(range);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>    double shiftValue = 0;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if(range[0] &lt; 0) shiftValue =(-1)*range[0];</div>

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

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

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

<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkRenderWindow *renWin = vtkRenderWindow::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>renWin-&gt;AddRenderer(aRenderer);</div>

<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();</div><div><span class="Apple-tab-span" style="white-space:pre">        </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 class="Apple-tab-span" style="white-space:pre">        </span>vtkImagePlaneWidget *widget = vtkImagePlaneWidget::New();</div>

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

<div><span class="Apple-tab-span" style="white-space:pre">        </span>widget-&gt;EnabledOn();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>widget-&gt;SetInput(shiftScale-&gt;GetOutput());</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>widget-&gt;SetPlaneOrientationToZAxes();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>widget-&gt;PlaceWidget (0, 200, 0, 200, 0, 25);</div><div><br></div><div>  <span class="Apple-tab-span" style="white-space:pre">        </span> aRenderer-&gt;SetBackground(0,0.3,0.3);</div>

<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>iren-&gt;Initialize();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>iren-&gt;Start();</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>reader-&gt;Delete();</div>

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

<div>return 0;</div><div>}</div></div><div><br>
</div></div>