Hello Sebastien,
Thank you so much for your help. Below is the python code which I am using to retain the color of the image.
luminance = vtk.vtkImageLuminance()
luminance.SetInputConnection(reader.GetOutputPort())
//merge the original image and the luminace map into one RGBA image
append = vtk.vtkImageAppendComponents()
append.AddInputConnection(reader.GetOutputPort())
append.AddInputConnection(luminance.GetOutputPort())
volumeMapper.SetInputConnection(append.GetOutputPort())
In Javascript I am just doing the simple volume rendering using .vti file and not adding any vtkColorTransferFunction.
This is the output for the JS rendering