Package: bifs
BIFSBayesian Image Analysis in Fourier SpaceBIFS is a framework and set of computational tools for implementation of Bayesian Image analysis in Fourier Space. The BIFS approach enables enhanced feature contrast and noise reduction, analogous to, but much more efficiently than Bayesian methods applied directly in image space, such as Markov Chain Monte Carlo methods. This efficiency is provided by the fact that for a large class of images the Fourier modes can reasonably be approximated as being independent, thus reducing the optimization problem from one involving a large number of coupled variables to one involving a product of independent one dimensional optimizations. BIFS is useful for a large class of images and in particular for medical imaging problems, including clinical imaging studies, screening, diagnosis, and treatment evaluation.InstallationPrerequisites:Python3 installed on your computer.For the impatient, here are steps which should install the package and
launch the GUI:#python may work instead of python3, depending on your environment#py -3 should work on MS-Windowspython3-mpipinstall--upgradepipsetuptoolswheel
python3-mpipinstallbifs
bifs_guibifs requires a number of other substantial software packages, including SciPy and PyQt5,
which the installation should take care of if they are not already present.Virtual EnvironmentsSeethis guidefor much more
information about how to install python packages.  In particular, we endorse their
strong recommendation touse virtual environments, which are omitted from the steps above.On Windows inside a virtual environment we have foundpythonrather thanpython3is necessary.We recommend against using the Windows-specificpycommand since it only respects the venvsometimes, for examplepy -3will ignore it,under Python 3.9, and may have been even less reliable with earlier versions.Qt Compatibility ProblemsThe graphical programbifs_guidepends on theQtgraphic framework.  This will be installed automatically if it is not present,
but if it is already present the packages thatpipinstalls may not be compatible with it.  We found this to be the case on Debian GNU/Linux 10 (buster).  If you get such a problem, you can fix it by specifying an explicit version for PyQt5 with==:(testEnv)ross@barley:~/UCSF/Kornak$python-mpipinstallPyQt5==5.11.2
CollectingPyQt5==5.11.2DownloadingPyQt5-5.11.2-5.11.1-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl(117.9MB)|â–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆ|117.9MB84kB/sCollectingPyQt5_sip<4.20,>=4.19.11DownloadingPyQt5_sip-4.19.19-cp37-cp37m-manylinux1_x86_64.whl(67kB)|â–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆâ–ˆ|67kB997kB/sInstallingcollectedpackages:PyQt5-sip,PyQt5Attemptinguninstall:PyQt5-sipFoundexistinginstallation:PyQt5-sip12.9.0UninstallingPyQt5-sip-12.9.0:SuccessfullyuninstalledPyQt5-sip-12.9.0Attemptinguninstall:PyQt5Foundexistinginstallation:PyQt55.15.4UninstallingPyQt5-5.15.4:SuccessfullyuninstalledPyQt5-5.15.4
SuccessfullyinstalledPyQt5-5.11.2PyQt5-sip-4.19.195.11.2 is the version ofQtthat was already on the system, while 5.15.4 is the version thatpipinstalled.The current stable release of Debian is 11 (bullseye) and usesQt5.15.2, probably close enough to work with the default installation ofPyQt5.Seehttps://github.com/ucsf-deb/bifs/issues/25for more.An alternative would be to manually install the required packages (see therequirements.txtorsetup.pyfiles) using your OS's package manager instead ofpip, and then installbifswithoutusing a  virtual environment.Fallback Installation of DependenciesWe are still working on the packaging, as well as the instructions, and it is possible
you will encounter difficulties.  If the necessary dependencies are not installed automatically,
try changing to the top level of the repository and executingpython3-mpipinstall-rrequirements.txtIf even that doesn't work, you can manually tell it to install the packages listed in therequirements file, e.g.,python3-mpipinstallnumpyFallback Package SetupIf the regular setup fails it means thatimport bifswill not be able to find the package.
Since the bifs code itself does such imports, it won't run without it.A workaround is to manually add an entry to thePYTHONPATHenvironment variable for the
root directory of the repository you cloned from GitHub.If you clone the project following the instructions above and you are in/tmp, it will create a directory/tmp/bifs.  It is this
directory, not/tmp/bifs/bifsthat you will find under it, that should go inPYTHONPATH.
See how to do it graphically or from the command line onMS-Windowsor forMac or Linux.  One can also manipulatesys.pathinside a Python
program.Known Compatible Software VersionsBIFS is known to work with the following versions but will typically work with many earlier
versions as well:Python 3numpy 1.17 (no earlier)scipy 1.2.1-1matplotlib 2.2.4-2imageio 2.4.1jsonpickle 1.2pyqt5 5.7.1-1 (note: some version of PyQT 5 is required, i.e.
the package will not work with PyQT 4)nibabel is listed in the requirements file, but the software will
run without it.  It is only needed if you load an image type for which
it is required, e.g., a .nii file.Using BIFSSee the moredetailed guideand the extensive comments in the code for how to use the package.Exploring the codehttps://github.com/ucsf-deb/bifs