Jörg Koch wrote:
Hello,as I'm trying to generate test patches for characterization. In which way can combined channel steps be created with targen (e.g. in RGB, 52 red-green (yellow) steps in order from 0 to 100, blue always 0)?
maybe the quickest way is to use Octave <http://www.gnu.org/software/octave/> or R <http://www.r-project.org/>
In R you can create the table with one line of code: > yellow <- data.frame(RGB_R=0:51*100/51, RGB_G=0:51*100/51, RGB_B=0)you can use the built in function write.table() to write it to a text file and add the CGATS header manually or you can use e.g. my simple writeCgats() function:
> writeCgats(yellow, "yellow.ti1", id=TRUE) Here is the writeCgats() function: ---8<--- function(dframe, file, id=FALSE, dec=".") { if(id==TRUE) { na <- c("SAMPLE_ID",names(dframe)) nc <- ncol(dframe)+1 } else { na <- names(dframe) nc <- ncol(dframe) } header <- list("R", c("CREATED", paste("\"", format(Sys.time(), usetz = TRUE), "\"", sep="")), c("NUMBER_OF_FIELDS", nc), "BEGIN_DATA_FORMAT", na, "END_DATA_FORMAT", c("NUMBER_OF_SETS", nrow(dframe)), "BEGIN_DATA") write(header[[1]],file, sep="\t") for (i in 2:length(header)) write(header[[i]],file, sep="\t", ncolumns=1000,append=TRUE) write.table(format(dframe, digits=5), file = file, append = TRUE, quote = FALSE, sep = "\t", eol = "\n", na = "NA", dec = dec, row.names = id, col.names = FALSE, qmethod = "escape") write("END_DATA", file, append=TRUE) } --->8--- Klaus