Hello everyone,
I am trying to read a 2d png image stack in vtk for volume rendering. Is there any equivalent libarary of vtkPNGReader in vtk.js. Any help and guidance would be greatly appreciated.
Best Regards
Hello everyone,
I am trying to read a 2d png image stack in vtk for volume rendering. Is there any equivalent libarary of vtkPNGReader in vtk.js. Any help and guidance would be greatly appreciated.
Best Regards
itk.js is probably the way to go unless you can find another JS library that give you the corresponding TypedArray that you are looking for.
What is your solution to the problem?
I have written a python script using vtkPNGReader() and vtkImageAppend() which creates a .vti file for the stacked 2d png images.
def ReadImages(files):
reader = vtk.vtkPNGReader()
image3D = vtk.vtkImageAppend()
image3D.SetAppendAxis(2)
for f in files:
reader.SetFileName(f)
reader.Update()
t_img = vtk.vtkImageData()
t_img.DeepCopy(reader.GetOutput())
image3D.AddInputData(t_img)
image3D.Update()
writer = vtk.vtkXMLImageDataWriter()
writer.SetInputData(image3D.GetOutput())
writer.SetFileName("volume.vti")
writer.Update()
return image3D.GetOutput()
I hope this helps.