NicoKiaru / LimeSeg

Point based 3D segmentation plugin for FIJI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change Gaussian Curvature Coloration Scheme

oleland-br opened this issue · comments

Is there a way to change the palette for the GC curvature labeling?

Yes, it's all in the script:

https://github.com/NicoKiaru/LimeSeg/blob/master/src/main/resources/script-templates/LimeSeg/DisplayCurvature3D.groovy

Does this script make sense to you ? Are you a bit familiar with java code ?

This class:

public class GaussianCurvatureColorLUT extends DotNColorSupplier {
float emphasize;
public GaussianCurvatureColorLUT(float emphasize) {
this.emphasize = emphasize;
}
public float[] getColor(DotN dn) {
float curvature=(float) dn.gaussianCurvature;
if (curvature>0f) {
return [0.5f,(float)(0.5f*(1+(Math.atan(emphasize*curvature)*2/Math.PI))),0.5f,1f] as float[];
}
if (curvature<0f) {
return [(float)(0.5f*(1+(Math.atan(-emphasize*curvature)*2/Math.PI))),0.5f,0.5f,1f] as float[];
}
}
}

sets the color of each vertex (DotN) object depending on its gaussian curvature. You can see how the color (rgb) is set depending on the gaussian curvature property of the DotN object:

public float[] getColor(DotN dn) {
float curvature=(float) dn.gaussianCurvature;
if (curvature>0f) {
return [0.5f,(float)(0.5f*(1+(Math.atan(emphasize*curvature)*2/Math.PI))),0.5f,1f] as float[];
}
if (curvature<0f) {
return [(float)(0.5f*(1+(Math.atan(-emphasize*curvature)*2/Math.PI))),0.5f,0.5f,1f] as float[];
}

this method returns a [red, green, blue, alpha] array (affecting the green or red component if the curvature is >0 or <0)

You can play a bit with these lines and see how the color is changing. You need to enable this "shader" by uncommenting the line 13 of this script and commenting the line 14

Sorry for the delayed response. I'm less familiar with java so this was helpful. Thank you!