User 6ef33138f9
14-12-2006 16:50:32
We'd like to be able to convert atom coordinates to and from image coordinates. For example, we'd like to display a molecule image rendered by Marvin, with our own additional information drawn over the image, based on the locations of certain atoms.
When Marvin renders a 2D image for a molecule, the scaling factor (between atomic coordinates and image coordinates) can be obtained by calling Molecule.getImageSize. If there are no labels on the atoms (hydrogens, charges, valences, etc.), then the scale is enough to determine the coordinate transformation accurately. But if there's extra text next to any of the atoms (the most common case is hydrogens on terminal atoms that appear on the edges of the molecule image), we don't know exactly how much to translate the coordinates before or after scaling.
Currently we're estimating this by doing our own approximate calculations: we look for heteroatoms that appear at the edges of the image that also have hydrogen counts, and estimate the width of the text given the scaling factor. Sometimes this works pretty well and sometimes it's off by quite a bit. Also, the results vary between different versions of Marvin.
Is there a more direct or reliable way to determine the coordinate transformations?
Thanks,
Chris
When Marvin renders a 2D image for a molecule, the scaling factor (between atomic coordinates and image coordinates) can be obtained by calling Molecule.getImageSize. If there are no labels on the atoms (hydrogens, charges, valences, etc.), then the scale is enough to determine the coordinate transformation accurately. But if there's extra text next to any of the atoms (the most common case is hydrogens on terminal atoms that appear on the edges of the molecule image), we don't know exactly how much to translate the coordinates before or after scaling.
Currently we're estimating this by doing our own approximate calculations: we look for heteroatoms that appear at the edges of the image that also have hydrogen counts, and estimate the width of the text given the scaling factor. Sometimes this works pretty well and sometimes it's off by quite a bit. Also, the results vary between different versions of Marvin.
Is there a more direct or reliable way to determine the coordinate transformations?
Thanks,
Chris