Image to Histogram

Thread Starter

Ioannis66

Joined Nov 7, 2012
45
The original is the helab3.jpg. The others are google examples for the people here to see what I mean.

After the scan, like helab3.jpg, how can one convert this image to a diagram?

Ioannis
 

MrChips

Joined Oct 2, 2009
30,618
If I understand this correctly, the specimen is a .jpg file and not a physical printed piece of paper?

In that case, here is how I would do it.

1) Read the image using a MATLAB program.
2) Manually position a straight line across the image on the screen.
3) Extract the data falling under the straight line into an array.
 

jpanhalt

Joined Jan 18, 2008
11,087
Presumably, that is a gel electrophoresis that has been stained, and I suspect you realize that purpose-made scanners are available.

On the cheap, you might consider using Photoshop on a high-resolution image . My CS3 version can give a histogram from an image.
 

Lo_volt

Joined Apr 3, 2014
315
purpose-made scanners are available.
There are likely purpose made programs to do what you want as well. What equipment did you use to come up with the image? Did you create the film yourself? The manufacturer of the equipment should have software to support it. That software should do what you want.
 

Thread Starter

Ioannis66

Joined Nov 7, 2012
45
That film indeed was created by gel electrophoresis. My client has given me this film.

I am designing a robotic machine to automate the process of electrophoresis and part of the project is to digitize by a camera or scanner the result of staining and create an histogram image.

So, Matlab is not my option I think. I was more in the direction of LabView that might do that process. Have not found yet how to do that in labview.

Maybe there are utilities in Pi but have no experience with that board yet.

Ioannis
 

Lo_volt

Joined Apr 3, 2014
315
Ok, so you are the one developing the software.

The general idea of processing a gel image like that is to identify the vertical columns and to draw a curve through the center of each column. The curve will end up following the contour of the column so it won't be vertical and it won't be a straight line. Once you've drawn the curve you graph the pixel intensities through the path of the curve. The intensity graph will be your histogram. The toughest part is finding the center of each column as the blobs will get fainter as you get to the bottom of the image.

I worked for a company over 30 years ago that processed gel films for doing DNA sequencing. While I didn't do any coding, only hardware, I had a good idea of what the coders were doing.

It sounds like you're leaning toward Labview. You may want to contact National Instruments to see if they have a library or example code that may help.
 

Ya’akov

Joined Jan 27, 2019
9,044
It might be helpful to know that the ImageMagick library, which has both command line utilities and bindings for many (most?) languages, can produce histograms.

It's pretty easy, though the documentation is a bit arcane. For example, this image:

Y7D_6493.jpg

with this command line:
Code:
convert Y7D_6493.jpg -define histogram:unique-colors=false histogram:histogram.gif
produces this image:

histogram.gif

The scaling and other aspects can be controlled with options I didn't bother with.
 

Alec_t

Joined Sep 17, 2013
14,263
As with other histogram creator software (e.g. paint.net), although the histogram above shows which components (colour, alpha) are present and at what relative strength, it doesn't show where they occur in the original image, which I think is what the TS is looking for.
 

Ya’akov

Joined Jan 27, 2019
9,044
As with other histogram creator software (e.g. paint.net), although the histogram above shows which components (colour, alpha) are present and at what relative strength, it doesn't show where they occur in the original image, which I think is what the TS is looking for.
ImageMagick can do a ridiculous number of transformations on images and there are many options in the histogram generator (including textual output of the information about color, intensity, and location).

It almost certainly can do the job, if he wants a library for a general purpose programming language of command line scripting.
 

Thread Starter

Ioannis66

Joined Nov 7, 2012
45
Thank you Yaakov for the interesting find. Will have a deep look at this tool.

I'd like to have the level of each shade of my result as a number also. In my first image, the tall curve would have higher value etc.

Ioannis
 

Alec_t

Joined Sep 17, 2013
14,263
I've just come across ImageJ, open source software available as a Fiji distribution here.
It seems to be able to do exactly what you want. From the manual:
ImageJ_feature.PNG
It can also do mathematical operations on image data and is scriptable.

Edit: The histogram (profile) data can be given as a list, which can be exported as a file.
The analysis functions available include Gel-specific ones.
gel_tools.PNG
 
Last edited:

bertus

Joined Apr 5, 2008
22,266
Hello,

@Alec_t , that is a good find. It is standard in science repository of my linux distribution.
I did a little test on the first lines of your picture on my linux machine and that gave me this result:

loannis_helab3_ImageJ.JPG

Bertus
 

Lo_volt

Joined Apr 3, 2014
315
Yaakov, that's cool stuff. As I noted earlier, the company I worked for was working on this in its infancy. The Human Genome Project had just gotten started. The coders that I worked with were studying their text books to turn it into usable code. There's been so much progress in Molecular Biology since then it only makes sense that progress has been made in analysis as well.
 

Ya’akov

Joined Jan 27, 2019
9,044
I am impressed with the range of functions in the plugins, including stuff for confocal microscopy and a bridge to Imaris software which is seriously expensive stuff that does 3D motion analysis for it. The seats cost about $20K.
 
Top