Releases: jewettaij/visfd
added morphological filters (dilate, erode, open, close)
Finally, simple morphological filters have been added to VISFD. You can access them from within the filter_mrc program by using the -dilation, -erosion, -opening, and -closing arguments
From wikipedia:
"Together with closing, the opening serves in computer vision and image processing as a basic workhorse of morphological noise removal. Opening removes small objects from the foreground (usually taken as the bright pixels) of an image, placing them in the background, while closing removes small holes in the foreground, changing small islands of background into foreground. These techniques can also be used to find specific shapes in an image. Opening can be used to find things into which a specific structuring element can fit (edges, corners, ...)."
Binary morphological filters have not been implemented yet.
As mentioned before, these are grayscale filters, which are quite slow. Binary versions of these filters would be a lot faster, however I have not implemented them yet. In the meantime, the -dilation-gauss and -erosion-gauss filters are very fast and available (although they have artifacts near sharply curved surfaces at length-scales near the thickness parameter).
now using discrete gaussian kernels
This is an important and subtle change which will effect nearly all of the detectors, especially when attempting to detect objects which are thin or small (only 1-6 voxels wide). Hopefully this is an improvement.
Unfortunately the new code now requires a c++17 compatible C++ compiler, such as gcc7 or clang5 or later.
(This is because I use some functions that were recently added to <cmath>. If this is a problem, let me know, because there are workarounds for older compilers, such as using the "boost" library.)
Unfortunately, this also means that if you used an earlier version of this program, you may have to adjust your thresholds to obtain the same results you had earlier (especially if you were detecting small or thin objects).
There were several other significant changes which are invisible to the user:
- I cleaned up the VISFD library C++ code (simplifying the API somewhat)
- I added move constructors for C++11 compatibility
updates and reorganization to make membrane detection work better near mask boundaries
- reduced the influence of noise near mask boundaries
- cleaned up and reorganized some code in the "lib/visfd" directory (cruft removal)
- fixed a few small bugs, and
- updated the documentation
Unfortunately the noise problem near mask boundaries is still serious. So I updated the documentation to explain several strategies to get around this problem.
changed "-blur-expand" and "-blur-contract" to "-dilate-gauss" and "-erode-gauss"
After reading some articles on wikipedia, and discovering the relevant scikit-image documentation, I realized the correct terms are "dilate" and "erode" (instead of "expand" and "contract").
added many small features to filter_mrc
added the "-blur-expand", "-blur-contract", "-mask-rect", "-mask-rect-subtract", "-mask-sphere", "-mask-sphere-subtract, and "-fill" arguments to the "filter_mrc" program. They have been debugged and documented.
I also fixed a bug in the "-image-size" argument, as well as a bug in the underlying MrcSimple class library (in the "lib/mrc_header.cpp" file). (There may be bugs in the way the "origin" attributes from the MRC header are read and stored. I currently ignore these "origin" numbers and set them to 0,0,0. But we may have to worry about them one day. Until then, ignorance is bliss.)
fixed a bug preventing "-save-progress" from working when also used with "-mask"
v0.26.2 fixed a bug preventing "-save-progress" from working when used with "…
new features to improve calculation speed: "-save-progress" and "-bin"
The "-bin" and "-save-progress" arguments (features) have been added and documented. They are tested and are working. Both of these features should dramatically speed up the process of tensor voting.
This is a big update. These two features should go a long way toward finally making membrane detection (tensor-voting) fast enough to be feasible for moderately large, high-resolution images.
I finally no longer completely hate this software every time I have to use it. (That said, using this software remains very slow tedious and painful, and usually just as much work as manual segmentation. I still have not yet implemented fast, steerable filters.)
Code for several new filters (for detecting curves and edges) has also been added (and documented with warning caveats). But those new features have not been tested and probably do not work.
small bug fixes and new features (for "-mask-out", "-draw-spheres" and "DrawSpheres()")
Fixed several bugs in the "-mask-out", "-draw-spheres", "-draw-hollow-spheres" arguments for "filter_mrc". (I also probably fixed another bug that occurs when using "-mask" with tensor-voting, "-surface-tv".)
The capabilities of the "-draw-spheres" and "-draw-hollow-spheres" arguments, as well as the the "DrawSpheres()" function (in "draw.hpp") have been significantly augmented. (In addition to new features, the default behavior of these arguments and functions should be much more sensible now. Unfortunately, these changes break background compatibility.)
tensor voting now works with masked images
Tensor voting (to detect thin surfaces, like membranes) now works when the -mask argument is used. (This feature was supposed to work, but I had never tested it until today.) The -mask argument us used to limit the detection of objects to certain volumes within the image.
In practice, those volumes are often chosen to be membrane-bound compartments which were detected by previous iterations of running filter_mrc (and voxelize_mesh.py). Consequently this feature makes it much easier to segment images containing multiple concentric objects inside each other. One can now use these tools to segment Russian-doll-like membrane bound compartments inside of cells or other organelles.
(I'm currently working on a short tutorial to demonstrate these features on a small tomogram. If I get that ready, I will post it elsewhere. Probably it will be a separate github project.)
basic voxelization (segmentation) tool added
A python script (voxelize_mesh.py) has been added and documented which should finally make segmentation of membrane-bound compartments possible (if not easy). This tool generates an image which indicates which voxels lie within a closed surface mesh. Meshes corresponding to surfaces (eg. boundaries of cells or organelles) can be generated using a combination of "filter_mrc" with tensor-voting, together with PoissonRecon, and meshlab to close, smooth, and cleanup the resulting meshes. Although this tool only segments a single closed surface in the the image, multiple different segmentations can be combined into the same image (using the combine_mrc program) to create a true segmentation containing multiple different labelled objects.
(The resulting segmented images can be used as masks to help other feature detection programs, such as filter_mrc, restrict the search for features to relevant places. For example, a mask might help search for ribosomes inside a bacterial cell, not outside the cell.)
WARNING: voxelize_mesh.py is extremely inefficient
The voxelize_mesh.py script is very slow and it consumes an extremely large amount of memory due to the fact that it relies on 3rd-party code. (It is so inefficient that it is barely functional. But for now it is good enough for my own needs.) Please read the documentation for that program if you decide to attempt using it.