It is possible showing <span class="Apple-style-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">hebersousa@gmail.com</a>></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'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><br><br>