[caret-users] Palette editing

John Harwell john at brainvis.wustl.edu
Tue May 6 09:13:03 CDT 2008


Alex,

If you generated a palette file with that many colors I think it would  
be slow to load and slot to make the color assignments.  A better  
alternative is to use this python script to generate an RGB paint file  
containing random colors.  You will need to adjust the "numberOfNodes"  
variable in the script to match your dataset.

----------------------------------------------------------------------------------------------------------

#!/usr/bin/python
#
# Create an RGB paint file with random colors
#
import os
import random
import sys

#
# Name of RGB Paint file and number of nodes in the file
#
rgbPaintFileName = "random.RGB_paint"
numberOfNodes    = 71723

#
# Create an RGB paint file with random colors
#
file = open(rgbPaintFileName, 'w')
file.write("tag-version " + str(2) + "\n")
file.write("tag-number-of-nodes " + str(numberOfNodes) + "\n")
file.write("tag-number-of-columns  " + str(1) + "\n")
file.write("tag-BEGIN-DATA\n");
for i in range(numberOfNodes):
    node  = str(i)
    red   = str(random.random() * 255.0)
    green = str(random.random() * 255.0)
    blue  = str(random.random() * 255.0)
    line = node + " " + red + " " + green + " " + blue + "\n"
    file.write(line)

file.close()

----------------------------------------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.tiff
Type: image/tiff
Size: 235884 bytes
Desc: not available
Url : http://brainvis.wustl.edu/pipermail/caret-users/attachments/20080506/10b916f8/attachment.tiff 
-------------- next part --------------



-----------------------------------
John Harwell
john at brainvis.wustl.edu

Department of Anatomy and Neurobiology
Washington University School of Medicine
660 S. Euclid Ave   Box 8108
Saint Louis, MO 63110




On May 6, 2008, at 4:46 AM, Alex Fornito wrote:
> Hi,
> I need to generate a custom palette for viewing some masks. I need  
> it to
> contain 5000-10000 colours, in no particular order or pattern. I.e.,  
> they
> can be random, they just need to provide some kind of visual  
> distinction
> between 5000-10000 points on the cortical surface. I can see how to  
> manually
> edit palettes, but it does not seem feasible to repeat the process  
> 1000s of
> times. Is there a simple way to generate a palette with several  
> 1000s of
> random colours so that it can be used in Caret?
> Thanks for your help,
> Alex
>
>
>
>
> _______________________________________________
> caret-users mailing list
> caret-users at brainvis.wustl.edu
> http://brainvis.wustl.edu/mailman/listinfo/caret-users
>



More information about the caret-users mailing list