aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorValerio mariani <valerio.mariani@desy.de>2015-05-08 10:54:17 +0200
committerThomas White <taw@physics.org>2015-05-08 12:00:29 +0200
commit89199e9a97d6f7efbe473c7447374acc857adeca (patch)
tree785f96f4e44e9213bf243b9de36cf85b7c302984 /libcrystfel
parenta246f32bf4a30e0409cd19350bfe73d8cc3061d8 (diff)
Added colour scale to geoptimiser error maps
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/render.c82
-rw-r--r--libcrystfel/src/render.h3
2 files changed, 84 insertions, 1 deletions
diff --git a/libcrystfel/src/render.c b/libcrystfel/src/render.c
index 17318782..2dcb7b93 100644
--- a/libcrystfel/src/render.c
+++ b/libcrystfel/src/render.c
@@ -104,6 +104,84 @@ static void render_rgb(double val, double max,
}
+static void render_geoptimiser(double val, double max,
+ double *rp, double *gp, double *bp)
+{
+ double r;
+ double p;
+
+ r = val/max;
+
+ if ( val < 0.0 ) {
+ *rp = 0.0;
+ *gp = 0.0;
+ *bp = 0.0;
+ return;
+ }
+
+ if ( r >= 0.0 && r < 0.059 ) {
+ p = (r-0.0)/(0.059-0.0);
+ *rp = 0.0;
+ *gp = 0.0;
+ *bp = ((91.0/256.0)-0.0)*p;
+ return;
+ }
+
+ if ( r >= 0.059 && r < 0.220 ) {
+ p = (r-0.059)/(0.220-0.059);
+ *rp = ((122.0/256.0)-0.0)*p;
+ *gp = 0.0;
+ *bp = ((227.0/256.0)-(91.0/256.0))*p+(91.0/256.0);
+ return;
+ }
+
+ if ( r >= 0.220 && r < 0.376 ) {
+ p = (r-0.220)/(0.376-0.220);
+ *rp = ((195.0/256.0)-(122.0/256.0))*p+(122.0/256.0);
+ *gp = 0.0;
+ *bp = ((93.0/256.0)-(227.0/256.0))*p+(227.0/256.0);
+ return;
+ }
+
+ if ( r >= 0.376 && r < 0.498 ) {
+ p = (r-0.376)/(0.498-0.376);
+ *rp = ((238.0/256.0)-(195.0/256.0))*p+(195.0/256.0);
+ *gp = ((76.0/256.0)-0.0)*p;
+ *bp = (0.0-(93.0/256.0))*p+(93.0/256.0);
+ return;
+ }
+
+ if ( r >= 0.498 && r < 0.564 ) {
+ p = (r-0.498)/(0.564-0.498);
+ *rp = (1.0-(238.0/256.0))*p+(238.0/256.0);
+ *gp = ((117.0/256.0)-(76.0/256.0))*p+(76.0/256.0);
+ *bp = 0.0;
+ return;
+ }
+
+ if ( r >= 0.564 && r < 0.815 ) {
+ p = (r-0.564)/(0.815-0.564);
+ *rp = 1.0;
+ *gp = ((234.0/256.0)-(117.0/256.0))*p+(117.0/256.0);
+ *bp = 0.0;
+ return;
+ }
+
+ if ( r >= 0.815 && r < 1.0 ) {
+ p = (r-0.815)/(1.0-0.815);
+ *rp = 1.0;
+ *gp = (1.0-(234.0/256.0))*p+(234.0/256.0);
+ *bp = (1.0-0.0)*p;
+ return;
+ }
+
+ if ( r >= 1.0 ) {
+ *rp = 1.0; *gp = 1.0; *bp = 1.0;
+ return;
+ }
+}
+
+
static void render_ratio(double val, double max,
double *rp, double *gp, double *bp)
{
@@ -164,5 +242,9 @@ void render_scale(double val, double max, int scale,
case SCALE_RATIO :
render_ratio(val, max, rp, gp, bp);
break;
+
+ case SCALE_GEOPTIMISER :
+ render_geoptimiser(val, max, rp, gp, bp);
+ break;
}
}
diff --git a/libcrystfel/src/render.h b/libcrystfel/src/render.h
index a4da922d..c2e5965a 100644
--- a/libcrystfel/src/render.h
+++ b/libcrystfel/src/render.h
@@ -38,7 +38,8 @@ enum {
SCALE_COLOUR,
SCALE_MONO,
SCALE_INVMONO,
- SCALE_RATIO
+ SCALE_RATIO,
+ SCALE_GEOPTIMISER
};
#ifdef __cplusplus