Skip to content

Add docs for thick slicing #794

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brisvag
Copy link
Contributor

@brisvag brisvag commented Jul 22, 2025

References and relevant issues

Description

We finally have decent GUI and programmatic access to thick slicing. This PR adds some info about it in the viewer tutorial.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jul 22, 2025
@brisvag brisvag changed the title add some docs for thick slicing Add docs for thick slicing Jul 22, 2025
@brisvag
Copy link
Contributor Author

brisvag commented Jul 22, 2025

Uh, it seems that the screenshots generated via code cells are not rendered in the CI's rendered docs. Is that normal?

@TimMonko
Copy link
Contributor

Uh, it seems that the screenshots generated via code cells are not rendered in the CI's rendered docs. Is that normal?

It is now! Our CI is now like 3 minutes on here. See napari.org/dev/developers/contributing/documentation/index.html#contributing-to-the-napari-documentation-without-a-local-setup
You can ping the bot to run docs code with @napari-bot make docs. I'm going to ping a full build though just for fun

@napari-bot make html

@TimMonko
Copy link
Contributor

@psobolewskiPhD make html gave an error https://github.com/napari/docs/actions/runs/16461947669
@napari-bot make docs

@TimMonko TimMonko added this to the 0.6.3 milestone Jul 23, 2025
@psobolewskiPhD
Copy link
Member

I wonder if it's because you have the command twice?

@napari-bot make html

@psobolewskiPhD
Copy link
Member

Looks to be the case. My comment above with text and a single command worked:
https://github.com/napari/docs/actions/runs/16532997545?pr=794+%28comment%29

I can see that with two commands in one comment things get confusing. So let's just not do that 😅


Lastly, `viewer.dims.point` contains the position in world coordinates (i.e., including
scale and translate transformations).
While by default napari will only show data located *exactly* at this position, it is possible to visualize data from a thicker dimensional slice by modifying `viewer.dims.margin_left` and `viewer.dims.margin_right`, or `viewer.dims.thickness` to change both symmetrically (or the corresponding `*_step` properties to work in "slider coordinates").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
While by default napari will only show data located *exactly* at this position, it is possible to visualize data from a thicker dimensional slice by modifying `viewer.dims.margin_left` and `viewer.dims.margin_right`, or `viewer.dims.thickness` to change both symmetrically (or the corresponding `*_step` properties to work in "slider coordinates").
By default napari will only show a slice of the data: that which is located *exactly* at this position. However, it is possible to visualize data from a thicker dimensional slice by modifying `viewer.dims.thickness`. This will use each layer's `projection_mode` to visualize the space around `viewer.dims.point`. Alternately, you can set `viewer.dims.margin_left` and `viewer.dims.margin_right` to explicitly set the range of data around `viewer.dims.point` to be projected. Finally, you can use the corresponding `margin_left_step` and `margin_right_step` properties to work in "slider coordinates".

I found the original very dense and hard to understand. I think this is clearer? But maybe no longer correct 😅

scale and translate transformations).
While by default napari will only show data located *exactly* at this position, it is possible to visualize data from a thicker dimensional slice by modifying `viewer.dims.margin_left` and `viewer.dims.margin_right`, or `viewer.dims.thickness` to change both symmetrically (or the corresponding `*_step` properties to work in "slider coordinates").

When margins are non-zero, data is included from before (left) or after (right) the `viewer.dims.point` location, and for each layer it will be projected onto the visible space based on the `projection_mode` of that layer:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my suggestion above, this might be removed.

Suggested change
When margins are non-zero, data is included from before (left) or after (right) the `viewer.dims.point` location, and for each layer it will be projected onto the visible space based on the `projection_mode` of that layer:

@psobolewskiPhD
Copy link
Member

If/once we get the Features or Highlights page going, this is a great thing to break out to that page, instead of making the Viewer tutorial even more complex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add use info for both GUI and programmatic thick slicing controls
3 participants