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 can i display the ruler unit of measurement? #1148

Closed
mariocesarf opened this issue Apr 11, 2022 · 19 comments
Closed

How can i display the ruler unit of measurement? #1148

mariocesarf opened this issue Apr 11, 2022 · 19 comments
Labels
question Further information is requested
Milestone

Comments

@mariocesarf
Copy link

I want to display the ruler unit of measurement when use the Ruler tool, showing alongside the number, how can i do this?

@ivmartel ivmartel added the question Further information is requested label Apr 12, 2022
@ivmartel ivmartel added this to the 0.32.0 milestone Apr 12, 2022
@ivmartel
Copy link
Owner

It should come automatically for all modalities but echography (US). For this one, we need calibration, see #897.

@icaroxavier
Copy link

So what is the code needed to do this?

@icaroxavier
Copy link

I want to put a unit after the number showing, like "150mm" rather than just "150"

@ivmartel
Copy link
Owner

Is it echo (modality: US) or not?

@icaroxavier
Copy link

icaroxavier commented Apr 20, 2022

Imperial system, meters, i didn't understand this question, can explain more?

@ivmartel
Copy link
Owner

Most image modalities (CT, MR...) include pixel spacing in the dicom header. When present, the viewer will use this tag to translate a number of pixels to a distance in mm. For the modality US (echography), this spacing is not present, the viewer cannot do the translation, that's why it does not show a unit next to a measurement.

@icaroxavier
Copy link

I have pixel spacing in mine
image

@icaroxavier
Copy link

If i have this, i cant custom the size of the canvas?

@ivmartel
Copy link
Owner

You can, the viewer will try to fit the data in it as best as it can.

@icaroxavier
Copy link

So, having the PixelSpacing, how do i show the "mm" or "cm"?

@ivmartel
Copy link
Owner

The ruler uses the dwv.math.Line class, its quantify method will return the length with unit if the length is not null. Are you using the default ruler tool and it is not showing the unit?

@icaroxavier
Copy link

Yes, I’m using the default ruler

@icaroxavier
Copy link

I'm using,
this.state.dwvApp.setTool("Draw")
this.state.dwvApp.setDrawShape("Ruler")

@ivmartel
Copy link
Owner

And it does not work? Does the console say anything?

@icaroxavier
Copy link

The console say nothing and
image

@icaroxavier
Copy link

The unit is millimeter?

@ivmartel
Copy link
Owner

yes, it should be millimeter.

Now I get your problem, you are in a setup similar to the one of dwv-react, no? In these demos, the translation files are not loaded. The quantify method I mentioned above, returns an object with the unit that comes from a translation file, since there is none, it comes back empty. I still need to find an way to includes these translations... All help accepted, if you know how react handles this, I'm interested!

@icaroxavier
Copy link

Yes, is a react project, i'll try too, if i can resolve the problem i'll send to you

@ivmartel ivmartel modified the milestones: 0.32.0, 0.31.0 Mar 6, 2023
@ivmartel
Copy link
Owner

ivmartel commented Mar 6, 2023

Closing for now, feel free to comment if you need.

@ivmartel ivmartel closed this as completed Mar 6, 2023
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

3 participants