RGSoC helped us explore the diverse world of open-source. Here is a blog sharing our experience!
Following is a detailed description of the contributions made to napari and LatexGo by Team Programaholics!
Members:
We worked on understanding how to perform parameter sweep with napari, and attempted to write a tutorial with examples for using dask and magicgui to perform parameter sweep, as suggested in issue #43
We opened pull request #67 for this tutorial for the applications section for napari.
A parametric sweep allows for a parameter to be swept through a range of user-defined values. Using napari to perform parameter sweep, allows the user to call a method with different parameter values, by moving the slider across the axis.
The tutorial is designed to help users visualise parameter sweep using napari, dask and magicgui.
We added three examples for the same:
- Lazy parameter sweep for a 2D periodic function using dask
- Parameter sweep using napari to visualize thresholding of an image
- Adding apply_threshold method as a magicgui widget to napari for visualizing the thresholded image
We defined a 2D periodic function and visualized the output for different values of the x and y parameters. We defined a function that lazily shifts an array using the delayed
method from Dask. Rather than shifting the array immediately, delayed
will defer execution, and compute the result when required. It places the function and its arguments into a task graph similar to the one here:
We visualized these lazy shifts using napari as follows:
Making use of parameter sweep in napari, we can simplify many tasks, such as manually finding the best thresholding technique, or deciding the desired block_size
or window_size
to be passed as parameters for thresholding:
We then used the magicgui widget along with napari to better visualize the different thresholding techniques. The thresholded image is computed only for the layer and thresholding technique selected from the drop-down menus, for the value of block_size
or window_size
passed via the slider to the widget.
We used the magicgui decorator for the method apply_threshold
to turn it into a magicgui. Further, a callback function was fefined to update the resultant layer whenever the magicgui is called.
We opened pull request #66 for adding documentation to napari's image layer tutorial, for scaling an image layer, while giving an example of scaling the Z-axis for the data-set of a retina's data-set. While documenting, we elaborated how scaling can be performed while adding an image layer to the viewer, or for an existing image layer as follows:
# scaling while creating the image layer, uses scale as keyword argument
napari.view_image(retina, name='retina', scale=[1,10,1,1])
# scaling an existing layer, uses scale as a property of the layer
viewer.layers['retina'].scale = [1,10,1,1]
Following is a demo of scaling the image layer:
We worked on solving issue #1041: Label painting modifies the input array in-place, by providing documentation for the methods view_labels
and add_labels
about modification of input-array in-place, when the developer uses label modification tools such as label painting and erasing.
We added this documentation to the docstrings of the methods, and also provided examples on passing a copy of the input-array to add_labels
and view_labels
, and also obtaining the modified/resultant array after performing label modification:
Documentation added for add_labels
:
Using the viewer's label editing tools (painting, erasing) will
modify the input-array in-place.
To avoid this, pass a copy as follows:
layer = viewer.add_labels(data.copy())
# do some painting/editing
Get the modified labels as follows:
result = layer.data
Documentation added for view_labels
:
Using the viewer's label editing tools (painting, erasing) will
modify the input-array in-place.
To avoid this, pass a copy as follows:
viewer = napari.view_labels(data.copy(), name="sample")
# do some painting/editing
Get the painted labels as follows:
result = viewer.layers["sample"].data
Our pull request #1094 was successfully merged as a documentation change to napari.
To understand how to visualize with napari, we tried importing a 3-dimensional data-set of a retina.
First, we import napari and io from skimage, and we read the input tiff file for the data-set into a numpy-array using io.imread
. Then we add the image to the viewer as follows:
import napari
from skimage import io
retina = io.imread("path_to_file.tiff")
viewer.add_image(retina, name="retina")
To experiment with the channel layers, we created overlaid layers of the two channels, as suggested by the mentor:
viewer.add_image(retina, channel_axis=0)
Both of us started with understanding the structure of directories and codebase of LatexGo. After having set up the environment in our systems and installing emscripten, we started understanding the issues and working on them.
Our pull request #15 that fixes issue #9 has been merged into the LatexGo codebase. Here, we shifted the firebase config paramaters to a separate config file: js/config.js
and included this file as a script in index.html
for it to be loaded.
Currently we are working on writing a CI file for linux configuration to build texlivejs automatically whenever the Makefile is updated for master
or develop
branches, or a commit message has build-tex
in it.