<div dir="ltr"><div><div>Hi Mike,<br><br></div>not sure if this would work, but what about inserting vtkImageClip between your reader<br></div><div>and the windowlevel filter in your pipeline with ClipDataOn?<br></div><div><br></div>- Dean<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 13, 2016 at 12:20 PM, Mike Withascarf via vtkusers <span dir="ltr"><<a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"><div id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2527" dir="ltr">I have a pipeline that takes 3D image data (slices of 2D images) and displays it with a vtkImageViewer2 (with a slider to move through the slices). My datasets can get huge, so I am looking for a way to only load part of the image into memory at a time as needed. I tried using vtkImageDataStreamer without success, though I have a feeling that's not for image viewing, but rather processing. How can I accomplish what I'm trying to do? Any help is appreciated! Here is my basic code for loading and displaying the data:</div><div id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2527" dir="ltr"><br></div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2698">// load image data</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2699">vtkSmartPointer<<wbr>vtkMetaImageReader> reader = vtkSmartPointer<<wbr>vtkMetaImageReader>::New();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2700">reader->SetReleaseDataFlag(1);</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2701">reader->SetFileName("test.mhd"<wbr>);</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2702"><br id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2703"></div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2704">// colormap</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2705">vtkSmartPointer<<wbr>vtkLookupTable> lut = vtkSmartPointer<<wbr>vtkLookupTable>::New();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2706">lut->SetNumberOfColors(256);</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2707">lut->SetRange(0, 400);</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2708">lut->Build();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2709">for (size_t i = 0; i < 256; i++)</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2710"><span style="white-space:pre-wrap" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2711">    </span>lut->SetTableValue(i, (double)i/256, (double)i/256, (double)i/256);</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2712"><br id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2713"></div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2714">vtkSmartPointer<<wbr>vtkImageMapToColors> maptoc =</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2715"><span style="white-space:pre-wrap" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2716">       </span>vtkSmartPointer<<wbr>vtkImageMapToColors>::New();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2717">maptoc->SetLookupTable(lut);</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2718">maptoc->SetInputConnection(<wbr>reader->GetOutputPort());</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2719">maptoc->Update();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2720"><br id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2721"></div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2722">// rendering</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2723">viewer = vtkSmartPointer<<wbr>vtkImageViewer2>::New();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2724">viewer->SetInputConnection(<wbr>maptoc->GetOutputPort());</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2725">viewer->SetRenderWindow(<wbr>window->GetRenderWindow());</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2726">viewer->GetRenderer()-><wbr>ResetCamera();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2727">viewer->Render();</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2727"><br></div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2727">// note that window is of type QVTKWidget</div><div dir="ltr" id="m_-4447926095863083008yui_3_16_0_ym19_1_1481649367845_2727">// when the user changes slices, I call viewer->SetSlice</div></div></div><br>______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>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=<wbr>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/<wbr>mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>