[NEUBIAS Academy@Home] Webinar "Advanced Image Processing with MorphoLibJ" Questions a Answers

Dear all,

This thread is to collect the questions answers that were asked during the NEUBIAS Academy webinar “Advanced Image Processing with MorphoLibJ”, given on April 30th.

The webinar was recorded and the video is available on the Youtube channel of NEUBIAS.
The slides as well as some demonstration material (sample images and additional plugins) can be found on GitHub. Note also that MorphoLibJ is provided with a 80-pages user-manual.

A huuuuge thanks to the moderating team, who catched and live-answered most of the questions hereafter: Ignacio Arganda-Carreras (@iarganda), Elnaz Fazeli, Christian Tischer (@Christian_Tischer) and Julien Colombelli (@Julien_Colombelli).

To simplify browsing, questions have been grouped thematically and the answers slightly edited or completed. Do not hesitate to post comments, or correct any error!

Table of contents:

MorphoLibJ and material

Q1: What is “MorphoLibJ Plus”?

“MorphoLibJ Plus” is a set of plugins based on MorphoLibJ whose aim is to demonstrate the concepts during the webinar. The plugins can be found on the GitHub page of the webinar.

Q2: How to install MorphoLibJ Plus in my plugins?

You have to install the plugins “manuallay”.

  1. First you need to download the plugins from the GitHub page of the webinar.
  2. Then you copy the files in the “plugins” directory of your ImageJ/Fiji installation.
  3. Finally it is necessary to either restart ImageJ, or to use the “refresh menus” options. Then a new “MorphoLibJ Plus” entry will appear in the “Plugins” menu.

Q3: Thanks for sharing your slides on github! Under which license are they published? Is it ok to reuse it our training material and to republish it?

Yes, it can be re-used, just do not forget to cite the sources!
The images used during the presentation are available on GitHub as well. Some of them were used in published projects, citations are welcome.

Directional filtering

Q4: What would the structural element looks like in horizontal vs vertical filtering?

The SE are horizontal and vertical lines, respectively. Typically one pixel wide, the length can be chosen.

Q5: What are the line length and line thickness parameters?

The line length and the thickness correspond to the size of the structuring element. The number of pixels in the main direction is computed from the length and the orientation. An additional dilation by a square structuring element is added to increase the thickness of the line.

Q6: The direction number for the directional filters correspond to the number of orientations in degrees?

Exactly. Orientations are considered in the range [0-180] degrees (0 degrees = 180 degrees = horizontal). Orientations are chosen by dividing 180 by N equidisant orientations. 2 orientations -> 0 and 90 degrees. 4 orientations -> 0, 45, 90 and 135 degrees.

Q7: About morphological filters, specially directional filters: Does they run in 3D images?

Most ‘classical’ morphological filters work for 2D or 3D images. In MorphoLibJ, different plugins are proposed for 2D or 3D to provide a preview for 2D filters (this is not possible for 3D filters).

Directional filters can be defined for 3D images as well, but this is currently not implemented in MorphoLibJ. One difficulty is that it is not as straightforward to discretize the space of directions in 3D as it is in 2D.

Q8: Can we build these directional filters as convolutional kernels?

Typically not. The math for morphological filters is more based on min and max value determination, which you cannot represent as a convolution.

Q9: Is it possible to determine the spatial coordinate of the surfaces that are created with directional filtering/3D visualization and list them in a result table next to other measurements, like length and integrated density?"

There is no such feature at the moment, but this should be possible to obtain the result by writing a macro.

Q10: Would the directional filter work on images with a dense filled of thin structures?

Probably not so well, because then locally it is not so easy to find the orientations. But this would worth a try.

Q11: If there is a binary boundary that meets all the way around a cell, but there is a small gap, do you think is it possible to use directional filtering to fill gaps in presumptive membrane that we, as humans, “fill in” with our eyes?"

Exactly! That’s what directional filtering is really helpful for.

Q12: Is there a maximum number of intersected lines that it can separate?,

This depends on the particular shape of the lines. In particular, it may be difficult to separate lines that cross at very similar angle.

Morphological Reconstruction

Q13: For morphological reconstruction do we always need a mask image? how do we generate it?

Yes, both a marker image and a mask image are required. Marker image can be generated by painting on a black image, or by using minima/maxim detection.

Q14: What are some biological image examples where you would use morphological reconstruction?

They are really useful all the time! For example to separate small blobs from large blobs, or blobs from lines, really anything :slight_smile:

Q15: Are you using a kind of “surface tension” while growing from the seed points?

It grows from the seed points (markers) using another image as mask to limit the growing. The “growth” consists in dilating the marker image, and combining with the mask image via a “min” (or a “max”) operation.

Q16: In the morphological reconstruction of the selected rice grains, where does the background come from? I mean that the other rice grains are also slightly visible."

In a grayscale image, the objects with a marker get “enhanced” compared to the rest of the image, but the others do not disappear like in binary images.

Q17: Does Morphological Reconstruction work on 3D objects?

Yes, there are two morphological reconstruction plugins one for 2D and one for 3D: “Morphological Reconstruction” and “Morphological Reconstruction 3D”.

Q18: Is it efficient to combine “find maxima” with morphological reconstruction to make a good binary?

Yes, the “find maxima” can be used as marker for a morphological reconstruction.

Segmentation

Q19: How does the watershed perform on real-experimental images, e.g. If of cells in tissue?

The results will be as good as your markers and the contrast between the cells and the background or its membranes. You should give a try to the Morphological Sementation plugin.

Q20: Can I use it on a time series or is it the same principle?

The time series are not related to each other as stacks are so yes you can use time series and treat each timepoint independantly.

Q21: Is this the one used in 3D within CellProfiler (watershed with markers)?

The principle is probably the same. Marker-controlled watershed is a well-known algorithm. That being said, the implementation details could be slightly different, of course.

Q22: Is it possible to count the segmented outcomes?

Yes, MorpholibJ has a connected components analysis. Then, to count the number of regions, you can either use one of the “Analyze regions” plugins, or compute the histogram of the resulting label map: if no label was removed, the maximum value corresponds to the number of labels.

Q23: In Marker-based watershed: what is actually used of the pixels corresponding to the markers? intensity values to look for similar values/pattern or

simply the area is used as geometric seed for growing?
It follows the same strategy explained in the classic watershed method, but the “water sources” are defined by those marker positions. So the water level goes up from those points, integrating progressively into the same regions pixels of increasing intensity until the region touches another region.

Q24: Is Morphological segmentation able to segment overlapped object with a defined shape (e.g. rod-shaped cells one on top of another)?

Very interesting topic! This seems complicated to obtain with watershed, as the algorithm will get the contours only on contrasted parts of the image. Approaches relying on shape-fitting could be more appropriate in that case.

Q25: Is there any sort of slicer to go through the 3D volume reconstructed rather than applying spaces between the watershed segments?

The watershed plugin in MorphoLibJ allows you to not have that 1-pixel border between segments (watershed dams).

Q26: if the membrane is not closed or blurred(lot od tissue diffusion ), it is possible to manually close it?

Not manually, but it is possible to apply image filters to enhance the response on the boundaries. Typical filters inclue Hessian filters (introduced by Franji for image filtering), or more simple filters such as dilation or gaussian.

Q27: Is there a way to automate the finding of the relevant markers to be used with the morphological reconstruction or does the selection of the markers always have to be done manually?

Yes, that could be automated, for example the Regional Min and Max. You could even use some machine learning (Trainable WekaSegmentation) to find the markers automatically.

Q28: Is it possible in morphological segmentation to overlay segmentation with original and reduce opacity? (in 3d)?

Probably, with the 3D Viewer this should be possible. There is no option to set it up graphically, so we can plan add one in the future.

Q29: What is the good selection of parameters like Dynamic for Distance transform watershed 3D?

It really depends on the shape of your objects. You can think on the Dynamic as the tolerance by which nearby local minima will be considered the same minimum. Larger dynamic involves less (and larger segments) than a smaller one.

Q30: The Morphological Segmentation Plugin looks useful, but can you use it within a script?

Yes! MorphoLibJ is recordable and then you can edit the macro.

Label Images / Label Maps

Q31: How labeled imaged are created? Is made of a kind of ROI differently colored or is a different way?

The technical term is “Label Map”, or “Label Image”. All pixels of object 1 have a value of 1, all pixels of object 2 have a value of 2, and so on. The Background correspond to pixels with value 0.

Q32: Can you remove labels touching the last z for instance (ie treat the z dimension as a border)?

Yes, that’s what Plugins > MorphoLibj > Label Images > Remove Border Labels does. You can select which one(s) of the borders you want to remove.

Q33: Ca you export the segmentation as ROIs?

Not explicitly with a MorphoLibJ plugin. We plan to do a script or plugin for that soon. In the meantime, you can use all the analysis plugins under “MorphoLibJ > Analyze”, some of them provide results as overlay.

Q34: Is label edition possible based on measurement of labels, link keep label only bigger than X?

At the moment this is possible only based on the “size” of the regions, see the “Label Images -> Label Size Filtering”. Other features can be used, but would require writing macros.

Q35: Can you transfer the labels to a new image for analysis of the regions in a different channel?

Absolutely! Once you have the label image created, you can use it to analyze any ofther image of the same size. Have a look for instance at the “MorphoLibJ > Analyze > Intensity Measurements 2D/3D plugin.”

Q36: Can I track a growing ROI over time? providing them the same ID?

Yes, in principle, but the tracking is not part of MorpholibJ. You would have to write an ImageJ macro.

Image Analysis

Q37: Is it better to use ellipse or feret to determine aspect ratio?

There is no better one, they simply give you different information. Have a look at this interesting discussion in the forum: Difference between Major-/Minor-Axis and Ferets Diameter

Q38: Is it possible to compute average thickness in 3D?

It is possible to do it “manually” or via a macro by computing the 3D skeleton, computing the 3D distance map, and then combining the results. We will consider adding it in a future version of MorphoLibJ.

Q39: General question: when working on 3D images, how do you handle the disparity of dimensions in XY vs Z? How do you adapt the structuring element?

In the current implementation, morphological filters assume voxel size is homogeneous. Therefore, you have to resample the 3D image to obtain the expected result. Image analysis plugins, in general, take the spatial calibration into account, and return the results in user unit.

Q40: What is the spatial calibration? Is it something like a scale bar?

The spatial calibration if the pixel/voxel size in real units. It comes from the deviced used to take the image. You can see that in ImageJ/Fiji if you click on “Image > Properties…” with your image selected.

Q41: Will that mean that the plugin takes the metadata of the images and then uses it to make measurements?

Yes absolutely. The values for spatial calibrationh can be found in “Image > Properties”

Q42: In MorphoLibJ analysis of region interconnectivity is possible. Is there any tool to show interconnectivity graphically from the result table?

The Region Adjacency Graph plugin :wink: Note that the graphical display is currently implemented only for 2D images.

Q43: In measuring object sphericity how can evaluate whether they are oblate or prolate?

You can use the “MorphoLibJ > Analyze > Equivalent Ellipsoid plugin”. The values of the ellipsoid radius can be used to determine the type of the ellipsoid.

Q44: Where can we find the Connected component analysis option on MorpholibJ?

It can be found under “MorphoLibJ > binary”

Q45: Is there a .jar file for Region Adjacency Graph plugin?

It is part of the MorphoLibj main jar file. It can be found under “MorphoLibJ > Analyze > Region Adjacency Graph”.

Q46: Can mathematical morphology: granulometric curves be calculated for 3D images?

Yes it can! Actually, contrary to what I said during the webinar, the last version (1.2.0) of the plugin allows to compute granulometry curves for 3D images! You may need to be patient for large images… Hint: using cubic structuring element is often faster than using a ball.

Q47: Where exactly is the .jar file for the ijGranulometry plugin?

You can find it on the GitHub page associated to the webinar, or directly on the GitHub page of the project.

Other Software

Q48: What is the pro and cons of MorphoLibJ compared to the plugins of G. Landini ?

They do not implement exactly the same features. Depending on what you need, one or the other library may be better, or the algorithms implemented in a different way. Note that the plugin of G. Landini are not limited to mathematical morphology. For 3D image processing, the 3D Image Suite by Thomas Boudier also implements a large collection of features.

2 Likes