crikit package — CRIKit2 0.4.3 documentation

# crikit package

## Subpackages

- crikit.cri package
  - Subpackages
    - crikit.cri.algorithms package
      - Submodules
      - crikit.cri.algorithms.kk module
      - Module contents
    - crikit.cri.tests package
      - Submodules
      - crikit.cri.tests.test_hilbert module
      - crikit.cri.tests.test_kk module
      - crikit.cri.tests.test_kk_alg module
      - crikit.cri.tests.test_merge_nrbs module
      - crikit.cri.tests.test_pec module
      - crikit.cri.tests.test_sec module
      - Module contents
  - Submodules
  - crikit.cri.error_correction module
  - crikit.cri.kk module
  - crikit.cri.merge_nrbs module
  - Module contents
- crikit.data package
  - Subpackages
    - crikit.data.tests package
      - Submodules
      - crikit.data.tests.test_hsi module
      - crikit.data.tests.test_mosaic module
      - crikit.data.tests.test_mosaic_hdf module
      - crikit.data.tests.test_spectra module
      - crikit.data.tests.test_spectrum module
      - crikit.data.tests.~test_data_indexing module
      - Module contents
  - Submodules
  - crikit.data.factorized module
  - crikit.data.frequency module
  - crikit.data.mosaic module
  - crikit.data.replicate module
  - crikit.data.spectra module
  - Module contents
- crikit.datasets package
  - Submodules
  - crikit.datasets.model module
  - Module contents
- crikit.io package
  - Subpackages
    - crikit.io.lazy5 package
      - Subpackages
      - Submodules
      - crikit.io.lazy5.alter module
      - crikit.io.lazy5.config module
      - crikit.io.lazy5.create module
      - crikit.io.lazy5.inspect module
      - crikit.io.lazy5.nonh5utils module
      - crikit.io.lazy5.utils module
      - Module contents
    - crikit.io.tests package
      - Submodules
      - crikit.io.tests.test_hdf5 module
      - Module contents
  - Submodules
  - crikit.io.csv_nist module
  - crikit.io.hdf5 module
  - crikit.io.macros module
  - crikit.io.meta_configs module
  - crikit.io.meta_process module
  - Module contents
- crikit.measurement package
  - Subpackages
    - crikit.measurement.tests package
      - Submodules
      - crikit.measurement.tests.test_measurement module
      - crikit.measurement.tests.test_measurements_complex module
      - crikit.measurement.tests.test_peakfind module
      - Module contents
  - Submodules
  - crikit.measurement.fftspatialnoise module
  - crikit.measurement.peakamps module
  - crikit.measurement.peakfind module
  - Module contents
- crikit.preprocess package
  - Subpackages
    - crikit.preprocess.algorithms package
      - Submodules
      - crikit.preprocess.algorithms.abstract_als module
      - crikit.preprocess.algorithms.als module
      - crikit.preprocess.algorithms.anscombe module
      - crikit.preprocess.algorithms.arpls module
      - Module contents
    - crikit.preprocess.tests package
      - Submodules
      - crikit.preprocess.tests.test_als module
      - crikit.preprocess.tests.test_anscombe module
      - crikit.preprocess.tests.test_baseline_sub module
      - crikit.preprocess.tests.test_crop module
      - crikit.preprocess.tests.test_subtract_dark module
      - Module contents
  - Submodules
  - crikit.preprocess.crop module
  - crikit.preprocess.denoise module
  - crikit.preprocess.standardize module
  - crikit.preprocess.subtract_baseline module
  - crikit.preprocess.subtract_dark module
  - crikit.preprocess.subtract_mean module
  - Module contents
- crikit.transform package
  - Module contents
- crikit.ui package
  - Subpackages
    - crikit.ui.utils package
      - Submodules
      - crikit.ui.utils.check_requirements module
      - crikit.ui.utils.roi module
      - Module contents
  - Submodules
  - crikit.ui.classes_ui module
    - User Interface and Visualization Classes (crikit.ui.classes_ui)
  - crikit.ui.dialog_AbstractFactorization module
  - crikit.ui.dialog_AbstractPlotEffect module
  - crikit.ui.dialog_AnscombeParams module
  - crikit.ui.dialog_SVD module
  - crikit.ui.dialog_kkOptions module
  - crikit.ui.dialog_model module
  - crikit.ui.dialog_ploteffect module
  - crikit.ui.dialog_save module
    - CRIkit Save Dialog (crikit.ui.dialog_save)
  - crikit.ui.dialog_subResidualOptions module
  - crikit.ui.dialog_varstabAnscombeOptions module
  - crikit.ui.helper_plotOptions module
  - crikit.ui.helper_roiselect module
  - crikit.ui.main_Mosaic module
  - crikit.ui.widget_ALS module
  - crikit.ui.widget_ArPLS module
  - crikit.ui.widget_Calibrate module
  - crikit.ui.widget_Cut_every_n_spectra module
  - crikit.ui.widget_DeTrending module
  - crikit.ui.widget_Jupyter module
  - crikit.ui.widget_KK module
  - crikit.ui.widget_SG module
  - crikit.ui.widget_images module
    - Visualization Widgets (crikit.ui.widget_images)
  - crikit.ui.widget_mergeNRBs module
  - crikit.ui.widget_scientificspin module
  - Module contents
- crikit.utils package
  - Subpackages
    - crikit.utils.tests package
      - Submodules
      - crikit.utils.tests.test_breadcrumb module
      - crikit.utils.tests.test_general module
      - crikit.utils.tests.test_pad_edge_mean module
      - Module contents
  - Submodules
  - crikit.utils.breadcrumb module
    - Breadcrumb Module
      - Class Methods
  - crikit.utils.datacheck module
  - crikit.utils.general module
  - crikit.utils.roi module
  - Module contents

## Submodules

## crikit.CRIkitUI module

### CRIKit2: Hyperspectral imaging toolkit

CRIKit2, formerly the Coherent Raman Imaging toolKit, is a hyperspectral imaging (HSI) platform (user interface, UI).

HSI Processing:

  - Dark subtraction

  - Detrending

  - Denoising

Coherent Raman-Specific Processing:

  - Kramers-Kronig phase retrieval

  - Phase- and scale-error correction

Analysis:

  - Coming soon

#### Usage

From ./crikit2 directory python3 main.py

#### Authors

- Charles H. Camp Jr. <charles.camp@nist.gov>

class crikit.CRIkitUI.CRIkitUI_process(**kwargs)

  Bases: `PyQt5.QtWidgets.QMainWindow`

  CRIkitUI_process : CRIkitUI for image (pre-)processing

  References

  [1] 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 (2016). arXiv:1507.06543.

  NUMCOLORS = 4
  anscombe()

    Performance Anscombe transformation

  calcAnscombeParams()

    Calculate Anscombe Parameters

  calibrate()

    Calibrate spectra

  calibrationReset()

    Set self.hsi.freqcalib back to self.hsi.freqcaliborig

  changeSlider()

    Respond to change in frequency slider

  checkCompositeUpdate(num)

    Update color composite only if appropriate tab is selected.

  checkShowOverlays()
  closeEvent(self, QCloseEvent)
  condInEqualityChange()

    Conditional inequality changed.

  condOpChange()

    Conditional math operation performed on single-color images changed.

  createImgBW(img)

    Generate the single-frequency grayscale image

  cutEveryNSpectra()

    Cut m spectra every n spectra

  deNoise()

    SVD

  deNoiseDark()

    Denoise Dark with Savitky-Golay

  deNoiseNRB()

    Denoise NRB with Savitky-Golay

  deleteOverlays()
  delete_preview_rois()
  doComposite()

    Update color composite image.

  doKK()

    Pop-up Kramers-Kronig parameter entry dialog and perform the Kramers-Kronig phase retrieval algorithm.

  doMath()

    Perform selected math operation on single-color imagery.

  doUndo()

    Undo last operation back to last backup point

  errorCorrectAmp()

    Error Correction: Amp aka Baseline Detrending

    Notes

    If data is complex, amplitude detrending occurs on and only on the imaginary portion

  errorCorrectPhase()

    Error Correction: Phase

  errorCorrectScale()

    Error Correction: Scale

  fileOpenDLMNIST()

    Open and load DLM File

  fileOpenHDFMacroRasterNIST(*args, dialog=True)

    Open and load multiple datasets from HDF file that describe a single image. Used for a macrostage rastering mode at NIST.

    dialogbool

      Present a gui for file and dataset selection

  fileOpenHDFNIST(*args, dialog=True)

    Open and load HDF5 File

    dialogbool

      Present a gui for file and dataset selection

  fileOpenHDFNISTOOC(*args)

    Open and load HDF5 File OUT-OF-CORE

    dialogbool

      Present a gui for file and dataset selection

  fileOpenSuccess(success)

    Executed after a file is loaded. Checks success and appropriately activates or deactivates action (buttons)

  freqWindow()

    Limit the frequency window displayed and analyzed

  get_preview_spectra(full=False)

    If self.preview_rois is set, output the mean spectra from thos regions

  inverseAnscombe()

    Performance an Inverse Anscombe transformation

  lineEditFreqChanged()

    Frequency manually entered in frequency-slider-display

  lineEditPixChanged()

    Frequency in pixel units manually entered in frequency-slider-display

  loadDark()

    Open HDF file and load dark spectrum(a)

  loadDarkDLM()

    Open DLM file and load dark spectrum(a)

  loadNRB()

    Open HDF file and load NRB spectrum(a)

  loadNRBDLM()

    Open DLM file and load NRB spectrum(a)

  makeBCARSPhantom()

    Generate a numerical phantom for BCARS

  makeRamanPhantom()

    Generate a numerical phantom for Raman

  mergeNRBs()

    Interactive merge of the left- and right-side NRB

  mosaicTool()
  nrbFromROI()

    Acquire an average spectrum from a user-selected ROI and apply to the NRB– either as the new NRB or averaged with the existing (sender- dependent)

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

  opChange()

    Math operation performed on single-color images changed.

  plotDarkSpectrum()

    Plot dark spectrum

  plotLeftNRBSpectrum()

    Plot Left-Side NRB spectrum

  plotNRBSpectrum()

    Plot NRB spectrum

  plotRightNRBSpectrum()

    Plot NRB spectrum

  plotter_show()
  pointSpectrum()

    Get spectrum of selected point.

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

    Action:

      Left mouse-click : Select vertex point

  roiSpectrum()

    Plot spectrum over selected region-of-interest (ROI).

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

    Action:

      Left mouse-click : Select vertex point Right mouse-click : Close polygon

  save()
  setCondFreq1()

    Set color math conditional frequency #1

  setCondFreq2()

    Set color math conditional frequency #2

  setCondFreq3()

    Set color math conditional frequency #1

  setOpFreq1()

    Set color math frequency #1 (the primary frequency)

  setOpFreq2()

    Set color math frequency #2 (e.g., freq #1 + freq #2)

  setOpFreq3()

    Set color math frequency #3 (e.g., Amplitude at freq #1 - interpolation [freq #2, freq #3])

  set_preview_rois()

    Set the preview ROIs. NOTE: this function just sets the signal for the MPL window

  settings()

    Go to settings tab

  showPreviewRois()
  sliderPressed()

    Respond to press of frequency slider (set tracking of location)

  sliderReleased()

    Respond to release of frequency slider (end tracking of location)

  specialDemosaicRGB()
  specialEstCalibration1()

    For NIST BCARS 2, maximum raw spectrum occurs at approximately 745.8 nm (18/07/11)

  spectrumColorImg()

    Generate plot of mean

  spinBoxInEqualityChange()

    Conditional inequality value changed.

  subDark()

    Subtract loaded dark spectrum from HSI data.

  subResidual()

    Subtract a linear residual over range

  subtractROIStart()

    Acquire an average spectrum from a user-selected ROI and subtract.

    Note: This function just sets up the signal-slot connection for the MPL window. It executes all the way through

  tabMainChange()
  toolbarSetting()

    Set the toolbar ribbon view

  toolbarSetup()

    Setup the tool ribbon icons

  updateHistory()
  updateOverlays()
  zeroFirstColumn()

    Zero first non-all-zero column. (Rather than crop)

  zeroFirstRow()

    Zero first non-all-zero row. (Rather than crop)

  zeroLastColumn()

    Zero first non-all-zero column. (Rather than crop)

  zeroLastRow()

    Zero first non-all-zero row. (Rather than crop)

crikit.CRIkitUI.crikit_launch(**kwargs)

  Command line launching of CRIkitUI.

  hsicrikit.data.spectra.Hsi

    Hsi instance

  datandarray (3D)

    Numpy array (Y,X,Freq) hsi

  xndarray (1D)

    x-array

  x_unitsstr

    Units of x (e.g. r’$mu$m’)

  x_labelstr

    Label of x (e.g. ‘X’)

  yndarray (1D)

    y-array

  y_unitsstr

    Units of y (e.g. r’$mu$m’)

  y_labelstr

    Label of y (e.g. ‘Y’)

  fndarray (1D)

    frequency-array

  f_unitsstr

    Units of frequency (e.g. r’cm$^{-1}$’)

  f_labelstr

    Label of frequency (e.g. ‘Wavenumber’)

  filenamestr

    Filename of HDF data to auto-load (requires path and dataset_name as well)

  pathstr

    Path of HDF data to auto-load (requires filename and dataset_name as well)

  dataset_namestr

    Dataset name(s) of HDF data to auto-load (requires path and filename as well)

## Module contents

### CRIKit2: Hyperspectral imaging toolkit

CRIKit2, formerly the Coherent Raman Imaging toolKit, is a hyperspectral imaging (HSI) platform (user interface, UI).

#### Usage

python -m crikit

#### Authors

- Charles H. Camp Jr. <charles.camp@nist.gov>