What would be the best way to do this?
I’ve tried looking up the documentation however could not find anything related to a custom .txt file - Install Slicer — 3D Slicer documentation
Please note that I’m looking to get this done all programmatically (no editing via the user interface or dragging the file in). Ideally the .txt file is imported by code on the backend.
I’m fairly new to 3DSlicer, so a simple, clear answer would be appreciated!
If using python, there are a lot of common functions available in slicer.util. Take a look at the loadColorTable method below which will allow you to programmatically load the custom color table file. This method returns the node from which you can GetID() for use in the SetAndObserveColorNodeID method that you mentioned.
Or if you want to create the color table programmatically rather than from file: