diff --git a/README.md b/README.md index 3769057c..d1c9f670 100644 --- a/README.md +++ b/README.md @@ -132,14 +132,15 @@ Open this link in the browser, navigate to the exact dataset, right-click on the ### ii) Open `inTRACKtive` using a Jupyter Notebook -To make the previous two proccesses (conversion + hosting data) easiest, we compiled them into a single python function, which is demonstration in a [Jupyter Notebook (`/napari/src/intracktive/examples`)](/python/src/intracktive/examples/notebook1_inTRACKtive_from_notebook.ipynb). +To make the previous two proccesses (conversion + hosting data) easier, we compiled them into a single python function, which is demonstration in a [Jupyter Notebook (`/napari/src/intracktive/examples`)](/python/src/intracktive/examples/notebook1_inTRACKtive_from_notebook.ipynb). ``` dataframe_to_browser(data, zarr_dir) ``` - where `data` is a `pandas.dataFrame` containing the tracking data, and `zarr_dir` to directory on your computer to save the Zarr file. The `dataframe_to_browser` function, under the hood, sequentially: 1) converts pd.dataFrame to Zarr, 2) saves the Zarr in the specified location, 3) spins up a localhost at that location, and 4) launches a browser window of `inTRACKtive` with as dataUrl the zarr in the localhost. All in a function call. +> ⚠️ Currently `dataframe_to_browser` only works for Chrome and Firefox + ### iii) Open `inTRACKtive` using the napari widget Using the same capabilities of the `dataframe_to_browser`, we made a [napari](https://napari.org/stable/) widget. The widget (`intracktiveWidget`) is part of the python package after `pip install`, and automatically shows up in the napari widget list (`plugins>inTRACKtive`). To keep the `inTRACKtive` python package light-weight, napari is not listed as one of it's dependecies. To make use of the napari widget, please `pip install napari[all]` in the same conda environment as `inTRACKtive`. The widget takes the tracking data from a [`tracks`](https://napari.org/dev/howtos/layers/tracks.html) layer in napari and opens an `inTRACKtive` browser window with the data. We provide an example of how to use the widget in a [Jupyter Notebook (`/napari/src/intracktive/examples`)](/python/src/intracktive/examples/notebook2_inTRACKtive_from_napari.ipynb). diff --git a/python/src/intracktive/convert.py b/python/src/intracktive/convert.py index d17976f7..efdea570 100644 --- a/python/src/intracktive/convert.py +++ b/python/src/intracktive/convert.py @@ -304,9 +304,9 @@ def dataframe_to_browser(df: pd.DataFrame, zarr_dir: Path) -> None: if str(zarr_dir) in (".", None): with tempfile.TemporaryDirectory() as temp_dir: zarr_dir = Path(temp_dir) - logging.info("Temporary directory used for localhost:", zarr_dir) + logging.info("Temporary directory used for localhost: %s", zarr_dir) else: - logging.info("Provided directory used used for localhost:", zarr_dir) + logging.info("Provided directory used used for localhost: %s", zarr_dir) extra_cols = [] zarr_path = ( @@ -324,14 +324,17 @@ def dataframe_to_browser(df: pd.DataFrame, zarr_dir: Path) -> None: threaded=True, ) - logging.info("localhost successfully launched, serving:", zarr_dir_with_storename) + logging.info( + "localhost successfully launched, serving: %s", zarr_dir_with_storename + ) baseUrl = "https://intracktive.sf.czbiohub.org" # inTRACKtive application dataUrl = hostURL + "/zarr_bundle.zarr/" # exact path of the data (on localhost) fullUrl = baseUrl + generate_viewer_state_hash( data_url=str(dataUrl) ) # full hash that encodes viewerState - logging.info("full URL", fullUrl) + logging.info("Copy the following URL into the Google Chrome browser:") + logging.info("full URL: %s", fullUrl) webbrowser.open(fullUrl) diff --git a/python/src/intracktive/createHash.py b/python/src/intracktive/createHash.py index 80af66b7..1e6390e6 100644 --- a/python/src/intracktive/createHash.py +++ b/python/src/intracktive/createHash.py @@ -32,6 +32,8 @@ def generate_viewer_state_hash(data_url: str) -> str: "showTrackHighlights": True, "cameraPosition": [-4, 0, 0], "cameraTarget": [0, 0, 0], + "pointSize": 0.1, + "trackWidthFactor": 1, } # Step 1: Serialize the viewer state to a JSON string diff --git a/python/src/intracktive/examples/notebook1_inTRACKtive_from_notebook.ipynb b/python/src/intracktive/examples/notebook1_inTRACKtive_from_notebook.ipynb index b7f6de1c..2996df2e 100644 --- a/python/src/intracktive/examples/notebook1_inTRACKtive_from_notebook.ipynb +++ b/python/src/intracktive/examples/notebook1_inTRACKtive_from_notebook.ipynb @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ diff --git a/python/src/intracktive/examples/notebook2_inTRACKtive_from_napari.ipynb b/python/src/intracktive/examples/notebook2_inTRACKtive_from_napari.ipynb index 139831c8..bd4bcb85 100644 --- a/python/src/intracktive/examples/notebook2_inTRACKtive_from_napari.ipynb +++ b/python/src/intracktive/examples/notebook2_inTRACKtive_from_napari.ipynb @@ -17,7 +17,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [