Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Statistical Region Merging (SRM) is a method for image segmentation. The labeled image is initialized such that each pixel (or voxel) corresponds to one region. A statistical test on neighboring regions determines whether the mean intensities are similar enough to be merged.
This library is an adaptation of the SRM plugin to Fiji/ImageJ and is based on the algorithm proposed in Nock and Nielsen (2004). Our contribution was to translate the original algorithm to C++ and wrap it in Python. We provide this package under the Digital Porous Media (DPM) organization.
dpm_srm is packaged on pypi and can be installed with pip.
pip install dpm-srm
.
If installing from source, this package requires a C++ compiler.
This implementation of SRM expects a 2D or 3D grayscale (single color channel) image of type uint8, uint16, or uint32 and a value for Q, which is used as a merging criterion. Roughly speaking, Q is an estimate of the number of expected regions, though this is not strictly adhered to. The larger the Q value, the more regions are produced. The algorithm will return a labeled image of the same shape and datatype as the input image.
Note that the algorithm performs bucket sorting, where the number of buckets correspond to the maximum allowable value for the particular datatype. Therefore, it's important that intensity values of the input image are scaled over the entire range of the datatype. For example, if the input image is uint8, the image should be scaled such that the minimum intensity value is 0, and the maximum is 255. If the input image is uint16 or uint32, the minimum values should be 0 and the maximum should be 65535 (or 4294967295) respectively.
We wrapped each version (2D vs. 3D, dtype) of the template class into individual class instances. The nomenclature is: SRM[2(or 3)]D_unumber_of_bits (e.g. SRG2D_u8()
, SRG3D_u32()
).
Python Example:
import dpm_srm
import numpy as np
np.random.seed(130621)
image = np.random.randint(0, 256, size=(100, 200, 200), dtype=np.uint8)
srm_obj = dpm_srm.SRM3D_u8(image, Q=5.0)
srm_obj.segment()
segmentation = srm_obj.get_result()
This project includes code adapted from Statistical Region Merging by Johannes Schindelin, which is licensed under the BSD 2-Clause License.
The original code can be found here
FAQs
Statistical Region Merging Segmentation
We found that dpm-srm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.