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

Add scalebar to the graph #8

Open
Greerlab opened this issue Mar 18, 2024 · 4 comments
Open

Add scalebar to the graph #8

Greerlab opened this issue Mar 18, 2024 · 4 comments

Comments

@Greerlab
Copy link

Hi, thank you for providing the opportunity to explore the mouse brain ISH atlas with coding!

I am wondering whether there is a way to add the scale bar into the graph?

Thanks!

@oganm
Copy link
Owner

oganm commented Mar 19, 2024

Just added a rudimentary function to add a scale bar. The information you need is available through getSectionImage and getAtlasImage which include the resolution information in pixels for the images. This can then be fed to add_scale to add a scale bar

downsample = 2

image_res = getSectionImage(69177654)$resolution

downloadImage(imageID = 69177654, 
             view = 'projection',
             downsample = downsample) %>% 
    add_scale(image_res,downsample)

Also works for cropped images

downloadImage(imageID = 69177654, 
             view = 'projection',
             downsample = downsample)  %>% 
    centerImage(x = 6382,
            y= 2744,
            xProportions = c(.1,.1),
            yProportions =c(.1,.1),
            downsample = downsample) %>% 
    add_scale(image_res,downsample)

@oganm oganm closed this as completed Mar 19, 2024
@Greerlab
Copy link
Author

Thank you for the quick response, somehow I got an error from add_scale

Error in magick::image_read(system.file("black.png", package = "allenBrain")) : path must be URL, filename or raw vector

@oganm
Copy link
Owner

oganm commented Mar 20, 2024

Just forgot to push the all important black pixel. Should be fine now

@oganm
Copy link
Owner

oganm commented Mar 20, 2024

  • a parameter to draw a scalebar for x microns
  • Gravity options shouldn't be essential since all margins are in ratios instead of pixels.
  • Transparency to the scalebar background
  • End and breaklines for the bar

@oganm oganm reopened this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants