Show code cell source
from IPython.display import Image
import napari
from napari.utils.notebook_display import nbscreenshot
import warnings
warnings.filterwarnings("ignore")
from napari_roidynamics._widget import RoidynamicsforNapari
viewer=napari.Viewer()
widget = RoidynamicsforNapari(napari_viewer=viewer)
viewer.window.add_dock_widget(widget=widget)
Step-by-step guide#
7 steps are necessary to perform intensity measurements with the napari-roidynamics plugin.Although the steps are self-explanatory, here you can find some important considerations for each step of the analysis.
To start using napari-roidynamics activate the environment containing the napari-roidynamics installation and open a napari GUI by typing napari in the terminal. In the GUI open the Plugins/napari-roidynamics.
In the example below I have called the environment ‘roidynamics-test’
Show code cell source
nbscreenshot(viewer)
Drag-and-drop the images that you wamt to analyze. The image should be a time-lapse. If you have many channels, import the different channels as single time-lapse images.
Warning
The image should not contain ‘mask’ in its name, because this is a filtering criterion to import them in the different drop-down menus. If this is the case, you can rename the images directly in napari for the analysis.
1. Add a point of interest#
To add the point of interest you have two different options:
You can manually add a point of interest using the ‘Add ROI’ button. This will create a point layer in napari called ‘point of interest’. You can now add a point where you want the roidynamics to be generated.
Alternatively, if you have already a label image, you can drag-and-drop it in napari together with the images to analyze.
In this case, roidynamics will calculate a center of mass for your label, and use it as the coordinates to generate the roidynamics geometry.
Warning
Make sure that the label image is imported correctly as label. If this is not the case you can right-click on the image, and select the option “Convert to Labels”
2. Select the point or label layer from which the mask will be generated:#
Even if you have a label, maybe you have decided to add a point of interest manually, so here is the option where you have to decide, which layer will be used to generate the roidynamics. Select from the drop down menu.
3. Generate a sector of the desired geometry using the tabs:#
Depending on what geometry you want to generate, there are different parameters that you have to set. This is why the roidynamics geometries are are displayed on different tabs. You can also decide to generate different geometries. When you hit the generate button napari-roidynamics will produce a label layer with the selected geometry.
Radial sector#
Parameters:
sector width is the radius of each sector
number of sectors defines how many sectors will compose this geometry
After the selection, hit the Generate radial sector! button. When the mask is generated, you can adjust it using the spin buttons.
Warning
If the geometry doesn’t update live make sure that the correct layer is selected in step 2.
Angular sector#
Parameters:
angle width is represented in degrees, and its range is 1-360°
sector radius is the radius of the circle that will be generated
Warning
The last sector will not be generated, unless 360° is a multiple of the angle width you have select.
In the following example an angle of 50° was selected, therefore only 7 complete angular sectors were generated.
Annular sector#
This geometry is very similar to the angular sector but it is annular, so that you will need to setup the thickness of the generated ring.
Parameters:
angle width is represented in degrees, and its range is 1-360°
sector radius is the radius of the circle that will be generated
ring width determines the thickness of the ring
Manual sector#
This option allows you to slightly customize the mask that you want to apply to measure intensities. If none of the three geometries fits your data you can try to adjust this by manually adding a shape.
First add a napari shape layer by pressing “Add manual shape”. This will create a “shapes” layer. You can now select the tool that you would like to use, from the shape layer toolbox. For example you could create a rectangle.
Then select the mask that you would like to cut with the given shape. In the example it was a radial mask with 5 sectors. By pressing the “Generate manual sector!” button, the new mask should be added as a napari label layer.
4. Select the channel to analyze:#
If you have imported different image channels to analyze, here you have to input on which image you want to apply the roidynamics intensity measurements.
5. Select the sector mask to apply:#
In step 3, you might have generated different sectors, therefore here you need to select which mask will be used to calculate the intensities.
Warning
Here is where the ‘mask’ filtering is applied, your mask will be displayed in this drop-down menu, only if it contains the word ‘mask’. Please, even if you decide to rename this layer, keep the word “mask” in the new name.
6. Compute plot#
This function will generate a line plot in a separate window, with the time points on the x-axis and the intensity of the different sectors on the y-axis. The colors of the lines corresponds to the colors of the sectors.
The axes of the plot are calculated automatically to display all data. However, when comparing different conditions it might be useful to input a fixed range for the axes. You can do that by checking the “Set axes range” option. A menu will appear and will allow you to input minimum and maximum values for the x- and y-axis.
If you now press the “Compute plot” button again, the plot will update with the new limits. If you want to go back to the default limits uncheck the checkbox. This same checkbox is used in the save plot data described below.
7. Save plot data#
Use this option to save the generated data, you will be asked to select a folder to export the saved results. The saving automatically includes:
the line plot generated in step 6
the .csv file of the plot data
the mask geometry used for the measurements. This can later be reimported as a label layer in napari
the screenshot of the napari viewer main window, so that you can document the overlap of the mask and the analyzed image.
Be aware that if you have used the option “Set axes range” this will be valid for the exported plot. If you wish to use the default values instead make sure to uncheck the “Set axes range” box.
Save all combinations#
This is an optional step that allows you to measure automatically the intensities in all the images that you have loaded (listed in the dropdown menu in step 4), applying all the geometries that you have generated (listed in step 5). Particularly for this step it could be useful to set limits for the axes in order to be able to easily compare the automatically generated plots. If the checkbox “set axes range” is checked the limits will be applied in this saving process. The output includes:
a .csv file for each possible combination mask-image
the plot of each combination