IPS-LMU / EMU-webApp

The EMU-webApp is an online and offline web application for labeling, visualizing and correcting speech and derived speech data.
http://ips-lmu.github.io/EMU-webApp/
MIT License
51 stars 14 forks source link

Assigning colors to individual signalCanvas contours #303

Closed kirbyj closed 2 years ago

kirbyj commented 2 years ago

Not sure if the fix for #287 caused this (though I can't see how) or if it is expected behavior.

Consider the following signalCanvases ordering:

  "signalCanvases": {
          "order": [
            "OSCI",
            "SPEC",
            "praatF0",
            "ksvF0",
            "eggF0"
          ],

Is it possible to assign each of these F0 tracks an arbitrary color? The following does not work:

          "assign": [],
          "contourColors": [{
            "ssffTrackName": "praatF0",
            "colors": ["rgb(0,255,0)"]
          },{
            "ssffTrackName": "ksvF0",
            "colors": ["rgb(255,0,0)"]
          },{
            "ssffTrackName": "eggF0",
            "colors": ["rgb(0,0,255)"]
          }],
          "contourLims": []

All three contours appear as rgb(0,255,0), i.e. the first specification in the contourColors array.

Assigning all contours to the same signalCanvas does not work either:

      "signalCanvases": {
          "order": [
            "OSCI",
            "SPEC",
            "ksvF0"
          ],
          "assign": [{
            "signalCanvasName": "ksvF0",
            "ssffTrackName": "praatF0"
          },{
            "signalCanvasName": "ksvF0",
            "ssffTrackName": "eggF0"
          }],
          "contourColors": [{
            "ssffTrackName": "praatF0",
            "colors": ["rgb(0,0,255)"]
          },{
            "ssffTrackName": "ksvF0",
            "colors": ["rgb(0,255,0)"]
          }],
          "contourLims": []

which results in both praatF0 and ksvF0 being displayed in blue and eggF0 displayed in (default) red. Adding a specification for eggF0 results in it too being displayed in the whatever the first "colors" specification in the contourColors array happens to be.

Why isn't var contColors getting updated for each trackName?

samgregory commented 2 years ago

Hi @kirbyj - the var conColors is correctly updated for each trackName. The bug is a feel lines later in https://github.com/IPS-LMU/EMU-webApp/blob/e3758baa8ae4c329a0ab0f43552488de0dbfa992/src/app/components/ssff-canvas.component.ts#L200-L201

The fix is: this.ctx.strokeStyle = contColors.colors[contourNr]; this.ctx.fillStyle = contColors.colors[contourNr];

MJochim commented 2 years ago

I integrated @samgregory's fix into master and will make a new release this week.

MJochim commented 2 years ago

I just released this fix with v1.4.0. Please feel free to re-open the issue if it doesn’t work as intended.