|
1 |
| -import os |
2 |
| -import glob |
| 1 | +import binascii |
3 | 2 | import copy
|
4 |
| -import json |
5 |
| -import time |
6 |
| -# Now assumes python 3 |
7 |
| -from queue import Queue |
8 |
| -from configparser import NoOptionError |
9 |
| -import shutil |
10 |
| -import random |
11 | 3 | import functools
|
12 |
| -import binascii |
| 4 | +import glob |
| 5 | +import json |
13 | 6 | import mimetypes
|
| 7 | +import os |
| 8 | +import random |
| 9 | +import shutil |
14 | 10 | import threading
|
| 11 | +import time |
15 | 12 | import warnings
|
16 | 13 | import webbrowser
|
| 14 | +from configparser import NoOptionError |
| 15 | + |
| 16 | +# Now assumes python 3 |
| 17 | +from queue import Queue |
| 18 | + |
17 | 19 | import numpy as np
|
18 | 20 | from tornado import web
|
19 | 21 |
|
20 |
| -from .FallbackLoader import FallbackLoader |
21 |
| -from .. import utils, options, volume, dataset |
| 22 | +from .. import dataset, options, utils, volume |
22 | 23 | from ..database import db
|
23 | 24 | from . import serve
|
24 | 25 | from .data import Package
|
| 26 | +from .FallbackLoader import FallbackLoader |
25 | 27 |
|
26 | 28 | try:
|
27 | 29 | cmapdir = options.config.get('webgl', 'colormaps')
|
@@ -235,7 +237,11 @@ def show(data, types=("inflated", ), recache=False, cmap='RdBu_r', layout=None,
|
235 | 237 | autoclose=None, open_browser=None, port=None, pickerfun=None,
|
236 | 238 | template="mixer.html", overlays_available=None,
|
237 | 239 | overlays_visible=('rois', 'sulci'), labels_visible=('rois', ),
|
238 |
| - overlay_file=None, title='Brain', **kwargs): |
| 240 | + overlay_file=None, |
| 241 | + curvature_brightness=None, |
| 242 | + curvature_smoothness=None, |
| 243 | + curvature_contrast=None, |
| 244 | + title='Brain', **kwargs): |
239 | 245 | """
|
240 | 246 | Creates a webGL MRI viewer that is dynamically served by a tornado server
|
241 | 247 | running inside the current python process.
|
@@ -287,6 +293,15 @@ def show(data, types=("inflated", ), recache=False, cmap='RdBu_r', layout=None,
|
287 | 293 | overlay_file : str or None, optional
|
288 | 294 | Custom overlays.svg file to use instead of the default one for this
|
289 | 295 | subject (if not None). Default None.
|
| 296 | + curvature_brightness : float or None, optional |
| 297 | + Brightness of curvature overlay. Default None, which uses the value |
| 298 | + specified in the config file. |
| 299 | + curvature_smoothness : float or None, optional |
| 300 | + Smoothness of curvature overlay. Default None, which uses the value |
| 301 | + specified in the config file. |
| 302 | + curvature_contrast : float or None, optional |
| 303 | + Contrast of curvature overlay. Default None, which uses the value |
| 304 | + specified in the config file. |
290 | 305 | title : str, optional
|
291 | 306 | The title that is displayed on the viewer website when it is loaded in
|
292 | 307 | a browser.
|
@@ -345,9 +360,12 @@ def show(data, types=("inflated", ), recache=False, cmap='RdBu_r', layout=None,
|
345 | 360 | my_viewopts = dict(options.config.items('webgl_viewopts'))
|
346 | 361 | my_viewopts['overlays_visible'] = overlays_visible
|
347 | 362 | my_viewopts['labels_visible'] = labels_visible
|
348 |
| - my_viewopts['brightness'] = options.config.get('curvature', 'brightness') |
349 |
| - my_viewopts['smoothness'] = options.config.get('curvature', 'webgl_smooth') |
350 |
| - my_viewopts['contrast'] = options.config.get('curvature', 'contrast') |
| 363 | + my_viewopts['brightness'] = options.config.get('curvature', 'brightness') \ |
| 364 | + if curvature_brightness is None else curvature_brightness |
| 365 | + my_viewopts['smoothness'] = options.config.get('curvature', 'webgl_smooth') \ |
| 366 | + if curvature_smoothness is None else curvature_smoothness |
| 367 | + my_viewopts['contrast'] = options.config.get('curvature', 'contrast') \ |
| 368 | + if curvature_contrast is None else curvature_contrast |
351 | 369 |
|
352 | 370 | for sec in options.config.sections():
|
353 | 371 | if 'paths' in sec or 'labels' in sec:
|
@@ -824,7 +842,7 @@ def get_local_client(self):
|
824 | 842 | return client
|
825 | 843 | else:
|
826 | 844 | try:
|
827 |
| - from IPython.display import display, HTML |
| 845 | + from IPython.display import HTML, display |
828 | 846 | display(HTML('Open viewer: <a href="{0}" target="_blank">{0}</a>'.format(url)))
|
829 | 847 | except:
|
830 | 848 | pass
|
|
0 commit comments