[vtkusers] streaming images

Mike Withascarf mikewithascarf at yahoo.com
Tue Dec 13 12:20:36 EST 2016


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 datavtkSmartPointer<vtkMetaImageReader> reader = vtkSmartPointer<vtkMetaImageReader>::New();reader->SetReleaseDataFlag(1);reader->SetFileName("test.mhd");
// colormapvtkSmartPointer<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();
// renderingviewer = 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161213/6b09d35c/attachment.html>


More information about the vtkusers mailing list