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

# Extracting data from images of spectral plots generated by SDBS

Posted 12 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 12 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 12 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 12 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[33]:= Max[pos[[All, 1]]] Out[33]= 635  In[34]:= Min[pos[[All, 1]]] Out[34]= 32  In[35]:= Max[pos[[All, 2]]] Out[35]= 1425 In[36]:= Min[pos[[All, 2]]]Out[36]= 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[#[[2]], {1, 1425}, {4000, 400}], Rescale[#[[1]], {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).