Python Forum
Digitizing heatmap image
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Digitizing heatmap image
#1
Hi,

I'd like to digitize a heatmap

Panel D in this source: https://www.ncbi.nlm.nih.gov/pmc/article...figure/F1/

I'm not sure what's the right way to proceed. Any suggestions?

Thanks
Reply
#2
If this is the only one figure you need to digitize, I would suggest to do it manually.
What would be an algorithm, if you wrote this program using Python.
1) Read the figure using sickit-image or PIL, and clasterize colors (find all different colors that
are used); Probably, you'll need make some rotation adjustment of the picture first.
2) Find centers for the clusters with the same color and build a matrix of colors A[i,j] (i num of row, j num of column in the chart);
3) map colors to names, column names and row names respectively; this probably is to be done manually, e.g. {'color': 'row_name1', ...etc}
4) The only last step is to define mapping between row/column number and name. That's all.

I suspect that it take no more than 20 minutes to digitize the chart manually.
Reply
#3
Hello,

Thanks a lot for the response. I prefer to digitize using python, I have to use this approach for processing other images too.

From what you suggested, I tried the following

import cv2
from pprint import pprint


def read_as_digital(image, offset_x, offset_y):
    # grab the image dimensions
    h = image.shape[0]
    w = image.shape[1]
    print(h, w)
    pass


if __name__ == '__main__':

    image = cv2.imread('ip.jpg', 1)
    pprint(image)

    read_as_digital(image, [], [])
I could read the image as a matrix, but I don't know how to specify the beginning of the cells (corresponding to different subplots in panel D of the image) in the heatmap.

Also, could you please explain how this can be done and why this has to be done?
Any suggestions?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HeatMap plot with arduino serial data tshivam 0 3,204 Oct-08-2018, 10:57 AM
Last Post: tshivam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020