<div dir="ltr"><div><div><div>Hi Lars,<br><br></div>I think the problem is the vtkLookupTable is meant to take a single component (scalar value) and map it to RGB.<br></div>So even though the image has 3 unsigned char components, only the first component gets mapped through.  What you want<br></div><div>to do in this case is just pass the image directly through without using a lookup table.  However, with 3D image data, you might<br></div><div>not be able to do window levelling: not sure, just a hunch at this point.  Also, you dont need to set a vtkLookupTable to <br></div><div>the vtkImageSlice's vtkImageProperty since the image is already 3 unsigned char.<br></div>The following worked for me:<br><br>#include <vtkImageMapToColors.h><br>#include <vtkImagePlaneWidget.h><br>#include <vtkImageData.h><br>#include <vtkSmartPointer.h><br>#include <vtkRenderWindow.h><br>#include <vtkRenderWindowInteractor.h><br>#include <vtkInteractorStyleImage.h><br>#include <vtkRenderer.h><br>#include <vtkImageMapper.h><br>#include <vtkImageSliceMapper.h><br>#include <vtkImageProperty.h><br>#include <vtkImageSlice.h><br>#include <vtkLookupTable.h><br>#include <vtkJPEGReader.h><br><br>int main(void) {<br><br>  // Setup renderers<br>  vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();<br><br>  // Setup render window<br>  vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();<br>  renderWindow->SetSize(800, 800);<br>  renderWindow->AddRenderer(renderer);<br><br>  // Setup render window interactor<br>  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br>    vtkSmartPointer<vtkRenderWindowInteractor>::New();<br>  renderWindowInteractor->SetRenderWindow(renderWindow);<br><br>    // create input<br>    vtkSmartPointer<vtkJPEGReader> reader =  vtkSmartPointer<vtkJPEGReader>::New();<br>    reader->SetFileName("/home/dean/files/repository/VTKData/Data/beach.jpg");<br>    vtkImageData* id = reader->GetOutput();<br>    reader->Update();<br>    int* dim = id->GetDimensions();<br><br>    // image plane widget<br>    vtkSmartPointer<vtkImagePlaneWidget> ipw =  vtkSmartPointer<vtkImagePlaneWidget>::New();<br>    ipw->SetInteractor(renderWindowInteractor);<br>    ipw->SetInput(reader->GetOutput());<br>    ipw->SetPlaneOrientation(2);<br>    ipw->GetColorMap()->SetLookupTable(NULL);<br>    ipw->GetColorMap()->SetOutputFormatToRGB();<br>    ipw->On();<br><br>    // slice mapper<br>    vtkSmartPointer<vtkImageSliceMapper> imageMapper =  vtkSmartPointer<vtkImageSliceMapper>::New();<br>    imageMapper->SetInput(reader->GetOutput());<br><br>    vtkSmartPointer<vtkImageSlice> image =  vtkSmartPointer<vtkImageSlice>::New();<br>    image->SetMapper(imageMapper);<br>    image->SetPosition(1.5 * dim[0], 0, 0); // shift in x direction<br>    renderer->AddViewProp(image);<br><br>    // proper initial display<br>    renderer->ResetCamera();<br><br>  // Render and start interaction<br>     renderWindowInteractor->Initialize();<br><br>  renderWindowInteractor->Start();<br><br>  return EXIT_SUCCESS;<br>}<br><br>- Dean                                                                                                              1,5           Top<br><br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 3:44 AM, Lars Matthäus <span dir="ltr"><<a href="mailto:lars.matthaeus@web.de" target="_blank">lars.matthaeus@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Dean,<br>
<br>
Thanks for your help! Unfortunately, it doesn't solve the problem. The<br>
image in the vtkImagePlaneWidget is still not like the original rgb. I<br>
attach again some screenshots for comparison (vtkImagePlaneWidget on the<br>
left, vtkImageSliceMapper on the right). Is there anything else I could try?<br>
<br>
Best,<br>
Lars<br>
<span class=""><br>
Am 29.09.2015 um 15:22 schrieb DL I:<br>
> Lars,<br>
> try changing your value and saturation ranges to something else, like (1,1)<br>
> regards,<br>
> Dean<br>
><br>
> On Mon, Sep 28, 2015 at 10:29 AM, Lars Matthäus <<a href="mailto:lars.matthaeus@web.de">lars.matthaeus@web.de</a><br>
</span><span class="">> <mailto:<a href="mailto:lars.matthaeus@web.de">lars.matthaeus@web.de</a>>> wrote:<br>
><br>
>     I have a DataSet with 3 scalar components, e.g. from loading a stack of<br>
>     rgb images with the vtkJPEGReader. I want to slice through it using a<br>
>     vtkImagePlaneWidget. Unfortunately, I cannot get the widget to display<br>
>     the rgb image; I only get a grey image.<br>
><br>
>     I played with the vtkLookupTable::SetVectorModeToRGBColors successfully<br>
>     to display the image as rgb using a vtkImageSliceMapper, but when I use<br>
>     the same lookup table for the vtkImagePlaneWidget, I get a grey<br>
>     image again.<br>
><br>
>     I attach some java sample code comparing the vtkImagePlaneWidget and the<br>
>     vtkImageSliceMapper as well as the output of the program.<br>
><br>
>     Any help appreciated!<br>
>     Lars<br>
><br>
>     _______________________________________________<br>
</span>>     Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" rel="noreferrer" target="_blank">http://www.kitware.com</a>><br>
<div class="HOEnZb"><div class="h5">><br>
>     Visit other Kitware open-source projects at<br>
>     <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
>     Please keep messages on-topic and check the VTK FAQ at:<br>
>     <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
>     Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
><br>
>     Follow this link to subscribe/unsubscribe:<br>
>     <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>