bad recognition of particular file
Using the image below, molvec version 0.9.8 is recognizing it as ethane (version 0.9.6 was finding propane). Is there something wrong with this PNG? Is there some kind of preprocessing that might improve the recognition?
$ java -jar $molvec -f '/Users/jasonb/molvec_issue.png'
Molvec0104152114022D
2 1 0 0 0 0 0 0 0 0999 V2000
0.5000 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5000 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
M END

Thanks for creating this issue. We are looking into the problem
Yeah, the color model for this image isn't properly handled in our grayscale conversion. We've found the problem and should have a fix shortly.
We have pushed a fix for this issue. I have also pushed this change out to maven's snapshot repository.
Can you either check out the latest version of the codebase or change your molvec dependency in your build tool to 0.9.9-SNAPSHOT (might require adding the snapshot url depending on your build tool) and then give your images another try? if you're satisfied we will close the ticket.
thanks!! Molvec Team
Thank you for the fast response on this - we rebuilt the jar off of master, but I still get the same result on this particular image:
jasonb2maclap-2:build jasonb$ echo $molvec
/Users/jasonb/Downloads/molvec-0.9.9-SNAPSHOT-jar-with-dependencies.jar
jasonb2maclap-2:build jasonb$ java -jar $molvec -f '/Users/jasonb/molvec_issue.png'
Molvec0104172113152D
2 1 0 0 0 0 0 0 0 0999 V2000
0.5000 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.5000 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
M END
Sorry to hear that! I just tried the same locally by downloading the png file above, and it seems to work.
$ java -jar target/molvec-0.9.9-SNAPSHOT-jar-with-dependencies.jar -f 114924211-5abece80-9df3-11eb-81fc-6480db039b20.png
Molvec0104172116072D
10 10 0 0 0 0 0 0 0 0999 V2000
0.0017 1.7524 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8672 2.2531 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.8672 -0.7510 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.8672 0.2504 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8672 -0.7510 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0017 -1.2517 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.8672 0.2504 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0017 -2.2531 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.8672 2.2531 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0017 0.7511 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
7 10 1 0
1 2 2 0
3 4 1 0
3 6 2 0
1 9 1 0
1 10 1 0
5 6 1 0
5 7 1 0
4 10 1 0
6 8 1 0
M END
Is it possible that local cached changes or something similar have prevented a clean build? Can you do a git stash, git pull, and try building again? Also see if a mvn clean test finishes with any failing tests? There should be 310 tests run, if there are fewer there's probably some inconsistent state on the local git repo.
Thanks for bringing this to our attention!
Thanks for those results, that means it is on my end somewhere. I'll build locally Monday instead of on a remote machine and see what is going wrong.
I made a fresh checkout and built the jar locally on my mac rather than a remote Linux machine. I built it in Eclipse by right clicking the pom.xml and selecting Run as -> Maven install. The output there shows all tests passing but it also prints a stack trace for a CDK-related exception, not sure if that is relevant. I don't have any experience with maven so I don't know if the warning on the third line is regarding my setup or the project.
But I still seem to get the same result from using the jar file. When I open the file up in the GUI, it shows it only recognized a line at the bottom of the image, the rest is blank. Attaching the gui's command-line output here as well.
It's possible that the image we tried is different than the one you're testing, or that something strange is happening with the jar build. Here is a gist of the jar I tried:
https://gist.github.com/tylerperyea/6df01e5693105dd93c4815ea43c733bf/raw/d7edac4542652c672ca38cbee586eec26dc4dd91/molvec-0.9.9-SNAPSHOT-jar-with-dependencies.jar
Here is the md5sum of the image above that I tried:
$md5sum 114924211-5abece80-9df3-11eb-81fc-6480db039b20.png
635e821cb12f10a7d8df01ca6a7e2498 114924211-5abece80-9df3-11eb-81fc-6480db039b20.png
Could you confirm that the md5sum of your image locally matches this? You can also see if the raw jar does work for that image. This may help debug the issue.
It is the same file, same md5sum, and I got the same result from your jar as the one I built. Then I tried it on a linux machine and got the correct result. Looking a little closer I find different behavior for different java versions.
On the linux machine the command java -version returns openjdk version "1.8.0_262" and the image is recognized properly. On my mac java -version returns openjdk version "15.0.2" 2021-01-19 and it fails. But looking further I see a few versions on my mac:
$ ls /Library/Java/JavaVirtualMachines/
jdk-11.0.5.jdk jdk1.7.0_79.jdk jdk1.8.0_101.jdk
If I find the java executable in those directories and use it on the image here, then it works for 1.7 and 1.8 but fails for 11.0.5 (I do not understand java versioning).
I hope that was clear.
I looked at the jar that I had built, and Eclipse was set to use java 8 (which is the same as 1.8?). I manually switched the java home for maven to use to the jdk-11.0.5.jdk listed above, and it no longer builds (I did run maven clean before maven install). I'm attaching the output from the maven install in case that is helpful.
edit: I should have narrowed in on this sooner. The current sources will compile and pass tests against java 1.8. If you take that jar and run it from java 11 then it fails this test file. If I try to compile against java 11 then it fails due to test failures.