I need to use a specific colour map to view data meaning that whenever I open 3d Slicer I have to first go and change the Lookup Table from the default Grey to a colour table I’ve added called NDT. This isn’t a problem but adds some amount of time each time I load a new volume. For my purposes I will use this NDT colourmap 99% of the time and so it would be great to simply have it be the colourmap in the Lookup Table by default (like Grey is now).
Thank you for your quick response! After adding the code snippet above to my .slicerrc.py file, Slicer crashes when I load data. If it makes a difference I am loading .nrrd files.
Any further guidance would be greatly appreciated!
I realise that the crash was related to the scene and annotation files in the directory I loaded, which happens for some reason when I save scenes sometimes.
When I remove these files and just load the nrrd file, slicer doesn’t crash, rather the volume is loaded in Grey as was the case with the MRHead nrrd file.
I think maybe I am missing something in else in the .slicerrc script?
I’ve downloaded the latest stable release as you’ve suggested. This bit of code does not take effect. Even if I simply enter it in the PYTHON terminal in slicer itself the colour remains Grey.
The code changes the default display node. It does not affect nodes that are already loaded into the scene. Try loading MRHead after you running the code snippet.
If you load data from DICOM then the display node may be created explicitly (bypassing the default node mechanism), I’ll have a look at this if it can be changed easily. In the meantime, you can take a slightly different approach and add an observer to the NodeAdded event of the scene and if a scalar volume display node is added then change the color node in it. Probably you can copy-paste the code from examples in the script repository.
I see that the colormap is overridden when you simply use “Add data” window. So, until default color node usage gets used consistently with all loading modes, you need to implement the the scene observation mechanism. You can start from this example and just modify a few lines (change the existing display node instead of creating a volume rendering display node).
I’ve fixed the issue in Slicer core: now color node specified in the default vtkMRMLScalarVolumeDisplayNode always takes precedence over hardcoded values specified in the color logic or volume node class. So, the 3-line code snippet will work in Slicer Preview Release that you download tomorrow or later.