I am currently writing a loadable module to generate a colormap and overlay it on top of a BMode image and I want to show the final image in the Slice view window.
However, my final vtkImage has three channels the slicer shows it as a gray image.
When I save the current scalar volume to a .jpg file is colored.
The volume info of the volume shows it has 3 channels and scalar range is between 0 and 255.
Do you have any idea how I can visualize the colored image in the Slicer?
Here is my code to create the scalar volume:
vtkSmartPointer<vtkMRMLScalarVolumeNode> colormapVol = vtkSmartPointer<vtkMRMLScalarVolumeNode>::New(); colormapVol = u_logic->ApplyColormap(InputNode); this->GetMRMLScene()->AddNode(colormapVol.GetPointer()); vtkNew<vtkMRMLScalarVolumeDisplayNode> colormapDisplay; this->GetMRMLScene()->AddNode(colormapDisplay.GetPointer()); colormapVol->SetAndObserveDisplayNodeID(colormapDisplay->GetID());