[vtkusers] streaming images
Dean Inglis
inglis.dl at gmail.com
Tue Dec 13 12:32:17 EST 2016
Hi Mike,
not sure if this would work, but what about inserting vtkImageClip between
your reader
and the windowlevel filter in your pipeline with ClipDataOn?
- Dean
On Tue, Dec 13, 2016 at 12:20 PM, Mike Withascarf via vtkusers <
vtkusers at vtk.org> wrote:
> 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:
>
> // load image data
> vtkSmartPointer<vtkMetaImageReader> reader = vtkSmartPointer<
> vtkMetaImageReader>::New();
> reader->SetReleaseDataFlag(1);
> reader->SetFileName("test.mhd");
>
> // colormap
> vtkSmartPointer<vtkLookupTable> lut = vtkSmartPointer<
> vtkLookupTable>::New();
> lut->SetNumberOfColors(256);
> lut->SetRange(0, 400);
> lut->Build();
> for (size_t i = 0; i < 256; i++)
> lut->SetTableValue(i, (double)i/256, (double)i/256, (double)i/256);
>
> vtkSmartPointer<vtkImageMapToColors> maptoc =
> vtkSmartPointer<vtkImageMapToColors>::New();
> maptoc->SetLookupTable(lut);
> maptoc->SetInputConnection(reader->GetOutputPort());
> maptoc->Update();
>
> // rendering
> viewer = vtkSmartPointer<vtkImageViewer2>::New();
> viewer->SetInputConnection(maptoc->GetOutputPort());
> viewer->SetRenderWindow(window->GetRenderWindow());
> viewer->GetRenderer()->ResetCamera();
> viewer->Render();
>
> // note that window is of type QVTKWidget
> // when the user changes slices, I call viewer->SetSlice
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161213/071b3ca3/attachment.html>
More information about the vtkusers
mailing list