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"><<a href="mailto:hebersousa@gmail.com">hebersousa@gmail.com</a>></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'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"><<a href="mailto:hebersousa@gmail.com" target="_blank">hebersousa@gmail.com</a>></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'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'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 "vtkImageData.h"</div><div> #include "vtkImageViewer2.h"</div><div> #include "vtkRenderWindowInteractor.h"</div>
<div> #include "vtkDICOMImageReader.h"</div><div> #include "vtkVolumeRayCastMapper.h"</div><div>#include "vtkRenderWindowInteractor.h"</div><div><br></div><div> #include "vtkVolumeTextureMapper2D.h"</div>
<div> #include "vtkVolumeTextureMapper3D.h"</div><div>#include "vtkVolumeProperty.h"</div><div>#include "vtkColorTransferFunction.h"</div><div>#include "vtkPiecewiseFunction.h"</div>
<div>#include <vtkImageShiftScale.h></div><div>#include "vtkVolumeRayCastMIPFunction.h"</div><div>#include "vtkVolumeRayCastCompositeFunction.h"</div><div>#include "vtkCamera.h"</div><div>
#include "vtkImagePlaneWidget.h"</div><div>#include "vtkSmartPointer.h"</div><div>#include "vtkLookupTable.h"</div><div><br></div><div> #include "vtkRenderer.h"</div><div>#include "vtkRenderWindow.h"</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-> SetDirectoryName("C:/volumes/PulmaoExtraido/25fatias");</div><div><span style="white-space: pre-wrap;">        </span> </div>
<div><span style="white-space: pre-wrap;">        </span> reader->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->GetOutput())->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] < 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->SetInput(reader->GetOutput());</div>
<div><span style="white-space: pre-wrap;">                </span>shiftScale->SetScale(1);</div><div><span style="white-space: pre-wrap;">                </span>shiftScale->SetShift(shiftValue);</div><div><span style="white-space: pre-wrap;">                </span>shiftScale->ClampOverflowOn();</div>
<div><span style="white-space: pre-wrap;">                </span>shiftScale->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->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->SetRenderWindow(renWin);</div>
<div><br></div><div>vtkLookupTable* table1 = vtkLookupTable::New();</div><div>table1->SetNumberOfTableValues(256);</div><div>table1->Build();</div><div>double r=0;</div><div>double g=0;</div><div>double b=0;</div><div>
int indice;</div><div>table1->SetTableValue(0,r/255,g/255,b/255,1.0);</div><div>for(int i=1;i<256;i++) {</div><div><br></div><div> r++;</div><div> g++;</div><div> b++;</div><div> indice=i;</div><div>
table1->SetTableValue(indice,r/255,g/255,b/255,1.0);</div><div>}</div><div>table1->SetTableRange(0,1000);</div><div>table1->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->SetLookupTable(table1);</div><div><span style="white-space: pre-wrap;">        </span>widget->SetInteractor(iren);</div><div><span style="white-space: pre-wrap;">        </span>widget->TextureVisibilityOn();</div>
<div><span style="white-space: pre-wrap;">        </span>widget->EnabledOn();</div><div><span style="white-space: pre-wrap;">        </span>widget->SetInput(shiftScale->GetOutput());</div><div><span style="white-space: pre-wrap;">        </span>widget->SetPlaneOrientationToZAxes();</div>
<div><span style="white-space: pre-wrap;">        </span>widget->PlaceWidget (0, 200, 0, 200, 0, 25);</div><div><br></div><div> <span style="white-space: pre-wrap;">        </span> aRenderer->SetBackground(0,0.3,0.3);</div>
<div><br></div><div><span style="white-space: pre-wrap;">        </span>iren->Initialize();</div><div><span style="white-space: pre-wrap;">        </span>iren->Start();</div><div><br></div><div><span style="white-space: pre-wrap;">        </span>reader->Delete();</div>
<div><span style="white-space: pre-wrap;">        </span>aRenderer->Delete();</div><div><span style="white-space: pre-wrap;">        </span>renWin->Delete();</div><div><span style="white-space: pre-wrap;">        </span>iren->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>