Hi,
I have a dataset of 1000 images, with a total size of 11 GB. In my application, I want to render a specific slice in the window based on interactive user input. I’d like to do this in a way that does not involve reading the full stack into memory.
So far, I’ve been using the PNG reader and providing the path to the folder with individual 2D PNG files. The code provided below works, but I would eventually want to work with multi-page tiff stacks, so that the data handling is easier (moving one file around vs. moving several hundred). I could create stacks in the .ome.tif format with about 300 images in each file. I tried replicating the code with vtkTIFFReader and providing the filename of the stack, but that still reads in the full stack into memory.
Any help would be appreciated.
Thanks,
Chaitanya
imagePNGReader = vtk.vtkPNGReader()
imagePNGReader.SetFilePrefix(folderImagesPath + '\\')
imagePNGReader.SetFilePattern('%sImage_%05d.png')
imagePNGReader.SetDataExtent(0, self.extent_x, 0, self.extent_y, 0, self.extent_z)
imagePNGReader.SetDataSpacing(pixel_size_xy, pixel_size_xy, thickness)
self.imageXY = vtk.vtkExtractVOI()
self.imageXY.SetInputConnection(imagePNGReader.GetOutputPort())
self.imageXY.SetVOI(0, self.extent_x, 0, self.extent_y, 0, 0)
self.imageXY.Update()
# Create a greyscale lookup table
table = vtk.vtkLookupTable()
table.SetRange(0, 255)
table.SetValueRange(0.0, 1.0)
table.SetSaturationRange(0.0, 0.0)
table.SetRampToLinear()
table.Build()
# Map the image through the lookup table
xy_color = vtk.vtkImageMapToColors()
xy_color.SetLookupTable(table)
xy_color.SetInputConnection(self.imageXY.GetOutputPort())
self.XYSliceActor = vtk.vtkImageActor()
self.XYSliceActor.SetPosition(0, 0, 0)
self.XYSliceActor.GetMapper().SetInputConnection(xy_color.GetOutputPort())
self.XYSliceActor.GetProperty().SetOpacity(1)
self.XYSliceActor.Update()