GithubHelp home page GithubHelp logo

ccampjr / crikit2 Goto Github PK

View Code? Open in Web Editor NEW
17.0 6.0 11.0 20.7 MB

CRIKit2 is a hyperspectral imaging toolkit formerly known as the coherent Raman imaging toolkit.

License: Other

Python 96.99% Jupyter Notebook 3.00% Batchfile 0.01%
python hyperspectral raman visualization scientific nist matplotlib phase-retrieval kramers-kronig svd

crikit2's Introduction

pytest

Codecov

PyPI - Python Version

PyPI Project Page

NIST Public Domain

CRIKit2: Hyperspectral imaging toolkit

CRIkit2 Logo

CRIKit2, formerly the Coherent Raman Imaging toolKit, is a hyperspectral imaging (HSI) platform. It is composed of command line tools, interactive tools, and a user interface.

Github Repository: https://github.com/CCampJr/CRIkit2 Docs Website: Coming Soon...

Note: Help Documentation available via the Help header within the CRIkit2 GUI (only for git installs, not pip)

HSI Processing:

  • Dark subtraction
  • Detrending
  • Denoising via SVD

Coherent Raman-Specific Processing:

  • Kramers-Kronig phase retrieval
  • Phase- and scale-error correction

Coming Soon:

  • SVD automated selection tools
  • Analysis toolkit (separate UI)
  • Interactive Raman database
  • Much more

Notices

Dependencies

Note: These are the developmental system specs. Older versions of certain packages may work.

IMPORTANT: For Python 3.4

You will need to manually install PyQt5 and Qt5 or get it through a distribution:

For Python 3.5, installation through pip available

pip3 install pyqt5

Known Issues

Windows 10 with High-Resolution Monitors

The GUI may appear squashed with small font. There is a work-around described at #79

PyQt 5.7.*

There is a bug in PyQt 5.7.* that will prevent SciPlot's tables from showing the individual plot entries (see https://www.riverbankcomputing.com/pipermail/pyqt/2017-January/038483.html). Apparently, this will be fixed in 5.7.2.

  • As WinPython 3.5.2.3Qt5 and 3.5.2.2Qt5 use PyQt 5.7.*, it is advised to use WinPython 3.5.2.1Qt5 or 3.4.4.5Qt5 until the matter is sorted out.
  • Alternatively, one can uninstall pyqt5.7.* and force an install of <= 5.6.*.

Installation

It is advisable to clone CRIkit2 via git (https://git-scm.com/) and install in a developmental mode via pip or conda as this will enable you to easily (relatively) update your copy of CRIkit2 as new functionality is pushed.

Note If you choose to clone an updatable copy of CRIkit2, do not clone to a directory within your Python installation. Rather, create a new directory elsewhere. That way if you update your Python distribution, you won't lose your copy of CRIkit2.

Option 1: Dynamic, Updatable Clone of CRIkit2

# Note: in Windows, commands will be followed by .exe
# Note: On multi-python systems, you should probably append a 3 to end
# the end of commands, e.g., pip is pip3, python is python3

# Assume the new directory will be CRIkit2 (it can be anything)
# Clone from github
git clone https://github.com/CCampJr/crikit2.git CRIkit2

# Within install directory
pip install -e .

# To update installation, from within the CRIkit2 directory
git pull

# If you receive an error trying to update via git pull
# See https://github.com/CCampJr/CRIkit2/issues/82

Option 2: Static Copy

The static copy will copy the CRIkit2 install into your Python distribution and will not be updatable without re-installing CRIkit2

# Note: in Windows, commands will be followed by .exe
# Note: On multi-python systems, you should probably append a 3 to end
# the end of commands, e.g., pip is pip3, python is python3

# Assume the new directory will be CRIkit2 (it can be anything)
# Clone from github
git clone https://github.com/CCampJr/crikit2.git CRIkit2

# Within install directory
pip install .

# You can now delete the source files you downloaded if so desired

# To update installation, from within the CRIkit2 directory
git pull
pip install .

Option 3: Installation via pip

pip install CRIkit2

(Re-) Building Documentation

A pre-built version of the documentation is included with the installation; thus, this step should not be necessary unless you are making modifications to the software.

The documentation is accessible from within CRIkit2 under the Help header. It is displayed in a web browser.

# From within the CRIkit2 directory (not crikit)
cd docs

# Clean out old docs (optional)
make clean  # On Windows make.bat clean

# Build API w/o pyuic5-generated files
# Windows add .exe
sphinx-apidoc -f -o ./source/ ../ ../crikit/ui/qt_* ../crikit/ui/*_rc* ../crikit/ui/old/** ../setup.py

make html  # On Windows make.bat html

Starting the CRIkit2 UI

python3 -m crikit 

# or

python -m crikit

Known Operational Nuances

  • The SVD visualization tool uses a complex-valued SVD for complex values; thus, there are a few things to avoid
    • If your spectra are PURELY IMAGINARY, convert them to PURELY REAL
    • If your real and imaginary parts of your spectra are IDENTICAL, then consider using just the real or imaginary portion
    • NOTE: this does not affect the accuracy or performance of SVD or the returned results, but you will see unexpected visualizations of the spatial and spectral components.

LICENSE

This software was developed by employees of the National Institute of Standards and Technology (NIST), an agency of the Federal Government. Pursuant to title 17 United States Code Section 105, works of NIST employees are not subject to copyright protection in the United States and are considered to be in the public domain. Permission to freely use, copy, modify, and distribute this software and its documentation without fee is hereby granted, provided that this notice and disclaimer of warranty appears in all copies.

THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NIST BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, CONTRACT, TORT, OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.

CITATION

C H Camp Jr, Y J Lee, and M T Cicerone, "Quantitative, comparable coherent anti-Stokes Raman scattering (CARS) spectroscopy: correcting errors in phase retrieval", Journal of Raman Spectroscopy 47, 408-416 (2016).

Contact

Charles H Camp Jr: [email protected]

Contributors

Charles H. Camp Jr., Xavier Audier

crikit2's People

Contributors

ccampjr avatar xavieraudier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

crikit2's Issues

SVD crash

There is a crash reported on a Mac OS system that gives a message about a possible LAPACK bug

To the effect:
img_nonselect = self.img_all - img_select on line 217 DialogAbstractFactorization
cannot subtract float and None type

line 49 & 54 dialogSVD

line 1708 in CRIkitUI

Reduce Model memory usage

Creating the model clearly doubles or triples the necessary memory needed. Lots of copies going on.

Occassionally, ROI spectrum crashes with x- and y- length error

File "c:\users\chc\documents\python\crikit2\crikit\CRIkitUI.py", line 1240, in
lambda event: self._roiClick(event, self._roiSpectrumPlot))
File "c:\users\chc\documents\python\crikit2\crikit\CRIkitUI.py", line 1410, in _roiClick
pass_fcn((self.x_loc_list, self.y_loc_list))
File "c:\users\chc\documents\python\crikit2\crikit\CRIkitUI.py", line 1339, in _roiSpectrumPlot
self.plotter.plot(self.hsi.f, spectrum, label=label_plot, meta=meta)
File "c:\users\chc\documents\python\sciplot_pyqt5\sciplot\sciplotUI.py", line 535, in _plot
plot_data.mplobj = self.mpl_widget.ax.plot(x, y, label=label, **kwargs)
File "C:\Users\chc\Documents\Python\WinPython-64bit-3.5.2.1Qt5\python-3.5.2.amd64\lib\site-packages\matplotlib_init
.py"
, line 1819, in inner
return func(ax, *args, **kwargs)
File "C:\Users\chc\Documents\Python\WinPython-64bit-3.5.2.1Qt5\python-3.5.2.amd64\lib\site-packages\matplotlib\axes_axes.p
y", line 1382, in plot
for line in self._get_lines(*args, **kwargs):
File "C:\Users\chc\Documents\Python\WinPython-64bit-3.5.2.1Qt5\python-3.5.2.amd64\lib\site-packages\matplotlib\axes_base.p
y", line 381, in _grab_next_args
for seg in self._plot_args(remaining, kwargs):
File "C:\Users\chc\Documents\Python\WinPython-64bit-3.5.2.1Qt5\python-3.5.2.amd64\lib\site-packages\matplotlib\axes_base.p
y", line 359, in _plot_args
x, y = self._xy_from_xy(x, y)
File "C:\Users\chc\Documents\Python\WinPython-64bit-3.5.2.1Qt5\python-3.5.2.amd64\lib\site-packages\matplotlib\axes_base.p
y", line 219, in _xy_from_xy
raise ValueError("x and y must have same first dimension")
ValueError: x and y must have same first dimension

Multiple ROI selection

Is it possible to add a ROI selection function like ROI manager that can let users to add/remove and save/load the multiple ROIs?

SVD not working

Traceback (most recent call last):
File "c:\users\chc\documents\python\crikit2\crikit\CRIkitUI.py", line 1723, in deNoise
mask=self.hsi.mask, parent=self)
TypeError: main() got an unexpected keyword argument 'mask'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.