Search This Blog

Add Inverse Grayscale colour table to Papaya Viewer

Papaya viewer is a pure JavaScript medical research image viewer. You can add custom colour table by modifying its source code and rebuild. See the steps below:
  • Check out Papaya source code
    git clone https://github.com/rii-mango/Papaya.git
  • Modify src/js/viewer/colortable.js
    // insert after line 44:
    papaya.viewer.ColorTable.TABLE_INVERSE_GRAYSCALE = {"name": "Inverse Grayscale", "data": [[0, 1, 1, 1], [1, 0, 0, 0]],
         "gradation": true};
    
    // insert after line 94:
    papaya.viewer.ColorTable.TABLE_ALL = [
        papaya.viewer.ColorTable.TABLE_GRAYSCALE,
        papaya.viewer.ColorTable.TABLE_INVERSE_GRAYSCALE,
        papaya.viewer.ColorTable.TABLE_SPECTRUM,
        papaya.viewer.ColorTable.TABLE_FIRE,
        papaya.viewer.ColorTable.TABLE_HOTANDCOLD,
        papaya.viewer.ColorTable.TABLE_GOLD,
        papaya.viewer.ColorTable.TABLE_RED2YELLOW,
        papaya.viewer.ColorTable.TABLE_BLUE2GREEN,
        papaya.viewer.ColorTable.TABLE_RED2WHITE,
        papaya.viewer.ColorTable.TABLE_GREEN2WHITE,
        papaya.viewer.ColorTable.TABLE_BLUE2WHITE
    ];
    	
  • Build using papaya-builder.sh
    ./papaya-builder.sh
    The result papaya.js and papaya.css will be in build/ directory.



see also

No comments:

Post a Comment