ome / omero-figure

An OMERO.web app for creating Figures from images in OMERO
http://figure.openmicroscopy.org
GNU Affero General Public License v3.0
15 stars 30 forks source link

OME2021 meeting workshop #431

Open will-moore opened 3 years ago

will-moore commented 3 years ago

Somewhere to record prep notes, scripts etc.

Import and prep steps:

Some of these steps use proposed features in https://github.com/ome/training-scripts/pull/88. (Need to use that PR):

idr0079 data

Current figure proposal:

Screenshot 2021-04-26 at 14 03 42

OMERO.parade

Screenshot 2021-05-17 at 14 35 40

Analysis


async function shapeData(panel) {
    const shapeIds = panel.get("shapes").map(s => s.id).filter(id => id > 0);
    console.log('shapeIds', shapeIds);
    let vals_by_shape = {};
    for (let i=0; i<shapeIds.length; i++) {
        // Load one at a time - more reliable
        let url = `/webgateway/table/Image/${panel.get('imageId')}/query/?query=Shape-${shapeIds[i]}`;
        let r = await fetch(url).then(rsp => rsp.json());
        let colIndex = r.data?.columns?.indexOf("Centroids_RAW_X");
        let shapeIndex = r.data?.columns?.indexOf("Shape");
        if (colIndex && shapeIndex && r.data?.rows.length > 0) {
            console.log("Value", r.data.rows[0][colIndex]);
            vals_by_shape[r.data.rows[0][shapeIndex]] = r.data.rows[0][colIndex];
        }
    };
    // Once all loaded, we can calculate range and assign colours to shapes
    const values = Object.values(vals_by_shape);
    let minVal = Math.min(...values);
    let valRange = Math.max(...values) - minVal;
    console.log('min, range', minVal, valRange);
    const new_shapes = panel.get("shapes").map(shape => {
        // hide any shapes we don't have data for
        if (!vals_by_shape[shape.id]) return { ...shape, strokeWidth: 0.01};
        let value = (vals_by_shape[shape.id] - minVal) / valRange;
        let red = parseInt(value * 255).toString(16);
        let blue = (255 - parseInt(value * 255)).toString(16);
        red = red.length == 1 ? `0` + red : red;
        blue = blue.length == 1 ? `0` + blue : blue;
        return { ...shape, strokeColor: `#${red}00${blue}`, strokeWidth: 5 }
    });
    panel.set('shapes', new_shapes);
}
figureModel.getSelected().forEach(shapeData);

Screenshot 2021-05-20 at 17 17 48

pwalczysko commented 3 years ago

@will-moore So, youir list of the idr studies here is

idr0028 idr0089 idr0086 idr0050 idr0079

5 studies to consider. Please correct me if the list is wrong. We can discuss the details about how to minimize the effort by importing only parts of the studies into training servers later, but as discussed with @sbesson , the plan would be to have all these studies mounted on the volume which is visible from the training servers, and implement this logic into the ansible playbook. This will give us more flexibility at such time as new studies are asked for.

will-moore commented 3 years ago

Hi Petr, Sorry, that list is just ones I was thinking of using (just personal notes). But so far I only know that I want to use images from idr0079 (experimentA). I need to try a run-through and think if I have time for any more different images, but going on last year's workshop, 1 main set of images will be enough. Thanks.