Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set spacing of PNGs for length measuring #896

Closed
RLeipe opened this issue Mar 20, 2021 · 5 comments
Closed

How to set spacing of PNGs for length measuring #896

RLeipe opened this issue Mar 20, 2021 · 5 comments
Labels
question Further information is requested
Milestone

Comments

@RLeipe
Copy link

RLeipe commented Mar 20, 2021

I want to use the Ruler tool on PNGs, but cant't figure out how to set the spacing for a PNG so that the getWorldLength() function can work (If I even understood correctly how it works). How and where would I do this?

@ivmartel ivmartel added the question Further information is requested label Mar 21, 2021
@ivmartel ivmartel added this to the 0.29.0 milestone Mar 21, 2021
@ivmartel
Copy link
Owner

I created #897 to allow for manual calibration: for data that do not provide pixel spacing, the user should be able to specify it manually. The app should provide a setImageSpacing method that would set the spacing of the image. From then, the measuring tools should work.

@RLeipe
Copy link
Author

RLeipe commented Mar 21, 2021

Thanks, that's exactly it.

@RLeipe
Copy link
Author

RLeipe commented Mar 21, 2021

One thing I'm still not getting: When using the DWV Static on a png, using the ruler still results in "mm" being shown after the length (which seems to be just the number of pixels). Since the mm seems to only be displayed if there is a spacing set:

var length = line.getWorldLength(spacing.getColumnSpacing(), spacing.getRowSpacing());

if (length !== null) {quant.length = {value: length, unit: dwv.i18n('unit.mm')};}
There seems to be some way in which dwv static has made at least that work. How is that?

@ivmartel
Copy link
Owner

You're right, the code sets a default spacing for DOM images (see domReader.js#L45), which is wrong...

@ivmartel
Copy link
Owner

Closing for now, please comment on #897 if you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants