I plot ellipses using a txt file which consists all parameters (x,y coordinates, major/minor axes, angle of the major axis) and RGB values for each ellipse. Plotting ellipses is the easy part, however I cannot define the color of ellipses based on the RGB code. I can simply solve this problem with Gnuplot but for other reasons I have to use ImageJ. Can anyone help me with this?
I use this code:
`// import file with coordinates, major and minor axis, angle of rotation (CW degrees)
fileName = File.openDialog("Select the file to import");
allText = File.openAsString(fileName);
text = split(allText, "\n");
for (i = 0; i < text.length; i++) {
line = split(text[i], ",");
XM = parseFloat(line[1]); // Assuming the X coordinate is in the first column
YM = parseFloat(line[2]); // Assuming the Y coordinate is in the second column
Major = parseFloat(line[3]); // Assuming the major axis is in the third column
Minor = parseFloat(line[4]); // Assuming the minor axis is in the fourth column
Angle = parseFloat(line[5]); // Assuming the rotation angle is in the fifth column
run("Specify...", "width=" + Major + " height=" + Minor + " x=" + XM + " y=" + YM + " oval centered");
run("Rotate...", "angle=" + Angle+90);
run("Draw");
roiManager("add");
}`
Color.set(value) Sets the drawing color. For 8 bit images, 0<=value<=255. For 16 bit images, 0<=value<=65535. With RGB images, use hex constants (e.g., 0xff0000 for red).