-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for clim (contrast limits) #47
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
45bf849
Add support for contrast limits
almarklein af35d6f
Add contrast example
almarklein a3332cc
Update 3 other examples
almarklein 11ca4ed
update readme
almarklein d3ddcfb
add note to readme in generated code
almarklein 38b4f33
tweak doc-build so test is more robust
almarklein 4640f07
fix handling of thumbnails, and a few tweaks
almarklein b8f1e11
add tests for clim
almarklein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
A small example demonstrating contrast limits. | ||
""" | ||
|
||
import dash | ||
import dash_html_components as html | ||
import dash_core_components as dcc | ||
from dash.dependencies import Input, Output | ||
from dash_slicer import VolumeSlicer | ||
import imageio | ||
|
||
|
||
app = dash.Dash(__name__, update_title=None) | ||
|
||
vol = imageio.volread("imageio:stent.npz") | ||
slicer = VolumeSlicer(app, vol, clim=(0, 1000)) | ||
clim_slider = dcc.RangeSlider( | ||
id="clim-slider", min=vol.min(), max=vol.max(), value=(0, 1000) | ||
) | ||
|
||
app.layout = html.Div([slicer.graph, slicer.slider, clim_slider, *slicer.stores]) | ||
|
||
|
||
@app.callback(Output(slicer.clim.id, "data"), [Input("clim-slider", "value")]) | ||
def update_clim(value): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. beautifully simple! |
||
return value | ||
|
||
|
||
if __name__ == "__main__": | ||
# Note: dev_tools_props_check negatively affects the performance of VolumeSlicer | ||
app.run_server(debug=True, dev_tools_props_check=False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand well, before having
clim
the contrast could vary as the slice changed, since the max of the slice was used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely spotted! Yes, it did. I think I originally meant to scale to the volume min/max, but accidentally used the
im
instead.