4
|
10809 Views
|
3 Replies
|
14 Total Likes
View groups...
Share
GROUPS:

# Extracting data from images of spectral plots generated by SDBS

Posted 11 years ago
 I sometimes obtain plots from Spectral Database for Organic Compounds (SDBS). They are just images or PDF files  like the one in this post. Notice the unusual reversed non-uniform time axis. How could I extract data from it  is it possible at all? Even a general recommendation would be helpful. I am also looking for re-plotting this with a normal uniform axis. Thank you! 3 Replies
Sort By:
Posted 11 years ago
 There are a number of questions about this on Mathematica.SE.  Here are two you may be interested in:Take a look at @halirutan's answer in particular.
Posted 11 years ago
 This is great, - exactly what I was hoping for. Nice trick with ImageData and Position ;-) My colleagues and I applied this to a few other plots  works perfectly, thank you!
Posted 11 years ago
 Yes, but it's not totally automatic.Here is how I would do it.First, import the image (above):image = Import["C:\\Users\\arnoudb.WRI\\Downloads\\WqZ6swa.png"]Next, with the image editing tools extract just the content area:image2 = ImageTake[image, {18, 683}, {74, 1498}] Then extract the "black" points:pos = Position[ImageData[image2], {0., 0., 0.}];Then get the data ranges (in the "image coordinate system"): In:= Max[pos[[All, 1]]] Out= 635  In:= Min[pos[[All, 1]]] Out= 32  In:= Max[pos[[All, 2]]] Out= 1425 In:= Min[pos[[All, 2]]]Out= 1Then rescale the data points and do a list plot (Edit: It looks like the original plot has some piecewise linear scaling or logarithmic scaling, which will make the correct transformation a bit harder):ListPlot[{Rescale[#[], {1, 1425}, {4000, 400}], Rescale[#[], {635, 32}, {0, 100}]} & /@ pos] Note how the data is "reversed" from the original image, since the original image has a very strange x-axis (it starts at 4000 andthen goes down to 400).