Package: rank_filter
Rank FilterMotivationThis package is designed to provide an efficient linear rank order
filter written in C++ with Python bindings. It can take single or double
precision floats as input. It was needed as the equivalent percentile
filter in SciPy was found to be too slow and unnecessarily general.
There was no equivalent in VIGRA.RequirementsIn order to build this package, the following requirements are needed.Python (2.7.x or 3.5.x)Boost (1.56.0 or later)NumPy (1.7.0 or later)Cython (0.23.0 or later)Setuptools (18.0 or later)InstallationThe easiest way to install is to install ourcondapackage.
Alternatively, one can install frompip, but this will require a
C++ compiler and a recent version ofsetuptools.BuildingThere are several ways to build the package.Standard Python build and install.Conda recipe build and install.CMake build and install.The vanilla install in any of these forms should be basically equivalent.Getting StartedTo start simply clone the repo and change directory to the repo.git clone https://github.com/nanshe-org/rank_filter
cd rank_filterUsing PythonTo build/install with Python directly, simply run the following command.python setup.py installUsing CondaTo build/install with Conda, simply run the following command.conda build rank_filter.recipe
conda install --use-local rank_filter.Using CMakeIn order to find Boost includes and libraries, the directory Boost was installed
to must be set asBOOST_ROOT.cmake -DBOOST_ROOT=<path-to-Boost-root> .Also the CMake installer will also pick these variables up if they are set in
the environment and not provided.export BOOST_ROOT=<path-to-Boost-root>
cmake .Additionally, the preferred python interpreter can be set by using thePYTHON_EXECUTABLEvariable.CheckingBefore building the Python bindings it is worth checking if the C++ code
passes its own test suite. This can be done usingmakewith the
command below. It is not required to run this stage, but it will be run
every time when building. These test are no guarantee that the Python
module will work. All they verify is that the C++ code works.make checkBuildingBuilding is done easily usingmake. This will create a shared object
in the slib directory, which can be imported by Python as a module. As
mentioned in the Checking section, the C++ tests will be run first. If
they fail, the Python module will not be built. They do not guarantee
that the Python module will work. Instead the testing stage can be used
to validate the module.makeTestingOnce the Python module is built, it is worth testing whether it works.
This can be done withmakeusing the command below. Unlike the C++
tests, these are Python tests that use nose to run the tests. The tests
are the Python analogues of the ones used in C++ tests. They not only
verify that basic command run, but that they pass with correct results
only.make testInstallingAfter building and testing, it is time to install. Usingmake, the
command below will install the module in the identified Python’s
site-package folder allowing for importing this module using that
Python.make installCleaningThere are a few additional options regarding cleaning. It is possible to
clean all build intermediates (including CMake generated files) leaving
only the final build products. This is done by calling as below.make distcleanIf it is desirable to eliminate the build products as well as all
intermediates, then the call below can be used.make reset